This article provides a hands-on walkthrough of bypassing CSRF token protection on login forms using Burp Suite macros, specifically against DVWA's High security brute force lab. It demonstrates how standard brute force tools fail when tokens change per request, and teaches the exact configuration steps to extract and refresh tokens automatically before each attack attempt. The technique applies to real-world CSRF-protected authentication forms encountered in penetration testing engagements.
- Why CSRF tokens defeat standard brute forceAt DVWA High security, each login form request generates a unique user_token (32-character MD5 hash) that must match the server-side session value. Static brute force tools like Hydra or standard Intruder submit the same token repeatedly, which becomes stale and is silently rejected—the application shows no error, making tools appear to find no valid credentials despite the token being the actual problem, not the passwords.
- Burp macro extracts fresh tokens automaticallyA macro is a recorded HTTP request sequence that Burp replays before each attack. For this lab, the macro GETs the brute force page, extracts the user_token value from the hidden input field in the HTML response using cursor selection to identify the exact 32-character substring, and stores it for injection. The article emphasizes cursor selection in Step 5 of Exercise 2 as the critical configuration—Burp uses the selected substring to determine what data to extract.
- Session Handling Rule bridges macro to IntruderThe Session Handling Rule automatically runs the macro before each Intruder request and replaces the static user_token parameter in the POST body with the freshly extracted value. Configuration requires specifying the URL scope (the brute force endpoint), selecting only the Intruder tool scope (to prevent the macro running on all browser requests), and checking the option to update the current request with macro-extracted parameters.
- Thread count must equal one for successConcurrent threads cause a race condition where multiple simultaneous token fetch requests invalidate each other before any POST can use a valid token. Setting Resource Pool to maximum 1 concurrent request forces sequential execution: macro fetches token → request sends with that token → next macro fetch → next request, ensuring each token is current when its login attempt fires. The article includes a personal anecdote of the author experiencing 45 minutes of identical response lengths due to using thread count 10.
- Response length identifies successful credentialsWhen DVWA High security silently rejects invalid tokens, Intruder shows identical response lengths for all attempts. A correct password produces a longer response containing 'Welcome to the password protected area,' creating a measurable difference. Sorting Intruder results by response length reveals which credential attempt succeeded—this differentiation technique is standard when no explicit error message distinguishes right from wrong passwords.
- Silent failure mode makes CSRF effectiveUnlike an explicit 'invalid token' error, DVWA High security silently ignores login attempts with stale tokens—the page reloads without error or success messages. This silent rejection is what prevents naive static brute force tools from detecting token problems; they exhaust wordlists reporting zero matches when actually every attempt failed due to token staleness, not wrong passwords. Understanding this silent behavior is essential for recognizing when macro-based token refresh is necessary.
- Technique transfers to real applications unchangedThe article explicitly states this macro workflow applies directly to any real CSRF-protected login form—only the URL and parameter name change. The extraction method, session handling rule structure, and thread count requirement remain identical. This makes it a transferable professional-grade skill used in real penetration testing engagements, as emphasized in the final takeaway section.
Bottom line: Burp Suite macros combined with session handling rules bypass CSRF token protection by automatically extracting a fresh token before each login attempt, requiring only single-threaded execution and URL-scoped configuration. This technique is essential for testing CSRF-protected authentication in professional security assessments and applies to any real web application using per-request tokens, not just DVWA.
FREE
Part of the DVWA Lab Series — 30 Labs
🎯 What You’ll Learn in Lab 15
⏱️ 45 min · 3 Burp Suite exercises
✅ Prerequisites
- DVWA running locally (Lab 1: Setup Guide)
- Lab 2: Brute Force with Hydra — understand the Low/Medium approach first
- Lab 14: Security Levels Explained — understand how the CSRF token works in source code
- Burp Suite Community or Professional with proxy configured
📋 DVWA Brute Force Advanced Lab 15 Contents — Anti-CSRF Brute Force Bypass
In Lab 14 you analysed the High security CSRF token source code — the md5(uniqid()) generation and per-request session validation. Lab 15 applies that understanding directly: you know where the token lives in the HTML and how it is validated, which is everything you need to configure the macro. The DVWA Lab Series is sequenced so each lab builds on the previous.
Why Standard Brute Force Fails at High Security
At Low and Medium security, the DVWA brute force form has no CSRF token. Tools like Hydra and Burp Intruder can send login attempts as-is — each request is independent. At High security, a hidden user_token field is added to the form. The server generates a unique token for each page load, stores it in the session, and validates that the submitted token matches when the form is submitted. A token that was valid for the last request is invalid for the current one.
⏱️ Time: 8 minutes · DVWA at High security · Burp Suite active
📸 Screenshot the Repeater showing the static token and identical response lengths in Intruder. Share in #dvwa-labs on Discord.
Configuring the Burp Macro — Token Extraction
A Burp macro is a recorded sequence of HTTP requests that Burp replays automatically. For this lab, the macro is a single GET request to the brute force page that extracts the user_token hidden field value from the HTML response. The Session Handling Rule then injects that fresh value into the POST body before each Intruder request fires.
⏱️ Time: 20 minutes · Burp Suite open · DVWA High security
📸 Screenshot the “Test macro” result showing user_token successfully extracted. Share in #dvwa-labs on Discord.
Session Handling Rule — Applying the Macro to Intruder
The Session Handling Rule is the bridge between the macro and Intruder. Without it, Burp knows how to extract the token but does not know when to do so or where to put it. The rule says: before every Intruder request to this URL, run the macro and replace the user_token parameter in the request with the freshly extracted value. The result is that every single Intruder payload gets sent with a valid, current token.
Running the Attack — Successful CSRF Bypass
⏱️ Time: 12 minutes · Macro configured from Exercise 2
📸 Screenshot Intruder results showing the different response length for admin:password. Share in #dvwa-labs on Discord. Tag #dvwabrute2026
🧠 QUICK CHECK — Lab 15
📋 Lab 15 Key Takeaways
🏆 Mark Lab 15 as Complete
Lab 15 is the most advanced Burp Suite technique in the DVWA series. Macros and session handling rules apply far beyond DVWA — any real application with CSRF-protected authentication forms can be tested using this exact approach. This is a professional-grade skill used in real penetration testing engagements.
❓ Frequently Asked Questions
What is anti-CSRF token brute force protection?
What is a Burp Suite Macro?
Why does standard Hydra fail against DVWA High security?
What is the token parameter name in DVWA High security?
Why must Intruder run at 1 thread with macros?
What comes after Lab 15?
Lab 14: DVWA Security Levels Explained
Lab 16: DVWA Command Injection Advanced
📚 Further Reading
- DVWA Security Levels Explained 2026 — Lab 14 reveals the exact PHP source for the CSRF token generation — understanding md5(uniqid()) and session validation is the prerequisite for configuring the Lab 15 macro extraction correctly.
- DVWA Brute Force Lab 2026 — Lab 2 covers Hydra and Burp Intruder against Low/Medium security — the baseline brute force skills that Lab 15 extends to defeat CSRF token protection at High security.
- DVWA Labs Hub — All 30 DVWA labs in sequence — Lab 15 is the halfway milestone at 50%, and the Burp macro skills learned here apply directly to upcoming web application testing labs.
- Burp Suite Macros — Official Documentation — PortSwigger’s official macro documentation covering all configuration options, response extraction methods, regex vs cursor selection, and session handling rule integration for complex authentication flows.
- PortSwigger — Password-Based Authentication Labs — PortSwigger Web Academy authentication labs that apply CSRF token bypass in real web application contexts — the natural next step after mastering the technique on DVWA.

