SKILLS UPRISE · CYBER LAB SERIES · LAB 02B
Install DVWA on Windows with XAMPP
The Damn Vulnerable Web Application — a PHP app built to be broken, so you can practise SQL injection, XSS, command injection and file upload attacks on something you are actually allowed to attack. Twelve steps. Two of them exist because the version of this guide going round in slide decks gets the database configuration wrong in a way that will bite you.
Beginner · 20–30 minutes · Requires Lab 02A · Windows 10 or 11 · Updated July 2026
BUILD SHEET
A dedicated database user, not root. DVWA's own config file says so, and XAMPP ships MariaDB — see the corrections below.
Read this before you install it
DVWA is not insecure by accident. Every module in it is a working vulnerability, deliberately left in, with the protections removed. That is exactly what makes it a good teacher and exactly why where you put it matters more than how you install it. Three rules, and they are not negotiable in this course: 1. It stays on 127.0.0.1. If you completed Part 4 of Lab 02A, Apache is already bound to localhost only. Verify it again in step 11. DVWA reachable from your hostel or campus wifi is a working SQL injection endpoint that anyone on that network can find, and the machine it leads to is yours. 2. It never goes on a hosting account, a VPS, or any server with a public address. DVWA's own documentation is blunt about this. “It is only local, nobody knows the URL” is not a control — scanners find paths like /dvwa within hours of a host appearing. 3. Attack only your own copy. The skills transfer to any web application; the permission does not. Practising on someone else's site is an offence under the Information Technology Act in India, whatever you learned it on. If your Windows machine is also your everyday laptop, the safer arrangement is to run XAMPP and DVWA inside the VM you built in Lab 01 and reach it from Kali over a host-only network. Lab 04 sets that up properly.
BEFORE YOU FOLLOW AN OLDER GUIDE
Three things most DVWA walkthroughs get wrong
Search for a DVWA install guide and most of them tell you to point it at the database as root with a blank password. That advice predates XAMPP shipping MariaDB, and DVWA's own configuration file now warns against it in a comment you can read in the screenshot at step 6. Here is what to do instead, and why.
CORRECTION 1
Not root — a dedicated dvwa user
DVWA's config file states that on MariaDB you cannot use root and must create a dedicated user. XAMPP ships MariaDB, not MySQL, so that applies to you. Step 5 creates the user with privileges on one database only — which is also how you would provision a real application.
CORRECTION 2
db_database is 'dvwa', not 'root'
Some decks show db_database set to root. That field is the database NAME, and the config file warns that whatever you name there will be entirely deleted during setup. Naming it root creates a database called root and teaches a wrong mental model. It should read dvwa.
CORRECTION 3
Do not blank the password
“Set the password to blank” only works if your database has no root password — which means undoing the hardening from Lab 02A. With a dedicated user carrying its own password, the database stays protected and DVWA still connects. You lose nothing.
PART 1 OF 4
Get DVWA into htdocs
Three steps. The only decision is what you name the folder.
IF YOU SKIPPED LAB 02A
You need XAMPP first
DVWA is not a program you run — it is PHP source code that needs a web server, PHP and a database to run inside. That is what XAMPP provides. Install it from apachefriends.org, not from a download portal, and work through the hardening in Part 4 of Lab 02A before you come back here.

The XAMPP download for Windows. Take it from apachefriends.org — the official site — rather than a mirror.
01
STACK UP
Start Apache and MySQL, and confirm they are green
Open the XAMPP Control Panel and start Apache, then MySQL. Both module names turn green, both get a PID, and the Port column fills in — 80 and 443 for Apache, 3306 for MySQL. If either goes red, stop here and fix it before touching DVWA. The log panel at the bottom of the Control Panel names the port and the conflict, and the troubleshooting section of Lab 02A lists the usual culprits. Installing an application on top of a stack that will not start just gives you two problems to debug at once.

Apache and MySQL running: green labels, PIDs assigned, ports 80/443 and 3306 shown. This is what the Control Panel should look like before you continue.
02
DOWNLOAD
Clone or download DVWA from GitHub
DVWA lives at github.com/digininja/DVWA and that is the only place to get it. A deliberately vulnerable application redistributed by a random site is an unusually convenient way for someone to hand you something worse than what you asked for. Either download the ZIP from the green Code button, or clone it if you have git installed — cloning makes it trivial to pull updates later:
While you are on that page, open the README. It states which PHP versions the current release supports — worth a glance against the PHP version your XAMPP build shipped with, because that mismatch is the cause of most “some modules just error” reports.

The DVWA repository at github.com/digininja/DVWA. The Code button gives you the ZIP; the config folder is where step 3 takes you.
03
EXTRACT
Extract to C:\xampp\htdocs\dvwa — and rename the folder
Extract the archive into C:\xampp\htdocs. The ZIP unpacks as DVWA-master, which would make your lab live at http://localhost/DVWA-master/ — workable, but every instruction you read afterwards assumes /dvwa/. Rename the folder to lowercase dvwa. Do not extract it into htdocs root. Some older guides do, which puts DVWA's setup.php at http://localhost/setup.php and mixes its files in with everything else you will host. Keep it in its own folder:
PART 2 OF 4
Configure the database connection
Three steps, and this is where the older guides go wrong.
04
RENAME
config.inc.php.dist → config.inc.php
Go to C:\xampp\htdocs\dvwa\config. There is one file: config.inc.php.dist. Copy it — do not just rename it — to config.inc.php in the same folder. Why copy rather than rename: the .dist file is the shipped template, tracked in git. Keeping it means you can always diff your config against the original, and a git pull will not conflict with your edits. If Windows shows the file as config.inc rather than config.inc.php.dist, file extensions are hidden. Turn on File name extensions in Explorer's View tab before you rename anything — otherwise you will produce config.inc.php.php and spend twenty minutes wondering why nothing works.

The config folder before renaming: only config.inc.php.dist is present. Copy it to config.inc.php alongside it.
05
DB USER
Create a dedicated database user — not root
This step is missing from most walkthroughs and it is the one DVWA's own config file asks for. Open the Shell from the XAMPP Control Panel and log in with the root password you set in Lab 02A:
Read what you just typed, because it is a lesson rather than a formality. GRANT ALL PRIVILEGES ON dvwa.* gives this account complete control of one database and no access to any other. If DVWA is later compromised through one of its own vulnerabilities — which is the entire point of DVWA — the attacker inherits exactly those privileges and nothing more. Hand it root instead and a successful SQL injection in a practice app owns every database on your machine. This is least privilege, and you have just implemented it. It is also the exact reasoning you will write into a client report one day.
06
EDIT CONFIG
Point config.inc.php at that user
Open C:\xampp\htdocs\dvwa\config\config.inc.php in a real editor — VS Code or Notepad++, not Notepad, which will not show you the line endings and can save with the wrong encoding. Set the database block to this:
Use 127.0.0.1 rather than localhost for db_server. On Windows, localhost can resolve to the IPv6 address ::1 while MariaDB listens only on IPv4, which produces a connection failure that looks exactly like a wrong password. Read the comments around this block in your own file as you edit. Two of them matter: the warning that the database named in db_database will be entirely deleted during setup, and the note that MariaDB users must create a dedicated account rather than using root. That second comment is the source for step 5 — it is DVWA's own instruction, not our preference.

config.inc.php open for editing. Note the two comments above the database block: the deletion warning on db_database, and the MariaDB instruction to create a dedicated user instead of using root. Set db_database and db_user to dvwa and supply the password from step 5.
PART 3 OF 4
Create the database and log in
Two steps, and DVWA checks its own prerequisites for you.
07
SETUP
Open setup.php and press Create / Reset Database
Go to http://localhost/dvwa/setup.php. DVWA shows a status page listing everything it needs, which is genuinely useful — read it before you click anything. Green means satisfied, red means a module will misbehave. You are looking for: • Backend database: MySQL/MariaDB • Database username, database name and host matching what you set in step 6 • Writable folder …\hackable\uploads\: Yes — needed by the file upload module • Writable folder …\config: Yes • reCAPTCHA key: expect Missing unless you add your own keys, which only affects the Insecure CAPTCHA module • allow_url_fopen and allow_url_include: only needed for the File Inclusion modules, and step 9 covers them Then press Create / Reset Database at the bottom. DVWA drops and recreates its tables and seeds the practice data. The page reloads and redirects you to the login screen. That same button is how you recover later: when you have mangled the database experimenting, come back here and reset it rather than reinstalling.

