sAMAccountName Spoofing (noPac)

Unpatched domain controllers let a domain user rename a computer account to a domain controller's name and obtain Kerberos tickets as an administrator.

SeverityHigh
CVSS 3.18.8 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H Open in the calculator
CVSS 4.08.7 CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N Open in the calculator
CWECWE-290: Authentication Bypass by Spoofing
OWASP Top 10A07:2025 Authentication Failures
MITRE ATT&CKT1068 Exploitation for Privilege Escalation, T1558 Steal or Forge Kerberos Tickets
CVECVE-2021-42278, CVE-2021-42287
CategoryOutdated Components

Description

noPac, also called sAMAccountName spoofing, combines two Active Directory flaws that Microsoft fixed in November 2021. Under CVE-2021-42278, domain controllers did not check that a computer account's sAMAccountName ends with a dollar sign, so a computer account could be renamed to match a domain controller's name without it. Under CVE-2021-42287, when the account named in a ticket-granting ticket could no longer be found, the domain controller's Kerberos service (the KDC) searched again with a dollar sign appended, and so issued a service ticket to the domain controller's own account in which the requester could name any user.

Together they let any domain user become a domain administrator in a few steps, using the default ability to create computer accounts. The attacker needs a valid domain account and control of a computer account: either one created under the default ms-DS-MachineAccountQuota of 10, or an existing one whose name they have write access to. They clear its service principal names, rename it to a domain controller's name without the dollar sign, request a ticket-granting ticket, rename it back, and then use S4U2self to obtain a service ticket to the domain controller as a domain administrator, after which they can replicate every password hash in the domain with DCSync. The attack is reliable: public tools, including the noPac scripts, Impacket and Rubeus, automate the steps and perform it with a single command. Setting the machine account quota to zero raises the bar but does not remove the flaw.

The weakness is identified from each domain controller's update level, and with a scanner such as the noPac tool's scan mode, which detects an unpatched KDC by requesting a ticket-granting ticket without a Privilege Attribute Certificate (PAC) and comparing its size with a normal one. The full attack is a definitive test but creates and renames objects in the directory.

Remediation

  • Install the November 2021 security updates, or any later cumulative update, on every domain controller. One unpatched domain controller is enough for the attack to succeed, so check them all.
  • Set ms-DS-MachineAccountQuota on the domain object to 0 and delegate the right to join computers to the staff and service accounts that need it, which also blocks other attacks that rely on computer accounts created by ordinary users.
  • Review computer accounts for names that lack a trailing dollar sign or resemble a domain controller's name.
  • Monitor for the attack pattern in events 4741 (a computer account was created), 4742 (a computer account was changed) and 4781 (the name of an account was changed), particularly a rename followed shortly by a rename back.

Confirm the fix by repeating the scan against every domain controller, which should show that ticket-granting tickets are always issued with a PAC.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More Active Directory Findings

Every Active Directory finding