0)脚本代码
@echo off
@set tmp_user=%userprofile:\=\\%
@set debugger_dir=%userprofile%\Desktop\WinDbg\x86\
if "%1" == "" (echo Please Enter Process Name & goto :END)
@echo bp kernel32!CreateProcessInternalW ".if(1){.logopen /t \"%tmp_user%\\Desktop\\Stack.log\";du poi(esp+3*4);k;~*k;.logclose;q}";gc; > script.txt
@echo [+] Settings Registry with gflags.exe ...
start /d "%debugger_dir%" gflags.exe /p /enable %1 /debug "%debugger_dir%\windbg.exe -c '$$< %userprofile%\Desktop\script.txt'"
:END
1)使用方法
只需修改调试器路径即可:
debugger_dir= 根据被调试的软件平台,选择合适的调试器目录
例如CVE-2017-0802 、CVE2017-11882,需要附加调试word.exe的子进程EQNEDT32.EXE:
2.bat EQNEDT32.EXE
其他软件,比如IE浏览器,WORD自身的漏洞,直接在后面输入进程名称即可!
2.bat iexplorer.exe
设置好以后,双击打开POC文件即可!
收集栈信息会保存到Stack-时间.log文件中,该文件第二行会打印出要被创建进程的路径信息,请确保是否与POC预期创建进程的路径一致
2)演示
下面使用CVE-2017-0802这个POC测试,秒收栈信息!