同往常一样,此代码和工具不得用于恶意目的。
由 MDSec Consulting 的 ActiveBreach 团队 Vincent Yiu 编写。允许在署名原作者的前提下修改代码。
Explorer 和 SWBemLocator COM Moniker 的研究由 @enigma0x3 完成
用法:
usage: morph-hta.py [-h] [--in <input_file>] [--out <output_file>]
[--maxstrlen <default: 1000>] [--maxvarlen <default: 40>]
[--maxnumsplit <default: 10>]
optional arguments:
-h, --help show this help message and exit
--in <input_file> File to input Cobalt Strike PowerShell HTA
--out <output_file> File to output the morphed HTA to
--maxstrlen <default: 1000>
Max length of randomly generated strings
--maxvarlen <default: 40>
Max length of randomly generated variable names
--maxnumsplit <default: 10>
Max number of times values should be split in chr
obfuscation
/morphHTA# python morph-hta.py
███╗ ███╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗ ██╗ ██╗████████╗ █████╗
████╗ ████║██╔═══██╗██╔══██╗██╔══██╗██║ ██║ ██║ ██║╚══██╔══╝██╔══██╗
██╔████╔██║██║ ██║██████╔╝██████╔╝███████║█████╗███████║ ██║ ███████║
██║╚██╔╝██║██║ ██║██╔══██╗██╔═══╝ ██╔══██║╚════╝██╔══██║ ██║ ██╔══██║
██║ ╚═╝ ██║╚██████╔╝██║ ██║██║ ██║ ██║ ██║ ██║ ██║ ██║ ██║
╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
Morphing Evil.HTA from Cobalt Strike
Author: Vincent Yiu (@vysec, @vysecurity)
[*] morphHTA initiated
[+] Writing payload to morph.hta
[+] Payload written
减小最大变量名长度和随机生成字符串长度以缩小 HTA 输出体积:
/morphHTA# python morph-hta.py --maxstrlen 4 --maxvarlen 4
chr() 混淆中的最大拆分次数,减少加法运算以缩短长度:
/morphHTA# python morph-hta.py --maxnumsplit 4
更改输入文件和输出文件:
/morphHTA# python morph-hta.py --in advert.hta --out advert-morph.hta
https://www.youtube.com/watch?v=X4S2aQ4o_jA
建议不要上传到 VT:
