Coder Social home page Coder Social logo

digininja / dvwa Goto Github PK

View Code? Open in Web Editor NEW
9.7K 304.0 3.4K 2.37 MB

Damn Vulnerable Web Application (DVWA)

License: GNU General Public License v3.0

PHP 89.46% CSS 1.83% JavaScript 7.48% Python 0.98% Dockerfile 0.26%
dvwa php sql-injection security training infosec hacking

dvwa's Introduction

DAMN VULNERABLE WEB APPLICATION

Damn Vulnerable Web Application (DVWA) is a PHP/MySQL web application that is damn vulnerable. Its main goal is to be an aid for security professionals to test their skills and tools in a legal environment, help web developers better understand the processes of securing web applications and to aid both students & teachers to learn about web application security in a controlled class room environment.

The aim of DVWA is to practice some of the most common web vulnerabilities, with various levels of difficulty, with a simple straightforward interface. Please note, there are both documented and undocumented vulnerabilities with this software. This is intentional. You are encouraged to try and discover as many issues as possible.


WARNING!

Damn Vulnerable Web Application is damn vulnerable! Do not upload it to your hosting provider's public html folder or any Internet facing servers, as they will be compromised. It is recommended using a virtual machine (such as VirtualBox or VMware), which is set to NAT networking mode. Inside a guest machine, you can download and install XAMPP for the web server and database.

Disclaimer

We do not take responsibility for the way in which any one uses this application (DVWA). We have made the purposes of the application clear and it should not be used maliciously. We have given warnings and taken measures to prevent users from installing DVWA on to live web servers. If your web server is compromised via an installation of DVWA, it is not our responsibility, it is the responsibility of the person/s who uploaded and installed it.


License

This file is part of Damn Vulnerable Web Application (DVWA).

Damn Vulnerable Web Application (DVWA) is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Damn Vulnerable Web Application (DVWA) is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Damn Vulnerable Web Application (DVWA). If not, see https://www.gnu.org/licenses/.


Internationalisation

This file is available in multiple languages:

If you would like to contribute a translation, please submit a PR. Note though, this does not mean just run it through Google Translate and send that in, those will be rejected. Submit your translated version by adding a new 'README.xx.md' file where xx is the two-letter code of your desired language (based on ISO 639-1).


Download

While there are various versions of DVWA around, the only supported version is the latest source from the official GitHub repository. You can either clone it from the repo:

git clone https://github.com/digininja/DVWA.git

Or download a ZIP of the files.


Installation

Automated Installation 🛠️

Note, this is not an official DVWA script, it was written by IamCarron. A lot of work went into creating the script and, when it was created, it did not do anything malicious, however it is recommended you review the script before blindly running it on your system, just in case. Please report any bugs to IamCarron, not here.

An automated configuration script for DVWA on Debian-based machines, including Kali, Ubuntu, Kubuntu, Linux Mint, Zorin OS...

Note: This script requires root privileges and is tailored for Debian-based systems. Ensure you are running it as the root user.

Installation Requirements

  • Operating System: Debian-based system (Kali, Ubuntu, Kubuntu, Linux Mint, Zorin OS)
  • Privileges: Execute as root user

Installation Steps

One-Liner

This will download an install script written by @IamCarron and run it automatically. This would not be included here if we did not trust the author and the script as it was when we reviewed it, but there is always the chance of someone going rogue, and so if you don't feel safe running someone else's code without reviewing it yourself, follow the manual process and you can review it once downloaded.

sudo bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/IamCarron/DVWA-Script/main/Install-DVWA.sh)"
Manually Running the Script
  1. Download the script:

    wget https://raw.githubusercontent.com/IamCarron/DVWA-Script/main/Install-DVWA.sh
  2. Make the script executable:

    chmod +x Install-DVWA.sh
  3. Run the script as root:

    sudo ./Install-DVWA.sh

Installation Videos

Windows + XAMPP

The easiest way to install DVWA is to download and install XAMPP if you do not already have a web server setup.

XAMPP is a very easy to install Apache Distribution for Linux, Solaris, Windows and Mac OS X. The package includes the Apache web server, MySQL, PHP, Perl, a FTP server and phpMyAdmin.

This video walks you through the installation process for Windows but it should be similar for other OSs.

Docker

Thanks to hoang-himself and JGillam, every commit to the master branch causes a Docker image to be built and ready to be pulled down from GitHub Container Registry.

For more information on what you are getting, you can browse the prebuilt Docker images.

Getting Started

Prerequisites: Docker and Docker Compose.

  • If you are using Docker Desktop, both of these should be already installed.
  • If you prefer Docker Engine on Linux, make sure to follow their installation guide.

We provide support for the latest Docker release as shown above. If you are using Linux and the Docker package that came with your package manager, it will probably work too, but support will only be best-effort.

Upgrading Docker from the package manager version to upstream requires that you uninstall the old versions as seen in their manuals for Ubuntu, Fedora and others. Your Docker data (containers, images, volumes, etc.) should not be affected, but in case you do run into a problem, make sure to tell Docker and use search engines in the mean time.

Then, to get started:

  1. Run docker version and docker compose version to see if you have Docker and Docker Compose properly installed. You should be able to see their versions in the output.

    For example:

    >>> docker version
    Client:
     [...]
     Version:           23.0.5
     [...]
    
    Server: Docker Desktop 4.19.0 (106363)
     Engine:
      [...]
      Version:          23.0.5
      [...]
    
    >>> docker compose version
    Docker Compose version v2.17.3
    

    If you don't see anything or get a command not found error, follow the prerequisites to setup Docker and Docker Compose.

  2. Clone or download this repository and extract (see Download).

  3. Open a terminal of your choice and change its working directory into this folder (DVWA).

  4. Run docker compose up -d.

DVWA is now available at http://localhost:4280.

Notice that for running DVWA in containers, the web server is listening on port 4280 instead of the usual port of 80. For more information on this decision, see I want to run DVWA on a different port.

Local Build

If you made local changes and want to build the project from local, go to compose.yml and change pull_policy: always to pull_policy: build.

Running docker compose up -d should trigger Docker to build an image from local regardless of what is available in the registry.

See also: pull_policy.

PHP Versions

Ideally you should be using the latest stable version of PHP as that is the version that this app will be developed and tested on.

Support will not be given for anyone trying to use PHP 5.x.

Versions less than 7.3 have known issues that will cause problems, most of the app will work, but random things may not. Unless you have a very good reason for using such an old version, support will not be given.

Linux Packages

If you are using a Debian based Linux distribution, you will need to install the following packages (or their equivalent):

  • apache2
  • libapache2-mod-php
  • mariadb-server
  • mariadb-client
  • php php-mysqli
  • php-gd

I would recommend doing an update before this, just so you make sure you are going to get the latest version of everything.

apt update
apt install -y apache2 mariadb-server mariadb-client php php-mysqli php-gd libapache2-mod-php

The site will work with MySQL instead of MariaDB but we strongly recommend MariaDB as it works out of the box whereas you have to make changes to get MySQL to work correctly.

Configurations

Config File

DVWA ships with a dummy copy of its config file which you will need to copy into place and then make the appropriate changes. On Linux, assuming you are in the DVWA directory, this can be done as follows:

cp config/config.inc.php.dist config/config.inc.php

On Windows, this can be a bit harder if you are hiding file extensions, if you are unsure about this, this blog post explains more about it:

How to Make Windows Show File Extensions

Database Setup

To set up the database, simply click on the Setup DVWA button in the main menu, then click on the Create / Reset Database button. This will create / reset the database for you with some data in.

If you receive an error while trying to create your database, make sure your database credentials are correct within ./config/config.inc.php. This differs from config.inc.php.dist, which is an example file.

The variables are set to the following by default:

$_DVWA[ 'db_server'] = '127.0.0.1';
$_DVWA[ 'db_port'] = '3306';
$_DVWA[ 'db_user' ] = 'dvwa';
$_DVWA[ 'db_password' ] = 'p@ssw0rd';
$_DVWA[ 'db_database' ] = 'dvwa';

Note, if you are using MariaDB rather than MySQL (MariaDB is default in Kali), then you can't use the database root user, you must create a new database user. To do this, connect to the database as the root user then use the following commands:

mysql> create database dvwa;
Query OK, 1 row affected (0.00 sec)

mysql> create user dvwa@localhost identified by 'p@ssw0rd';
Query OK, 0 rows affected (0.01 sec)

mysql> grant all on dvwa.* to dvwa@localhost;
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

Disable Authentication

Some tools don't work well with authentication so can't be used with DVWA. To get around this, there is a config option to disable authentication checking. To do this, simply set the following in the config file:

$_DVWA[ 'disable_authentication' ] = true;

You will also need to set the security level to one that is appropriate to the testing you want to do:

$_DVWA[ 'default_security_level' ] = 'low';

In this state, you can access all the features without needing to log in and set any cookies.

Folder Permissions

  • ./hackable/uploads/ - Needs to be writeable by the web service (for File Upload).

PHP configuration

On Linux systems, likely found in /etc/php/x.x/fpm/php.ini or /etc/php/x.x/apache2/php.ini.

Make sure you restart the php service or Apache after making the changes.

reCAPTCHA

This is only required for the "Insecure CAPTCHA" lab, if you aren't playing with that lab, you can ignore this section.

Generated a pair of API keys from https://www.google.com/recaptcha/admin/create.

These then go in the following sections of ./config/config.inc.php:

  • $_DVWA[ 'recaptcha_public_key' ]
  • $_DVWA[ 'recaptcha_private_key' ]

Default Credentials

Default username = admin

Default password = password

...can easily be brute forced ;)

Login URL: http://127.0.0.1/login.php

Note: This will be different if you installed DVWA into a different directory.


Troubleshooting

These assume you are on a Debian based distro, such as Debian, Ubuntu and Kali. For other distros, follow along, but update the command where appropriate.

Containers

I want to access the logs

If you are using Docker Desktop, logs can be accessed from the graphical application. Some minor details may change with newer versions, but the access method should be the same.

Overview of DVWA compose Viewing DVWA logs

Logs can also be accessed from the terminal.

  1. Open a terminal and change its working directory to DVWA

  2. Show the merged logs

    docker compose logs

    In case you want to export the logs to a file, e.g. dvwa.log

    docker compose logs >dvwa.log

I want to run DVWA on a different port

