DVWA provides four distinct security levels that control how vulnerable each module is to exploitation. These levels allow you to practice attacks with increasing difficulty.
The Impossible level is not actually impossible to attack - it’s called “impossible” because it implements security correctly, making traditional attacks ineffective.
if (!isset($_COOKIE['security']) || !in_array($_COOKIE['security'], $security_levels)) { // Set security cookie to impossible if no cookie exists if (in_array($_DVWA['default_security_level'], $security_levels)) { dvwaSecurityLevelSet($_DVWA['default_security_level']); } else { dvwaSecurityLevelSet('impossible'); }}```bashThe current level is stored in the `security` cookie.## Default Security LevelYou can configure the initial security level in `config/config.inc.php`.### Configuration Setting```php$_DVWA['default_security_level'] = 'impossible';
environment: - DEFAULT_SECURITY_LEVEL=low```bash### Default BehaviorFrom `config/config.inc.php.dist:30-33`:```php# Default security level# Default value for the security level with each session.# The default is 'impossible'. You may wish to set this to either 'low', 'medium', 'high' or impossible'.$_DVWA['default_security_level'] = getenv('DEFAULT_SECURITY_LEVEL') ?: 'impossible';
Default is impossible - This encourages reviewing secure code first, then working backward through vulnerable implementations.
function dvwa_start_session() { $security_level = dvwaSecurityLevelGet(); if ($security_level == 'impossible') { $httponly = true; $samesite = "Strict"; } else { $httponly = false; $samesite = ""; } // ... session configuration}```sql| Level | HttpOnly Cookie | SameSite Cookie | Session Regeneration ||-------|----------------|-----------------|----------------------|| Low | ❌ No | ❌ No | ❌ No || Medium | ❌ No | ❌ No | ❌ No || High | ❌ No | ❌ No | ❌ No || Impossible | ✅ Yes | ✅ Strict | ✅ Yes |<Info> Lower security levels intentionally leave the application vulnerable to session attacks like session fixation and XSS-based cookie theft.</Info>## Recommended Learning PathFor the best learning experience, follow this progression:<Steps> <Step title="Start with Low"> Begin at **Low** security to understand the basic vulnerability and learn fundamental exploitation. </Step> <Step title="Progress to Medium"> Move to **Medium** security and practice bypass techniques against basic protections. </Step> <Step title="Challenge yourself at High"> Attempt **High** security to develop advanced skills and creative exploitation methods. </Step> <Step title="Study Impossible"> Review the **Impossible** level source code to understand proper security implementation. </Step></Steps>## Viewing Source CodeYou can view the source code for each security level.### Via Web Interface1. Navigate to any vulnerability module2. Click **"View Source"** in the bottom right3. Select the security level to view its implementation4. Compare different levels side-by-side### Via File SystemAll source files are located in:
Example modules:- `sqli` - SQL Injection- `xss_r` - Reflected XSS- `xss_s` - Stored XSS- `csrf` - Cross-Site Request Forgery- `upload` - File Upload<Tip> Comparing the source code across security levels is one of the best ways to learn both exploitation and defense techniques.</Tip>## Disabling Authentication for TestingFor automated tool testing, you can set a fixed security level and disable authentication.### ConfigurationEdit `config/config.inc.php`:```php$_DVWA['disable_authentication'] = true;$_DVWA['default_security_level'] = 'low';
This allows:
No login required
Direct access to all modules
Fixed security level
Better tool compatibility
Only use this in completely isolated environments. Never expose DVWA with disabled authentication to any network.