SQL Inject of Code to bypass
目錄
- PHP Code audit
- Think about bypass filtering
- String to URL Code
- String to Base64 Code
- String to JavaScript Escape Code
- String to ASCII Code
- String to Binary Code
- String to Octonary Code
- String to Octonary Code
- String to HTML特殊字符編碼
- 常見繞過waf的操作
- 大小寫繞過
- 雙寫繞過
- 編碼繞過
PHP Code audit
http://xx.xxx.com/api/aaa/bbb?tableName=tb_users'
發(fā)現(xiàn)沒有注入跡象!
代碼審計后發(fā)現(xiàn)寫過濾了特殊符號,因為輸入的參數(shù)只能是數(shù)字和字母。
/*** sql執(zhí)行前 檢測table是否規(guī)范 預(yù)判sql注入* @param $tableName*/ public function checkTable($tableName) {try {if (!empty($tableName) && preg_replace( '/[^a-zA-Z0-9\_]/', '', $tableName)!=$tableName) {Yii::log('檢測表名不一致 '.$tableName , 'error');return false;}} catch (Exception $e) {Yii::log('檢測表名異常', 'error');} }思考有什么繞過的方式?
Think about bypass filtering
假設(shè)要繞過的字符是';
那么可以嘗試如下轉(zhuǎn)碼方式,能避開匹配的規(guī)則,且對方轉(zhuǎn)碼之后也還能解析,那就完美繞過。
String to URL Code
'
String to Base64 Code
Jw==
String to JavaScript Escape Code
%27
String to ASCII Code
39
String to Binary Code
00100111
String to Octonary Code
\47
String to Octonary Code
\x27
String to HTML特殊字符編碼
' = '
" = "
參考:https://www.jb51.net/onlineread/htmlchar.htm
常見繞過waf的操作
大小寫繞過
and
改成如下形式:
And
aNd
ANd
...
雙寫繞過
and
改成如下形式:
anandd
andandandand
aaandnnddd
...
編碼繞過
1' and 1=1 #轉(zhuǎn)成URL-encode格式 %31%27%20%61%6E%64%20%31%3D%31
感謝大佬浮萍(https://fuping.site/)給我提供的工具。
或者御劍也能做轉(zhuǎn)換:
全編碼兩次的作用:
如果上面的操作無效,是因為服務(wù)器會自動對URL進行一次URL編碼,所以需要把關(guān)鍵字編碼兩次。
步驟如下:
第一次編碼:
第二次編碼:
轉(zhuǎn)載于:https://www.cnblogs.com/mysticbinary/articles/11240674.html
總結(jié)
以上是生活随笔為你收集整理的SQL Inject of Code to bypass的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Windows Server 2008防
- 下一篇: 换了手机号码银行卡怎么办