The setup.php status page. Check the database values against your config and confirm both writable folders say Yes, then press Create / Reset Database.
08
LOG IN
admin / password — then change it
DVWA's default credentials are admin and password. Log in and you land on the main page with the vulnerability modules down the left side. Change that password immediately, from the application's own UI. Yes, it is a lab. Yes, it is on localhost. Do it anyway — because the habit of leaving documented default credentials on a running service is precisely the habit that shows up as a finding on real assessments, and the way you avoid it in production is by never practising it. Then set the security level. DVWA Security in the left menu switches between Low, Medium, High and Impossible. Low is where you start; Impossible is the correctly written version of each module and is genuinely worth reading afterwards, because it shows you the fix rather than just the flaw.
PART 4 OF 4
Module prerequisites, isolation, and a rollback point
Four steps that decide whether this stays a lab.
09
FILE INCLUSION
Only if you need it: allow_url_fopen and allow_url_include
The File Inclusion modules need two PHP settings that are off by default. If setup.php showed them in red and you want to work through those exercises, edit C:\xampp\php\php.ini:
Restart Apache from the Control Panel afterwards. Understand what you just enabled. allow_url_include lets PHP include and execute code from a remote URL — it is the setting that turns a local file inclusion bug into remote code execution. It has been off by default for years for exactly that reason, and it is deprecated. Turn it on to study Remote File Inclusion, then turn it back off. Leaving it on permanently means every PHP application on this machine, including your own coursework, carries a class of vulnerability it otherwise would not.
10
VERIFY BINDING
Prove it is not reachable from the network
You bound Apache and MariaDB to localhost in Lab 02A. Verify it now, because this is the step that separates a lab from an incident, and configuration drifts:
Then test it from the outside rather than trusting the output. From your phone on the same wifi, with wifi on and mobile data off, open http://YOUR-PC-IP/dvwa/. Find the IP with ipconfig. You want a connection error. If DVWA's login page loads on your phone, it is exposed — go back to Lab 02A Part 4 and fix the Listen directive before you do anything else. This is also a good moment to notice how easy that test was. Anyone else on that network can run it too.
11
STOP WHEN IDLE
Off by default
Stop Apache and MySQL when you finish a session. A deliberately vulnerable web application running every hour your laptop is on — in cafes, on campus, on hotel wifi — is a standing risk for no benefit. Two clicks in the Control Panel, or:
And keep the service checkboxes in the Control Panel unticked so neither starts with Windows.
12
ROLLBACK
Back up the config and the database
You are about to spend weeks deliberately breaking this application. Give yourself a five-second restore:
In practice, Create / Reset Database on setup.php handles most of what you will break. The dump matters when you have customised something and want it back. If you are running this inside the VM from Lab 01, a VirtualBox snapshot named dvwa-clean is faster than either.
WHEN IT BREAKS
Eight failures, sorted by what you see
Almost every one of these is the database connection or a file path. Read the actual error before you search for it — DVWA's messages are unusually honest.
"Could not connect to the MySQL service" on setup.php
"Access denied for user 'root'@'localhost'"
The page is blank, or shows PHP code as plain text
404 on http://localhost/dvwa/setup.php
setup.php says a folder is not writable
Some modules error out, others work fine
The login page loads but admin / password is rejected
It works on your laptop but a classmate's phone can load it too
QUESTIONS FROM CLASS
Asked in every batch
Is installing DVWA legal?
Why can't I just use root with a blank password like the older guides say?
DVWA or a hosted platform like Hack The Box and TryHackMe?
Should I run DVWA on Windows or inside the Kali VM?
Which security level should I use?
Do I need the reCAPTCHA keys?
Can I put this on my college server so my whole class can use it?
Something is broken and I want to start over. Do I reinstall?
SOURCES & NOTES
Where this comes from
DVWA is published by Robin Wood (digininja) at github.com/digininja/DVWA. The database-user guidance in steps 5 and 6 comes from the comments in DVWA's own config.inc.php.dist and its README. XAMPP is published by Apache Friends. The corrections at the top of this page, the least-privilege reasoning, the isolation checks and the troubleshooting section come from our own classroom experience across student batches. Screenshots are Skills Uprise course material.
A NOTE ON THE SCREENSHOTS
These images were taken from an earlier version of this lesson. They still show the correct clicks, but the config screenshot shows the older root-with-blank-password approach that steps 5 and 6 now replace — which is why the corrections appear before the steps rather than after them. Worth re-capturing when you next record this lesson, on a current XAMPP build and a machine whose Windows username is not visible in the frame.
DVWA is licensed by its authors; see the repository for terms. XAMPP, Apache, MariaDB and PHP are the property of their respective projects. Skills Uprise is not affiliated with, endorsed by or sponsored by any of them.
LAB 02B COMPLETE
You have a target you are allowed to break.
Submit three screenshots for Lab 02B: setup.php with your dvwa database values, the DVWA main page after logging in, and netstat showing Apache bound to 127.0.0.1. The third one is the graded part — the whole lab is worthless if the target is reachable from outside your machine.
LAB 03
Your first SQL injection
Work the SQLi module from Low to Impossible, reading the source at every level.
LAB 04
An isolated host-only network
Move the target into its own VM so nothing vulnerable touches your real network.
LAB 02A
Install XAMPP on Windows
The stack this runs on, including the four hardening steps this lab depends on.