We don't use port 80 by default for a few reasons:

  • Some users might already be running something on port 80.
  • Some users might be using a rootless container engine (like Podman), and 80 is a privileged port (< 1024). Additional configuration (e.g. setting net.ipv4.ip_unprivileged_port_start) is required, but you will have to research on your own.

You can expose DVWA on a different port by changing the port binding in the compose.yml file. For example, you can change

ports:
  - 127.0.0.1:4280:80

to

ports:
  - 127.0.0.1:8806:80

DVWA is now accessible at http://localhost:8806.

In cases in which you want DVWA to not only be accessible exclusively from your own device, but on your local network too (e.g. because you are setting up a test machine for a workshop), you can remove the 127.0.0.1: from the port mapping (or replace it with you LAN IP). This way it will listen on all available device. The safe default should always be to only listen on your local loopback device. After all, it is a damn vulnerable web application, running on your machine.

DVWA auto starts when Docker runs

The included compose.yml file automatically runs DVWA and its database when Docker starts.

To disable this, you can delete or comment out the restart: unless-stopped lines in the compose.yml file.

If you want to disable this behavior temporarily, you can run docker compose stop, or use Docker Desktop, find dvwa and click Stop. Additionally, you can delete the containers, or run docker compose down.

Log files

On Linux systems Apache generates two log files by default, access.log and error.log and on Debian based system these are usually found in /var/log/apache2/.

When submitting error reports, problems, anything like that, please include at least the last five lines from each of these files. On Debian based systems you can get these like this:

tail -n 5 /var/log/apache2/access.log /var/log/apache2/error.log

I browsed to the site and got a 404

If you are having this problem you need to understand file locations. By default, the Apache document root (the place it starts looking for web content) is /var/www/html. If you put the file hello.txt in this directory, to access it you would browse to http://localhost/hello.txt.

If you created a directory and put the file in there - /var/www/html/mydir/hello.txt - you would then need to browse to http://localhost/mydir/hello.txt.

Linux is by default case sensitive and so in the example above, if you tried to browse to any of these, you would get a 404 Not Found:

  • http://localhost/MyDir/hello.txt
  • http://localhost/mydir/Hello.txt
  • http://localhost/MYDIR/hello.txt

How does this affect DVWA? Most people use git to checkout DVWA into /var/www/html, this gives them the directory /var/www/html/DVWA/ with all the DVWA files inside it. They then browse to http://localhost/ and get either a 404 or the default Apache welcome page. As the files are in DVWA, you must browse to http://localhost/DVWA.

The other common mistake is to browse to http://localhost/dvwa which will give a 404 because dvwa is not DVWA as far as Linux directory matching is concerned.

So after setup, if you try to visit the site and get a 404, think about where you installed the files to, where they are relative to the document root, and what the case of the directory you used is.

"Access denied" running setup

If you see the following when running the setup script it means the username or password in the config file do not match those configured on the database:

Database Error #1045: Access denied for user 'notdvwa'@'localhost' (using password: YES).

The error is telling you that you are using the username notdvwa.

The following error says you have pointed the config file at the wrong database.

SQL: Access denied for user 'dvwa'@'localhost' to database 'notdvwa'

It is saying that you are using the user dvwa and trying to connect to the database notdvwa.

The first thing to do is to double check what you think you put in the config file is what is actually there.

If it matches what you expect, the next thing to do is to check you can log in as the user on the command line. Assuming you have a database user of dvwa and a password of p@ssw0rd, run the following command:

mysql -u dvwa -pp@ssw0rd -D dvwa

Note: There is no space after the -p

If you see the following, the password is correct:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 10.3.22-MariaDB-0ubuntu0.19.10.1 Ubuntu 19.10

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [dvwa]>

As you can connect on the command line, it is likely something wrong in the config file, double check that and then raise an issue if you still can't get things working.

If you see the following, the username or password you are using is wrong. Repeat the Database Setup steps and make sure you use the same username and password throughout the process.

ERROR 1045 (28000): Access denied for user 'dvwa'@'localhost' (using password: YES)

If you get the following, the user credentials are correct but the user does not have access to the database. Again, repeat the setup steps and check the database name you are using.

ERROR 1044 (42000): Access denied for user 'dvwa'@'localhost' to database 'dvwa'

The final error you could get is this:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

This is not an authentication issue but tells you that the database server is not running. Start it with the following

sudo service mysql start

Connection Refused

An error similar to this one:

Fatal error: Uncaught mysqli_sql_exception: Connection refused in /var/sites/dvwa/non-secure/htdocs/dvwa/includes/dvwaPage.inc.php:535

Means your database server is not running or you've got the wrong IP address in the config file.

Check this line in the config file to see where the database server is expected to be:

$_DVWA[ 'db_server' ]   = '127.0.0.1';

Then go to this server and check that it is running. In Linux this can be done with:

systemctl status mariadb.service

And you are looking for something like this, the important bit is that it says active (running).

● mariadb.service - MariaDB 10.5.19 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-03-14 16:04:25 GMT; 1 week 5 days ago

If it is not running, you can start it with:

sudo systemctl stop mariadb.service 

Note the sudo and make sure you put your Linux user password in if requested.

In Windows, check the status in the XAMPP console.

Unknown authentication method

