數字形注入:
其實對於初學SQL注入,並不需要區分注入類型。
通常來講 SQL注入只是後臺的 數據庫查詢語句不夠嚴謹導致,例如 後臺的查詢daim爲
select email from member where id=$id
其中 $id 爲 我們輸入的值 ,當輸入1,2,3正常數字 ,正常返回,但是如果 輸入 1 or 1=1 則爲永真,即:
select email from member where id=1 or 1=1
測試鏈接: http://45.32.81.200:8080 //此鏈接的注入用post提交,需要抓包
字符型注入:
理解了數字形注入,剩下的注入就全都是字符型了,例如後臺的查詢爲
select email from member where id='$id'
與之前不同的是,$id 上多加了一個引號 ' ' ,因此,如過在向之前一樣輸入 1 or 1=1,後臺就會變成:
select email from member where id='1 or 1=1'
很明顯這樣肯定會數據報錯,因此如何過濾引號是關鍵 ,例如可以輸入 ' or 1=1 # 其中,井號鍵表示註釋一行:
select email from member where id=' ' or 1=1 # '
這樣查詢又爲永真
測試鏈接: http://45.32.81.200:8080