如何使用REW-sploit模擬和分析MSF以及其他類型的攻擊
VSole2021-09-19 15:48:32
關于REW-sploit
REW-sploit是一款功能強大的攻擊分析工具,它可以幫助我們分析Windows Shellcode或其他來自Metasploit/Cobalt Strike的攻擊活動。
不僅如此,REW-sploit還可以幫助廣大研究人員檢測其他惡意代碼或經過混淆處理的代碼。
REW-sploit還可以使用簡單的腳本代碼來自動化分析任務。除此之外,REW-sploit甚至可以從Payload中提取密鑰以解密那些由MSF生成的加密流量。
REW-sploit基于很多現有的優秀框架實現其功能,比如說Unicorn和speakeasy-emulator等等。總而言之,REW-sploit就是為藍隊研究人員設計的,可以幫助廣大研究人員在分析攻擊活動的過程中提供幫助。
功能支持
REW-sploit可以獲取Shellcode/DLL/EXE,模擬惡意代碼的執行,并給我們提供關于當前安全現狀的信息。支持提取的信息包括:
API調用
MSF Payload所使用的加密密鑰
解密來自MSF的流量
Cobalt-Strike配置(需安裝Cobalt-Strike解析器)
工具安裝
REW-sploit安裝過程非常簡單,我們強烈建議大家在Python虛擬環境中使用該工具。
安裝命令如下:
# python -m venv <your-env-path>/rew-sploit # source <your-env-path>/bin/activate # git clone https://github.com/REW-sploit/REW-sploit.git # cd REW-sploit # pip install -r requirements.txt # ./apply_patch.py -f # ./rew-sploit
如果你習慣使用Docker的話,大家也可以使用Dockerfile來創建REW-sploit鏡像:
docker build -t rew-sploit/rew-sploit .
接下來,使用下列命令啟動REW-sploit:
docker run --rm -it --name rew-sploit -v /tmp:/tmp rew-sploit/rew-sploit
安裝過程中你將會看到一個名為apply_patch.py的腳本,這個腳本是一個針對speakeasy-emulator的修復腳本,可以實現跟REW-sploit的兼容。
【可選項】你還可以安裝Cobalt Stike解析器:
# cd REW-sploit/extras # git clone https://github.com/Sentinel-One/CobaltStrikeParser.git
自定義YARA規則
modules/emulate_rules.py文件中包含了可以用來攔截惡意代碼中有趣部分的YARA谷子額,不過大家也可以根據自己的需要來創建自定義YARA規則:
#
# Payload Name: [MSF] windows/meterpreter/reverse_tcp_rc4
# Search for : mov esi,dword ptr [esi]
# xor esi,0x<const>
# Used for : this xor instruction contains the constant used to
# encrypt the lenght of the payload that will be sent as 2nd
# stage
# Architecture: x32
#
yara_reverse_tcp_rc4_xor_32 = 'rule reverse_tcp_rc4_xor { \
strings: \
$opcodes_1 = { 8b 36 \
81 f6 ?? ?? ?? ?? } \
condition: \
$opcodes_1 }'
項目地址
REW-sploit:見閱讀原文
參考資料
https://www.blackhat.com/us-21/arsenal/schedule/index.html#rew-sploit-dissecting-metasploit-attacks-24086
https://github.com/REW-sploit/REW-sploit_docs
https://github.com/Sentinel-One/CobaltStrikeParser
https://github.com/fireeye/speakeasy/?
VSole
網絡安全專家