With the most recent versions of MySQL, PHP can no longer talk to the database in its default configuration. If you try to run the setup script and get the following message it means you have configuration.

Database Error #2054: The server requested authentication method unknown to the client.

You have two options, the easiest is to uninstall MySQL and install MariaDB. The following is the official guide from the MariaDB project:

https://mariadb.com/resources/blog/how-to-migrate-from-mysql-to-mariadb-on-linux-in-five-steps/

Alternatively, follow these steps:

  1. As root, edit the following file: /etc/mysql/mysql.conf.d/mysqld.cnf

  2. Under the line [mysqld], add the following: default-authentication-plugin=mysql_native_password

  3. Restart the database: sudo service mysql restart

  4. Check the authentication method for your database user:

    mysql> select Host,User, plugin from mysql.user where mysql.user.User = 'dvwa';
    +-----------+------------------+-----------------------+
    | Host      | User             | plugin                |
    +-----------+------------------+-----------------------+
    | localhost | dvwa             | caching_sha2_password |
    +-----------+------------------+-----------------------+
    1 rows in set (0.00 sec)
  5. You'll likely see caching_sha2_password. If you do, run the following command:

    mysql> ALTER USER dvwa@localhost IDENTIFIED WITH mysql_native_password BY 'p@ssw0rd';
  6. Re-running the check, you should now see mysql_native_password.

    mysql> select Host,User, plugin from mysql.user where mysql.user.User = 'dvwa';
    +-----------+------+-----------------------+
    | Host      | User | plugin                |
    +-----------+------+-----------------------+
    | localhost | dvwa | mysql_native_password |
    +-----------+------+-----------------------+
    1 row in set (0.00 sec)

After all that, the setup process should now work as normal.

If you want more information see the following page: https://www.php.net/manual/en/mysqli.requirements.php.

Database Error #2002: No such file or directory.

The database server is not running. In a Debian based distro this can be done with:

sudo service mysql start

Errors "MySQL server has gone away" and "Packets out of order"

There are a few reasons you could be getting these errors, but the most likely is the version of database server you are running is not compatible with the version of PHP.

This is most commonly found when you are running the latest version of MySQL as PHP and it do not get on well. Best advice, ditch MySQL and install MariaDB as this is not something we can support.

For more information, see:

https://www.ryadel.com/en/fix-mysql-server-gone-away-packets-order-similar-mysql-related-errors/

Command Injection won't work

Apache may not have high enough privileges to run commands on the web server. If you are running DVWA under Linux make sure you are logged in as root. Under Windows log in as Administrator.

Why can't the database connect on CentOS?

You may be running into problems with SELinux. Either disable SELinux or run this command to allow the web server to talk to the database:

setsebool -P httpd_can_network_connect_db 1

Anything Else

For the latest troubleshooting information please read both open and closed tickets in the git repo:

https://github.com/digininja/DVWA/issues

Before submitting a ticket, please make sure you are running the latest version of the code from the repo. This is not the latest release, this is the latest code from the master branch.

If raising a ticket, please submit at least the following information:

  • Operating System
  • The last 5 lines from the web server error log directly after whatever error you are reporting occurs
  • If it is a database authentication problem, go through the steps above and screenshot each step. Submit these along with a screenshot of the section of the config file showing the database user and password.
  • A full description of what is going wrong, what you expect to happen, and what you have tried to do to fix it. "login broken" is no enough for us to understand your problem and to help fix it.

Tutorials

I am going to try to put together some tutorial videos that walk through some of the vulnerabilities and show how to detect them and then how to exploit them. Here are the ones I've made so far:

Finding and Exploiting Reflected XSS


SQLite3 SQL Injection

Support for this is limited, before raising issues, please ensure you are prepared to work on debugging, do not simply claim "it does not work".

By default, SQLi and Blind SQLi are done against the MariaDB/MySQL server used by the site but it is possible to switch to do the SQLi testing against SQLite3 instead.

I am not going to cover how to get SQLite3 working with PHP, but it should be a simple case of installing the php-sqlite3 package and making sure it is enabled.

To make the switch, simply edit the config file and add or edit these lines:

$_DVWA["SQLI_DB"] = "sqlite";
$_DVWA["SQLITE_DB"] = "sqli.db";

By default it uses the file database/sqli.db, if you mess it up, simply copy database/sqli.db.dist over the top.

The challenges are exactly the same as for MySQL, they just run against SQLite3 instead.


👨‍💻 Contributors

Thanks for all your contributions and keeping this project updated. ❤️

If you have an idea, some kind of improvement or just simply want to collaborate, you are welcome to contribute and participate in the Project, feel free to send your PR.


Reporting Vulnerabilities

To put it simply, please don't!

Once a year or so, someone will submit a report for a vulnerability they've found in the app, some are well written, sometimes better than I've seen in paid pen test reports, some are just "you are missing headers, pay me".

In 2023, this elevated to a whole new level when someone decided to request a CVE for one of the vulnerabities, they were given CVE-2023-39848. Much hilarity ensued and time was wasted getting this corrected.

The app has vulnerabilities, it is deliberate. Most are the well documented ones that you work through as lessons, others are "hidden" ones, ones to find on your own. If you really want to show off your skills at finding the hidden extras, write a blog post or create a video as there are probably people out there who would be interested in learning about them and about how your found them. If you send us the link, we may even include it in the references.

