This article is a hands-on walkthrough of the DVWA brute force lab, teaching credential attack techniques across four security levels while demonstrating how defenses progress from none to proper implementation. It covers using Hydra for direct attacks at Low security, bypassing sleep-based rate limiting at Medium, extracting CSRF tokens with Burp Intruder at High, and analyzing the secure code patterns that make Impossible-level truly resistant. The article matters because it teaches both offensive techniques and the defensive coding patterns that should prevent them, giving learners a complete understanding of credential protection.
- Low security uses unprotected GET requestsDVWA's Low security brute force module passes credentials directly in URL query parameters with no CSRF token, rate limiting, or lockout mechanism. The username and password appear as query strings like ?username=admin&password=test&Login=Login, and failed attempts return the same predictable error message 'Username and/or password incorrect.' This design makes it trivial for Hydra's http-get-form module to automate the attack in seconds.
- Hydra extracts session cookies and parametersBefore running Hydra, the attacker must capture the exact request format using Burp or browser DevTools, including the PHPSESSID cookie value, parameter names, and the failure string that distinguishes wrong passwords from successful login. The article provides a complete Hydra command syntax that binds these elements: it specifies the username (-l admin), wordlist (-P), target path, parameter substitution (^USER^ and ^PASS^), the failure string to match, and the session cookie in the HTTP header.
- Sleep delays are bypassed by slowing threadsAt Medium security, DVWA adds a sleep(2) PHP function that delays each login attempt by 2 seconds, which the article describes as 'inconvenience, not protection.' Hydra bypasses this completely using the -t 1 flag to reduce threads to 1, forcing single-threaded execution that naturally waits for each response; the attack still succeeds, just more slowly. The article emphasizes that sleep() does not limit total attempts, it only stretches them over time.
- CSRF tokens require recursive grep extractionHigh security introduces per-request user_token CSRF tokens that must match a session token; Hydra cannot handle dynamic tokens so the attacker must use Burp Suite Intruder instead. The article explains using Pitchfork attack type with Recursive Grep payload extraction: Burp reads the user_token value from each server response and injects it into the next request automatically, effectively automating token reuse and defeating this defense layer.
- Impossible security combines four complementary defensesDVWA's Impossible level implements PDO parameterized queries (preventing SQL injection), SHA-256 password hashing with salt (replacing insecure MD5), a failed_login counter stored per user account, and automatic account lockout after three failed attempts with time-based auto-unlock. The article stresses that no single measure is sufficient alone—the combination makes brute force impractical because lockout stops attempts entirely regardless of attack speed or sophistication.
- PDO prepared statements prevent SQL injectionThe Low security code uses raw string concatenation in SQL queries (vulnerable to injection), while Impossible uses PDO bindParam() with placeholders like 'SELECT * FROM users WHERE user = (:user) LIMIT 1;' and parameter binding. This prevents attackers from injecting SQL code through the username or password fields, removing an alternative attack path that could bypass authentication entirely.
- Source code comparison teaches secure patternsThe article emphasizes reading the actual PHP code at each level (provided via docker exec or direct file access) to see vulnerable patterns replaced by secure implementations. This teaches learners to recognize md5() password hashing, lack of lockout counters, and missing token validation in real production code reviews, and to understand exactly how these patterns enable exploitation.
- Legal and ethical boundaries are non-negotiableThe article repeatedly states that all techniques must only be used against DVWA running on 127.0.0.1, and that unauthorized credential brute force attacks are illegal in all jurisdictions. It explicitly warns that the skills are only for authorized testing in controlled lab environments like DVWA, TryHackMe, or HackTheBox, never against systems you do not own or have explicit written permission to test.
Bottom line: Brute force defense requires account lockout implemented in the database combined with secure password hashing and prepared SQL statements; sleep delays and CSRF tokens alone are ineffective because they can be bypassed by slowing attacks or extracting tokens automatically. Understanding this progression from Low to Impossible security teaches both the offensive techniques used to attack unprotected logins and the specific coding patterns required to defend against them.
Topic: Brute Force — All 4 Security Levels
Next: Command Injection Lab →
🎯 What You’ll Master in Lab 2
⏱️ 25 min read · 3 hands-on exercises
📋 What This Lab Covers
If you are starting here, complete Lab 1 (DVWA Setup) first to get your lab running. This lab assumes DVWA is accessible at http://127.0.0.1 and logged in as admin. The Brute Force module is at: http://127.0.0.1/dvwa/vulnerabilities/brute/
Understanding DVWA Brute Force — The Login Form Target
The DVWA Brute Force module simulates a basic username/password login form. At each security level, the developer has added different protective measures — and your job is to understand what each measure does, why it fails, and what the correct implementation looks like.
Login:
No CSRF token · No rate limit · No lockout — all vulnerabilities present at Low security
Notice the form uses a GET request — meaning the username and password are passed directly in the URL query string. This makes it even simpler to automate with Hydra’s http-get-form module. The failure string (“Username and/or password incorrect”) is what Hydra uses to distinguish a failed attempt from a successful login.
Low Security — Hydra Direct Attack
At Low security, DVWA’s brute force module has zero protection. No rate limiting, no lockout, no CAPTCHA, no CSRF token. A basic Hydra attack finds the password in seconds. This is the baseline — understanding what completely unprotected authentication looks like before studying the defensive layers.
⏱️ Time: 5 minutes · Target: http://127.0.0.1/dvwa/vulnerabilities/brute/
Step 2: Set Security Level to Low (DVWA Security menu)
Step 3: Navigate to Vulnerabilities → Brute Force
Step 4: Open DevTools (F12) → Application → Cookies
Step 5: Copy the PHPSESSID value (looks like: abc123def456…)
Step 6: In Burp Suite, enable intercept and submit the login form
Step 7: Observe the GET request:
GET /dvwa/vulnerabilities/brute/?username=admin&password=test&Login=Login
Step 8: Note the failure response: “Username and/or password incorrect.”
Step 9: Disable intercept — you have the parameters Hydra needs
📸 Screenshot your captured Burp request showing the GET parameters and share in #dvwa-brute-force on Discord.
⏱️ Time: 20 minutes · Target: DVWA 127.0.0.1 (YOUR LAB ONLY)
Work through all three security levels systematically. Replace PHPSESSID with your actual session cookie value before running.
📸 Screenshot your successful Hydra output for Low, and Burp Intruder results for High. Share in #dvwa-brute-force on Discord. Tag #dvwalab2
🧠 QUICK CHECK — Section 3 & 4
Impossible Security — What Correct Defence Looks Like
The Impossible security level in DVWA is not a challenge to bypass — it is the answer. Studying it teaches you exactly what secure authentication code looks like, giving you a reference for both writing secure code and identifying when production code falls short of this standard.
The four security measures that make Impossible actually effective are: PDO parameterised queries preventing SQL injection, SHA-256 with salt instead of MD5, a failed_login counter per user account, and automatic account lockout after three failed attempts with a time-based unlock. Any two of these alone are insufficient — the combination is what makes the difference.
Source Code Comparison — Studying the Impossible Level
⏱️ Time: 10 minutes · Target: Your DVWA source files (read-only analysis)
The most valuable thing you can do after completing a DVWA lab is read the source code. This exercise reads and compares the four security level implementations side by side from the command line.
📸 Screenshot the Impossible-level source code showing the PDO bindParam line and share in #dvwa-source-review on Discord. Tag #securecoding
🧠 QUICK CHECK — Lab 2 Final
📋 Commands Used — Lab 2 Reference
🏆 Lab 2 Complete — Brute Force Mastered
All 4 security levels completed · Source code reviewed · Attack + defence understood
❓ Frequently Asked Questions – Dvwa Brute Force Lab
What does the DVWA brute force module teach?
How do I get my PHPSESSID for the Hydra command?
Why does Hydra fail at High security?
What makes the Impossible-level implementation actually secure?
Can I use this technique on real websites?
What DVWA lab comes next after brute force?
📚 Further Reading
- DVWA Lab 3: Command Injection 2026 — Inject OS commands into DVWA’s vulnerable input field, bypass filters at Medium/High, and establish a reverse shell at High security.
- Password Cracking Explained 2026 — The complete guide to password cracking techniques — hash cracking, wordlists, and GPU acceleration — that complement the brute force techniques in this lab.
- Hydra Cheat Sheet 2026 — 60+ Hydra commands covering every protocol — SSH, FTP, RDP, HTTP forms — with copy-ready examples for all attack scenarios.
- PortSwigger: Password-Based Authentication Vulnerabilities — PortSwigger’s authoritative guide to brute force, password spraying, and credential stuffing — with free interactive labs that extend the DVWA exercises.
- OWASP: Blocking Brute Force Attacks — OWASP’s definitive defensive reference covering account lockout, CAPTCHA, progressive delays, and multi-factor authentication implementation guidance.

