Jim 的日记“ Quickie:使用radare2 反汇编shellcode ”很好地提醒了如何使用radare2。我不经常使用radare2,实际上我往往会忘记确切使用哪些命令。
在这日记中,我想展示一个工具,我用以前的日记:scdbg。scdbg 是一个 shellcode 模拟器(用于 Win32 32 位 shellcode)。我通过报告分析的 shellcode 调用的 Win32 API 函数,帮助您快速分析 shellcode 的作用。我更喜欢使用 Windows 版本的 scdbg,即使在 OSX 和 Linux(使用 Wine)上也是如此,因为它支持更多的 Win32 API 函数。
要开始分析,只需使用选项 -f 运行 scdbg 以加载存储在文件中的 shellcode:
从这个输出中,我们知道shellcode:
- 加载 DLL wininet
- 使用特定的用户代理字符串初始化 HTTP 连接
- 连接到端口 4444 上的 IP 地址
重要的是要了解这种分析是不完整的。最后一行输出 (Stepcount 2000001) 表示 scdbg 在模拟 2000000 条指令后停止。这是默认设置。要让 scdbg 生成更多分析结果,请使用选项 -s 提供更高的限制。或者使用 -s -1,不受模拟指令数量的限制:
这会产生更多输出,并在调用不受支持的函数 (GetDesktopWindow) 时停止仿真。
scdbg can also produce more verbose output, using option -v (or -vv, -vvv, -vvvv). With option -v, we can see each emulated instruction. I use option -s to limit the output:
This is not a disassembly of the shellcode, it's more like a trace: each emulated instruction is disassembled. You can see this after the second instruction (call), control is passed to address 0x40108F.
To produce a classic disassembly, use option -disasm:
scdbg emulates shellcode, it does not execute it. The shellcode in our example, will not establish an HTTP connection for example.
And the following shellcode, an example of a dropper, does not actually create a file when it is emulated:
Of course, with a dropper, you would like to know what the content of the dropped file is. This can be achieved using option -i:
在这种交互模式下,仍然没有创建临时文件,而是在当前目录中创建了另一个文件(扩展名为.drop_0),内容由shellcode编写:
Didier Stevens
高级经理
Microsoft MVP
blog.DidierStevens.com DidierStevensLabs.com
支持 Drupal 7 Drupal 8 枚举 https://asciinema.org/a/5InNWAotigwM4bRscUi7yKAtt 开发 https://asciinema.org/a/bZmopDt4lyix1D9sgxwQMC…
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论