Hey everybody, this is my first post on this website đđ».
In this post, I'll show you how to:
đđ» Install the Damn Vulnerable Web Application (DVWA) using XAMPP on Windows, a popular setup for practicing web security skills...
đđ» Set up Wazuh to monitor DVWAâs logs, helping you analyze potential attacks in a controlled environmentBefore we get started.. what is DVWA?
DVWA is a PHP/MySQL web application designed to be vulnerable. Itâs a fantastic tool for security professionals, web developers, and students to practice identifying and exploiting common web vulnerabilities like SQL Injection and Cross-Site Scripting (XSS) in a legal, safe environment.
1ïžâŁ Installing DVWA with XAMPP on Windows
Letâs set up DVWA using XAMPP, a free and open-source web server solution that includes Apache, MariaDB, and PHP. Follow these steps:
- Download and Install XAMPP: Head to the official XAMPP website and download the Windows installer.
Run the installer, selecting Apache and MySQL as components along with phpMyAdmin ticked as well, and complete the setup. Once installed, open the XAMPP Control Panel and start the Apache and MySQL services.
- Download DVWA: Visit the official DVWA GitHub repository and download the ZIP file by clicking the âCodeâ button and selecting âDownload ZIP.â
Extract the ZIP file to a folder named
dvwa
. - Move DVWA to XAMPPâs htdocs: Copy the extracted
dvwa
folder to XAMPPâshtdocs
directory, typically located atC:\xampp\htdocs\
. - Configure DVWA: Navigate to
C:\xampp\htdocs\dvwa\config
. Youâll find a file namedconfig.inc.php.dist
. Rename it toconfig.inc.php
. Open the file in a text editor (e.g., Notepad) and locate the line with the database password. Since XAMPPâs default MySQL password is empty, set the password to blank by editing the line to:$_DVWA['db_password'] = '';
. Save the file. - Access DVWA in Your Browser: Open your browser and navigate to
http://127.0.0.1/dvwa/
. Youâll see a setup page.Scroll down and click âCreate / Reset Databaseâ to initialize the DVWA database. After a moment, youâll be redirected to the login page.
- Log In to DVWA: Use the default credentialsâusername:
admin
, password:password
. Once logged in, you can explore vulnerabilities like SQL Injection and XSS at different difficulty levels.
2ïžâŁ Setting Up Wazuh to Monitor DVWA Logs
Wazuh is a powerful open-source security monitoring platform that can help you analyze logs for potential security events. Since DVWA runs on Apache (via XAMPP), weâll configure Wazuh to monitor Apacheâs access and error logs, which will include DVWA activity.
- Install Wazuh: Wazuh can be deployed in various ways, but for simplicity, I recommend using the pre-built Wazuh OVA (a virtual appliance). Download the latest Wazuh OVA from the Wazuh website and import it into a virtualization tool like VirtualBox. Follow the setup instructions to get the Wazuh manager running. Note the managerâs IP address (e.g.,
192.168.1.100
). - Install the Wazuh Agent on Your Windows Machine: Download the Wazuh agent for Windows from the Wazuh website. Run the installer, and when prompted, enter the Wazuh managerâs IP address to connect the agent to the manager. Complete the installation and ensure the agent service is running.
- Configure the Wazuh Agent to Monitor Apache Logs: On your Windows machine, locate the Wazuh agent configuration file at
C:\Program Files (x86)\ossec-agent\ossec.conf
. Open it in a text editor with administrator privileges. Add the following block to monitor Apache logs generated by XAMPP:
Save the file and restart the Wazuh agent service via the Services app or by running<localfile> <log_format>syslog</log_format> <location>C:\xampp\apache\logs\access.log</location> </localfile> <localfile> <log_format>syslog</log_format> <location>C:\xampp\apache\logs\error.log</location> </localfile>
net stop wazuh
andnet start wazuh
in an elevated Command Prompt. - Simulate Activity in DVWA: Back in DVWA, perform some actions like attempting an SQL Injection (e.g., entering
' OR '1'='1
in a login field) or navigating through different pages.These actions will generate entries in Apacheâs access and error logs.
3ïžâŁ Reading DVWA Logs in Wazuh
Now that the Wazuh agent is sending Apache logs to the Wazuh manager, letâs view them in the Wazuh dashboard.
- Access the Wazuh Dashboard: Open a browser and navigate to your Wazuh managerâs dashboard (e.g.,
https://192.168.1.100:5601
if using the default Kibana port). Log in with the default credentials (usuallyadmin
and a password set during setup). - View the Logs: In the Wazuh dashboard, go to the âSecurity Eventsâ or âDiscoverâ tab. Filter the logs by selecting the index pattern (e.g.,
wazuh-alerts-*
). You can search for logs from your Windows machine by filtering with the agentâs name or IP. Look for entries related toaccess.log
orerror.log
. For example, you might see HTTP requests to/dvwa/
paths, including any malicious inputs you tried. - Analyze the Logs: Wazuh will parse the logs and may generate alerts if it detects suspicious activity (e.g., repeated failed login attempts). Use the dashboard to analyze trends, such as the frequency of requests or errors related to specific DVWA vulnerabilities.
Conclusion â

By following this guide, youâve set up DVWA using XAMPP to practice web security and configured Wazuh to monitor its logs. This setup allows you to experiment with vulnerabilities in a safe environment while learning how to use a SIEM tool like Wazuh to detect and analyze potential attacks. For more resources, check out the OWASP website for web security best practices and the Wazuh documentation for advanced log analysis techniques.