Links

Project Home: https://github.com/digininja/DVWA

Created by the DVWA team

dvwa's People

Contributors

adb014 avatar alisezisli avatar aref2008 avatar basbodart avatar digininja avatar enomothem avatar erwanlr avatar ethicalhack3r avatar exhibitioner avatar fakoor avatar g0tmi1k avatar galoget avatar hanoncs avatar hoang-himself avatar iamcarron avatar icedingo avatar invains avatar its-ashu-otf avatar kshjessica avatar lijantropique avatar mike-bailey avatar ranemirusg avatar schweinepriester avatar sgerlach avatar sl33pingmathrapt0r avatar songzy12 avatar spinkham avatar ssontakke avatar sukalaper avatar wgonczaronek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dvwa's Issues

Only loading http://localhost/dvwa/setup.php - but no login.php.

I am using XAMPP web server, and it is working well. Only, I do not know why "localhost" is loading the setup.php and not the login.php. When I remove "setup.php" from the URL and replace it with "login.php", the URL is flipping back to "setup.php".
So, I tried already to reinstall DVWA - XAMPP - MySql -PHP5, etc, but always the same problem occurs.
What can I do to change in a good direction?
Anyone can help?
Thanks !

Unintended Directory Traversal

There are several points in the application where directory traversal is possible.
For example /vulnerabilities/view_source.php?id=csrf&security=../../../config/config.inc will reveal the configuration of the application.

These vulnerabilities are found in:
vulnerabilities/view_help.php (14)
vulnerabilities/view_source_all.php (12, 16, 20)
vulnerabilities/view_source.php (56)
the parameters id and security are not sufficiently validated.

Probably this was not an intended vulnerability.

Login.php is blank

I have setup everything as instructed. I can see the /setup.php /instructions.php and /about.php pages but when I click on the create database button, I just get a blank screen.
The url it goes to after clicking create database is - http://localhost/dvwa/setup.php#

Nothing else happens, it doesnt take me to the login or anything. Any help would be great.

Getting error
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\dvwa\dvwa\includes\dvwaPage.inc.php:461 Stack trace: #0 C:\xampp\htdocs\dvwa\login.php(8): dvwaDatabaseConnect() #1 {main} thrown in C:\xampp\htdocs\dvwa\dvwa\includes\dvwaPage.inc.php on line 461

Unable to connect to the database. mysql_error()

"Unable to connect to the database.
mysql_error()
Click here to setup the database. "

I upload the web and that is all what it says when i open it.
If i click "here", it takes me to this:

"Click on the 'Create / Reset Database' button below to create or reset your database. If you get an error make sure you have the correct user credentials in /config/config.inc.php

If the database already exists, it will be cleared and the data will be reset.

Backend Database: MySQL "
and if i hit on the 'Create / Reset Database' it tells: Could not connect to the database - please check the config file.

I dont know what to do, im so newbie. Please help

Could not connect to the database

Hi,I followed all instructions and I have read all fixes and I modified the config file hundred times but I still can't connect to the database.
screenshot from 2015-09-07 10 56 34
screenshot from 2015-09-07 10 58 26

LIVE CD

How to use live CD? Can I use it through USB Flash drive? Does it work if simply copy and paste the contents of the iso file? Does it work in windows?

login.php blank

I've tried to install dvwa on kali linux, ubuntu and windows but for some reason i cant get it to work.
Everything's fine and the installation goes smoothly, but when im about to connect to 127.0.0.1/dvwa/setup.php i get a blank page, its the same at login.php.

I dont understand what the matter is, i've seen other people with the same problem recently but without some solution.

I would appreciate some help on this matter.

Database

i cant generate the database, every time i click the button i get the message "Could not connect to the database - please check the config file."

Security Setting issue

I'm using DVWA 1.0.7 and I'm experiencing a strange issue. The security
settings for XSS Stored page are always set to "High" no matter what I do.
I've tried changing them to low and it works for every other page but that
one.

I've restarted Apache and MySQL with no luck. I'm on Mountain Lion 10.9.2
using XAMMP 1.8.3-3.

Login PostgreSQL support

I want to know why in the file login.php there isn't any conditional statement to use PostgreSQL as the database instead of MySQL, I can only see the PHP function mysql_query() but not pg_query() when the application is trying to register the login action.

$ tree dvwa/includes/DBMS/
dvwa/includes/DBMS/
├── DBMS.php
├── MySQL.php
└── PGSQL.php
0 directories, 3 files

dvwaExternalLinkUrlGet() does not register

Fatal error: Call to undefined function dvwaExternalLinkUrlGet() in C:\xampp\htdocs\dvwa\vulnerabilities[Insert Vuln Here]\help\help.php on line 33

It does this for all php files that use this function >:(

create a backup config file

I've just scanned DVWA with Wfuzz and it found the /config directory and as directory indexing is enabled I can see the config.inf.php file but obviously can't read the contents as it is parsed by php.

It would be nice to have a "backup" of the file with .bak or .old in there that could be discovered as another vulnerability.

ngix/php-fpm and dvwa

Hi,
I am unable to login with the default username admin and password password. it keeps redirecting me to the login page. I used the setup page to create dvwa database and it was successful as i could see tables in the dvwa database. I also change all the permission to 777 to ensure it is not a permission issue

Not sure what else i can try, can someone please assist?

Redirect to Setup.php

It would be great a redirection to the file setup.php if the installation process was not started. I have this little piece of code checking in the information schema database if the table users exists in the database specified in the configuration file.

Only works with MySQL database.

$ diff login.php login.php.fork 
22a23,31
>   $users_exists_q = @mysql_query("SELECT table_schema, table_name, create_time
>       FROM information_schema.tables
>       WHERE table_schema='{$_DVWA['db_database']}' AND table_name='users'
>       LIMIT 1");
>   if( !mysql_fetch_assoc($users_exists_q) ){
>       header('Location: setup.php');
>       exit;
>   }
>

Catcha - low.php / medium.php

In low.php (line 7 and 8) and medium.php (line 6 and 7) for the captcha vulnerability, it gets the new password and confirmation of password and assigns these values to variables.

But this only happens for step 1.
In step 2, these two variables $pass_new and $pass_conf are always blank when it is written to the database.

Cannot connect to database

Could not connect to the database.
Please check the config file.

This is error message I am receiving from DVWA. I am using XAMMP v 5.6.19-0. I have the password in the config file set to '', using root as username. I have looked for a solution to the issue but I appear to be on my own on this one. I am running OSX 10.11.3 Not sure what else to tell you Thanks for any help,
Charles

add delete guestbook message

It would be good to be able to delete entries from the stored xss guestbook without having to go to the database. A button on each entry to remove it would be useful.

IMO what you call "SQL Injection (Blind)" is not Blind SQL Injection

I might be wrong here, but I think that the "SQL Injection (Blind)" section in dvwa is just a regular SQL Injection vulnerability.

According to DVWA what makes a SQLi vulnerability to be blind is not showing SQL error messages to the user.

Showing the SQL error messages to the user is just: a SQL injection vuln + a misconfiguration issue.

A blind SQL injection might occur when the columns of the results returned by a query are not shown to the user. However, the user can tell somehow if the query returned any records or none.
E.g.: Suppose the url "http://www.example.com/user?id=USER_ID" returns:

  • 200 if USER_ID exists
  • 404 if USER_ID not exists

But it won't show any information from the query results (e.g. username, address, phone, etc)

If the page is vulnerable to SQLi, an attacker won't be able get info from the DB printed in the result page, but he might be able to infer it by asking yes/no questions.

E.g. if user id 1 exits:

  • ?id=1 and 1=1: will return 200
  • ?id=1 and 1=2: will return 404

of course the attacker doesn't need to ask the DB if 1=1 or 1=2 (he can ask a calculator that), but he might ask more interesting yes/no questions like:

  • is the length of the admin's password greater than 5?
  • is the length of the admin's password equal to 10?
  • is the first char of the admin's password greater than 'm'
  • is the first char of the admin's password equal to 'r'
  • is the second char of the ...

I suggest you add a real blind sql injection section in DVWA. While displaying or not SQL errors can be just a difference between the security=low and security=medium levels of the regular SQL Injection section.

More info:
https://www.owasp.org/index.php/Blind_SQL_Injection
http://en.wikipedia.org/wiki/SQL_injection#Blind_SQL_injection

Server not found

Hi,

I have tried to set up DVWA on Kali Linux 2, mysql and apache2 are both running but the webpage states that 'Sever not found'. Any ideas?

Thanks,
Shane

Apache Not Con..

Apache Server not Connecting, MYSQL works, error says
8:30:50 AM [Apache] Status change detected: stopped
8:30:50 AM [Apache] Error: Apache shutdown unexpectedly.
8:30:50 AM [Apache] This may be due to a blocked port, missing dependencies,
8:30:50 AM [Apache] improper privileges, a crash, or a shutdown by another method.
8:30:50 AM [Apache] Press the Logs button to view error logs and check
8:30:50 AM [Apache] the Windows Event Viewer for more clues
8:30:50 AM [Apache] If you need more help, copy and post this
8:30:50 AM [Apache] entire log window on the forums

Please help!!

Padding oracle attack

What about adding a padding oracle vulnerability ?
I'd be willing to write it if you think it would bring value.

Command Injection (HIGH)

Bonjour Misure, just noticed something odd. I was able to bypass the filtering on command injection with security token set to HIGH using a simple '|'. Took a look at the source and it seems you have a stray white space in the pipe filter (see below).

if( isset( $_POST[ 'Submit' ] ) ) {
// Get input
$target = trim($_REQUEST[ 'ip' ]);

// Set blacklist
$substitutions = array(
    '&'  => '',
    ';'  => '',
    '| ' => '',
    '-'  => '',
    '$'  => '',
    '('  => '',
    ')'  => '',
    '`'  => '',
    '||' => '', 

status in red

hi I have a setup problem and I dont understand this problem "status in red " please help
i use xampp server 3.2.2

screenshot - 12_2_2015 2_17_23 am

session_token.

I don‘t know why that my user_taken and session_token always unequal...So I can't create my dbs

when I change the code "$_SESSION[ 'session_token' ] = md5( uniqid() )" to "$_SESSION[ 'session_token' ] = md5('a')", this worked。

I guess this porblem is “uniqid()”.

Table 'dvwa.users' does'nt exist.

I am using DVWA 1.0.8 and 1.0.7 respectively but doing all my effort and follows all the recommendation i got and error message after typing Username and Password that is Table 'dvwa.users' does'nt exist. Please help me if anybody solved it earlier. Or send me any file or description at: [email protected]

Fatal error: Uncaught Error:

*Getting Error after clicking on Create and reset database button
*

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\DVWA\dvwa\includes\DBMS\MySQL.php:9 Stack trace: #0 C:\xampp\htdocs\DVWA\setup.php(17): include_once() #1 {main} thrown in C:\xampp\htdocs\DVWA\dvwa\includes\DBMS\MySQL.php on line 9

Could any 1 can help to reslove this issues

Detail
Setup Check
Operating system: Windows
Backend database: MySQL
PHP version: 7.0.4

Web Server SERVER_NAME: 127.0.0.1

PHP function display_errors: Enabled (Easy Mode!)
PHP function safe_mode: Disabled
PHP function allow_url_include: Enabled
PHP function allow_url_fopen: Enabled
PHP function magic_quotes_gpc: Disabled
PHP module php-gd: Installed

reCAPTCHA key: --------

Writable folder C:\xampp\htdocs\DVWA/hackable/uploads/: Yes)
Writable file C:\xampp\htdocs\DVWA/external/phpids/0.6/lib/IDS/tmp/phpids_log.txt: Yes

Status in red, indicate there will be an issue when trying to complete some modules.

(127.0.0.1/) localhost/dvwa/login.php BLANK

To all who can help.

I've seen this issue has been posted before however, there has not been any resolution. I installed DVWA on XAMPP but, when I try to go to localhost/dvwa in the browser it sends me to the localhost/dvwa/login.php web page which is blank. I've manually typed localhost/dvwa/setup.php in the browser and that page comes up fine. So does, instructions.php and about.php. Can anybody help me with this issue.

More info:

Setup Check is showing the following information. Should some of the processes that are coming up as disabled be enabled. If so, how can I resolve this issue?

Operating system: Windows
Backend database: MySQL
PHP version: 5.6.19

Web Server Server_Name: localhost

PHP function display_error: Enabled (Easy Mode!)
PHP function safe_mode: Disabled
PHP function allow_url_include: Disabled
PHP function allow_url_fopen: Enabled
PHP function magic_quotes_gpc: Disabled
PHP module php-gd: Instaled

reCAPTCHA key: Missing

Writable folder C:\xampp\htdocs\dvwa/hackable/uploads/: Yes)
Writable file C:\xampp\htdocs\dvwa/external/phpids/0.6/lib/IDS/tmp/phpids_log.txt: Yes

DVWA was installed on a system running Windows 8

Medium setting sql injection won't work

I tried the given solution and numerous solutions available as well as my own.
None of them would give any output or results. Please confirm so this issue can be solved

File upload problem corrected, is there any other solution

Hi,
Even after giving priviledges to upload folder, we were not able to upload any image file or php file. Then we modified the code and everything started to work fine. Is there any other solution to this? If you are facing similar issue in upload. Just copy and past our code into your low.php file in this directory
/var/www/dvwa/vulnerabilities/upload/source and everything will work fine.
You might need to modify the $target_path according to your OS

'; $html .= 'Your image was not uploaded.'; $html .= ''; echo $target_path." - "; echo $_FILES['uploaded']['tmp_name']." - "; echo $_FILES['uploaded']['name']." - "; } else { $html .= '
';
            $html .= ' succesfully uploaded!';
            $html .= '
'; } } ``` ?>

The high.php implementation for Brute-Force is still vulnerable to brute force; medium and low.php actually show an SQL injection, no brute force

In order to prevent brute force, the high.php introduces sleep(3);. However, using parallel threads it is still possible to brute force this implementation. As the low.php is showing an sql injection instead of a brute force I would recommend the following:
implement something like this in low.php (pseudocode):

$user = mysql_real_escape_string( $_GET['user'] );
if (!mysql_query ("`users` contains $user")) {
    echo "Username does not exist!";
} else {
    $password = $_GET['password'];
    /* do password stretching */
    for($i=0;$i<1024;$i++){
        $password = sha512sum($password);
    }
    $stored_password = mysql_query ("SELECT password FROM `users` WHERE user = '$user'");
    if ($stored_password != $password) {
        echo "Password incorrect!";
    }
}

I would propose the following for medium.php

$user = mysql_real_escape_string( $_GET['user'] );
if (!mysql_query ("`users` contains $user")) {
    echo "Username or Password incorrect!";
} else {
    $password = $_GET['password'];
    /* do password stretching */
    for($i=0;$i<1024;$i++){
        $password = sha512sum($password);
    }
    $stored_password = mysql_query ("SELECT password FROM `users` WHERE user = '$user'");
    if ($stored_password != $password) {
        echo "Username or Password incorrect!";
    }
}

And the following for high.php

/* This solution has the drawback, that an attacker may:
 *   1. Lock known accounts for 1 Minute (problematic if login
 *      function is availability-critical, e.g., online-auctions)
 *   2. Flood the bruteforceusers database with dummy-entries 
 *      (may be flushed with a cronjob)
 * For a longer discussion you might want to read:
 *   https://www.owasp.org/index.php/Blocking_Brute_Force_Attacks
 */
$user = mysql_real_escape_string( $_GET['user'] );
$account_lock_time = mysql_query("SELECT account_lock_time FROM `bruteforceusers` WHERE user = '$user'");
if ($account_lock_time < current_time() - 60) {
    $password = $_GET['password'];
    /* do password stretching */
    for($i=0;$i<1024;$i++){
        $password = sha512sum($password);
    }
    $stored_password = mysql_query ("SELECT password FROM `users` WHERE user = '$user'");
    $wrong_attempts = mysql_query("SELECT wrong_attempts FROM `bruteforceusers` WHERE user = '$user'");
    if (!mysql_query ("`users` contains $user") || $stored_password != $password) {
        echo "Username or Password incorrect!";
        $wrong_attemts++;
        mysql_query("UPDATE `bruteforceusers` SET wrong_attemts = $wrong_attemts WHERE user = '$user'");
        if ($wrong_attemts > 5) {
            mysql_query("UPDATE `users` SET account_lock_time = " . current_time() . " WHERE user = '$user'");
            echo "This account has been locked for 1 Minute!";
        }
    } else {
        echo "There were $wrong_attemts wrong password attempts since your last login";
        mysql_query("UPDATE `bruteforceusers` SET wrong_attemts = 0 WHERE user = '$user'");
    }
} else {
    echo "This account has been locked for 1 Minute!";
}

Upload file vulnerability won't work (Low security, PHPIDS disabled).

Upload file vulnerability won't work (Low security, PHPIDS disabled).
Iv'e tried everything, I've been on this for 3 days now, 16 hours a day.
I reinstalled localhost machine (running CentoOS) multiple times (tried 7 and 6), tried multiple php and mysql version, tried change all server files permissions to chmod 777, tried just /var/www chmod 777, tried disabling SELinux, tried disabling IPtables, nothing, absolutely nothing works!
doesn't matter if everything is running as root or not, it just won't work.I've also tried multiple web admin panels and multiple apache configs, nothing.
I've seen this issue posted here before, but fix wasn't explained.
Also, there is absolutely nothing in the logs! (Both error and access logs).
Help please! Thanks.

Instructions with Markdown files

Typographic error.
After the conversion of the files Readme.txt and Changelog.txt from the Subversion repository to the Git repository, you missed a change in the file instructions.php where are specified the path to load the files README.md and CHANGELOG.md.

$ diff instructions.php instructions.php.fork
13,14c13,14
<   'readme' => array( 'legend' => 'Read Me', 'file' => 'README.txt' ),
<   'changelog' => array( 'legend' => 'Change Log', 'file' => 'CHANGELOG.txt' ),

---
>   'readme' => array( 'legend' => 'Read Me', 'file' => 'README.md' ),
>   'changelog' => array( 'legend' => 'Change Log', 'file' => 'CHANGELOG.md' ),

MySQL PHP library deprecated

I've been trying to install DVWA in a Debian 8 server and it looks that it wont connect to the database no matter what.

After some digging I foundthat you are using the "mysql" driver instead of "mysqli". The "mysql" driver is deprecated so it wont work on any modern GNU/linux distribution. (http://php.net/manual/en/function.mysql-connect.php)

Would it be possible to update to "mysqli" so this suite can be used with PHP >= 5.5 ?

Thanks!

Making a better, safer, DVWA pull request

Hey,

I have talked with @ethicalhack3r and made changes to DVWA. fixing major unintended holes and some others that explained in http://www.paulosyibelo.com/2014/09/dvwa-unintended-security-issues.html

Other than that, fixed the Rosetta Flash attack for the high level, added some extra protection layers as a "high" level, and modified the graphics a lot.

I personally don't know how to use github to pull a request (embarrassed); neither do I have time. contacted ryan and he told me the same thing so, we were hoping some from here can do that for me and pull the newest, cooler, DVWA.

Here: can you try https://www.dropbox.com/s/s0t8rjm4vhlkllu/dvwa-final.zip?dl=0

Thanks,

Disable login page

Hi everyone !

First of all, thanks for creating this great learning tool :) I've been playing with it for some time and had good time.

I'd like to use DVWA to learn some tools too. I'm able to access DVWA (which is installed on VM machine) externally, that is from other VM machines and for manual learning it works fine. However when I try to use for example some SQLi tools (jsql for example) and I'm targeting SQLI module I get response that it's not possible although security is set to low. I'm guessing the problem may be first login page - correct me if I'm wrong.

Is there a way to disable logging in requirement to make all labs "public" ?

Thanks in advance :)

Status

I can't troubleshoot this issue. I have a status PHP function allow_url_include: Disabled but my php.ini file is set to :on

Any ideas?
setup
ini

reCAPTCHA key problem with DVWA

Hi, I have a issue with CAPTCHA key, even after copying the right & inserting it to public & server it still says could not Could not connect to the MySQL service. Please check the config file. & how to fix
Writable file /var/www/html/DVWA/external/phpids/0.6/lib/IDS/tmp/phpids_log.txt: No
kindly suggest me a fix.

capture

capture1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.