File: README.md
DAMN VULNERABLE WEB APPLICATION
Damn Vulnerable Web Application (DVWA) is a PHP/MariaDB 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:
- Arabic: العربية
- Chinese: 简体中文
- French: Français
- Korean: 한국어
- Persian: فارسی
- Polish: Polski
- Portuguese: Português
- Spanish: Español
- Turkish: Türkçe
- Indonesia: Indonesia
- Vietnamese: Vietnamese
- Italian: Italiano
- Ukrainian: Українська
- Russian: Русский
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.gitOr download a ZIP of the files.
Installation
Automated Installation 🛠️
Note, this is not an official DVWA script, it was written by @IamCarron and is maintained at DVWA-Script. 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 the DVWA-Script repository, not here.
An automated installation script for DVWA on Debian-based machines, including Kali, Ubuntu, Kubuntu, Linux Mint, Zorin OS... It automatically installs dependencies, configures PHP/Apache, and initializes the database tables ready for login (admin / password).
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
Download the script:
shwget https://raw.githubusercontent.com/IamCarron/DVWA-Script/main/Install-DVWA.shMake the script executable:
shchmod +x Install-DVWA.shRun the script as root:
shsudo ./Install-DVWA.sh
Installation Videos
- Installing DVWA on Kali running in VirtualBox
- Installing DVWA on Windows using XAMPP
- Installing Damn Vulnerable Web Application (DVWA) on Windows 10
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:
Run
docker versionanddocker compose versionto see if you have Docker and Docker Compose properly installed. You should be able to see their versions in the output.For example:
text>>> 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.3If you don't see anything or get a command not found error, follow the prerequisites to setup Docker and Docker Compose.
Clone or download this repository and extract (see Download).
Open a terminal of your choice and change its working directory into this folder (
DVWA).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.
Serve local files
If your making local changes and don't want to build the project for every change :
- Go to
compose.ymland uncomment :text# volumes: # - ./:/var/www/html - Run
cp config/config.inc.php.dist config/config.inc.phpto copy the default config file. - Run
docker compose up -dand changes to local files will reflect on the container.
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-phpThe 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.
Apache Modules
If you want to use the API lab you must have the Apache module mod_rewrite enabled. To do this in Linux run:
a2enmod rewriteAnd then restart Apache with:
apachectl restartVendor Files
If you want to use the API module you will need to install a set of vendor files using Composer.
First, make sure you have Composer installed. There seem to be backward compatibility issues so I always get the latest version from here:
https://getcomposer.org/doc/00-intro.md
Follow the instructions the site gives to get it installed.
Now go into the vulnerabilities/api directory and run:
composer.phar installIf you did not install Composer to the system path, make sure you reference its full location.
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
Config with environment variables
Instead of modifying the configuration file, you can also set most settings using environment variables. In a Docker or Kubernetes deployment, this allows you to modify the configuration without creating a new Docker image. You'll find the variables in the config/config.inc.php.dist file.
If you want to set the default security level to "low", simply add the following line to the compose.yml file:
environment:
- DB_SERVER=db
- DEFAULT_SECURITY_LEVEL=lowDatabase 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:
MariaDB [(none)]> create database dvwa;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create user dvwa@localhost identified by 'p@ssw0rd';
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> grant all on dvwa.* to dvwa@localhost;
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> 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.
To allow Remote File Inclusions (RFI):
allow_url_include = on[allow_url_include]allow_url_fopen = on[allow_url_fopen]
To make sure PHP shows all error messages:
display_errors = on[display_errors]display_startup_errors = on[display_startup_errors]
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.
If you'd rather watch a video than read words, the most common issues are covered in the video Fixing DVWA Setup Issues.
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.
Logs can also be accessed from the terminal.
Open a terminal and change its working directory to DVWA
Show the merged logs
shdocker compose logsIn case you want to export the logs to a file, e.g.
dvwa.logshdocker 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:80to
ports:
- 127.0.0.1:8806:80DVWA 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.logI browsed to the site and got a 404 or Apache2 default page
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.txthttp://localhost/mydir/Hello.txthttp://localhost/MYDIR/hello.txt
How does this affect DVWA? Most people use git to clone 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.
I browsed to the site and got a blank screen
This is usually one configuration issue hiding another issue. By default, PHP does not display errors, and so if you forgot to turn error display on during the setup process, any other problems, such as failure to connect to the database, will stop the app from loading but the message to tell you what is wrong will be hidden.
To fix this, make sure you set display_errors and display_startup_errors as covered in PHP Configuration and then restart Apache.
"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. Video Help
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. Video Help
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 dvwaNote: 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 startConnection 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:535Means 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.serviceAnd 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 agoIf it is not running, you can start it with:
sudo systemctl stop mariadb.serviceNote 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:
As root, edit the following file:
/etc/mysql/mysql.conf.d/mysqld.cnfUnder the line
[mysqld], add the following:
default-authentication-plugin=mysql_native_passwordRestart the database:
sudo service mysql restartCheck the authentication method for your database user:
sqlmysql> 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)You'll likely see
caching_sha2_password. If you do, run the following command:sqlmysql> ALTER USER dvwa@localhost IDENTIFIED WITH mysql_native_password BY 'p@ssw0rd';Re-running the check, you should now see
mysql_native_password.sqlmysql> 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 startErrors "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/
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 1MariaDB Docker does not start
If you see the following error in the Docker logs while trying to start MariaDB, it is likely due to the host machine not having enough memory. If you are using this in a hosted environment, the best solution is to step up a machine size to get more memory and to try again.
[Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.11.15+maria~ubu2204 started.
[Warn] [Entrypoint]: /sys/fs/cgroup///memory.pressure not writable, functionality unavailable to MariaDBYou might also need to add the following line to the volumes section of your compose.yml file:
- /sys/fs/cgroup/memory.pressure:/sys/fs/cgroup/memory.pressureDoing that would change the volumes section of a default config file to the following:
volumes:
- dvwa:/var/lib/mysql
- /sys/fs/cgroup/memory.pressure:/sys/fs/cgroup/memory.pressureFor more information on why this works, see this issue.
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 MariaDB, they just run against SQLite3 instead.
👨💻 Contributors
Thanks for all your contributions and keeping this project updated. :heart:
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
File: vulnerabilities/bac/README.md
Broken Access Control Module - DVWA
This module demonstrates OWASP Top 10 2021's #1 vulnerability: Broken Access Control (BAC). It provides a practical learning environment showing how access control vulnerabilities can be exploited and properly mitigated.
Module Overview
The module simulates a user profile viewing system with progressive security levels:
Security Levels
1. Low Security
- Basic input validation for user ID format
- No access control checks
- Direct SQL queries without sanitization
- Vulnerable to SQL injection and unauthorized access
2. Medium Security
- Input validation for user ID format
- Basic cookie-based authentication
- Integer type casting for basic SQL injection protection
- Vulnerable to cookie manipulation
3. High Security
- Strict input validation
- Role-based access control (RBAC)
- Prepared statements for SQL injection prevention
- Output encoding to prevent XSS
- Basic security logging
- Still vulnerable to certain timing attacks
4. Impossible Security
- Comprehensive security implementation:
- Multi-layer input validation
- Rate limiting
- Proper RBAC implementation
- Prepared statements
- Comprehensive logging
- Security monitoring
- Suspicious activity detection
Common Security Features
Input Validation
- All levels validate user ID format using regex:
/^\d+$/ - Clear error messages for invalid input
- Additional validation layers in higher security levels
- All levels validate user ID format using regex:
Access Control
- Progressive implementation from none to comprehensive RBAC
- Session validation
- Role-based permissions
Database Security
- Progression from raw queries to prepared statements
- User role management
- Audit logging capabilities
Database Schema
-- Users table modifications
ALTER TABLE users ADD COLUMN role VARCHAR(20) DEFAULT 'user';
ALTER TABLE users ADD COLUMN account_enabled TINYINT(1) DEFAULT 1;
-- Access logging
CREATE TABLE access_log (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
target_id INT NOT NULL,
action VARCHAR(50) NOT NULL,
timestamp DATETIME NOT NULL
);
-- Security monitoring
CREATE TABLE security_log (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
action VARCHAR(50) NOT NULL,
target_id VARCHAR(50),
timestamp DATETIME NOT NULL,
ip_address VARCHAR(45)
);Security Testing Guide
Input Validation Testing
- Try non-numeric user IDs
- Attempt SQL injection
- Test with special characters
Access Control Testing
- Attempt to view other users' profiles
- Test admin role functionality
- Try cookie manipulation
Rate Limiting Testing
- Make multiple rapid requests
- Test blocking mechanism
- Verify logging of attempts
References
File: vulnerabilities/api/README.md
API Info
Generating OpenAPI Docs
If you want to be able to modify the code and generate your own OpenAPI document you will need to set a few things up.
First, make sure you have Composer installed. There seem to be backward compatibility issues so I always get the latest version from here:
https://getcomposer.org/doc/00-intro.md
Follow the instructions the site gives to get it installed.
Now go into /vulnerabilities/api directory and run:
composer.phar installIf you did not install Composer to the system path, make sure you reference its full location.
With this installed, you should now be able to browse to /vulnerabilities/api/gen_openapi.php and download a dynamically generated OpenAPI file
Mark Up
The OpenAPI document is generated using swagger-php.
The file is marked up using the newer PHP attributes method, for more information on that, see their documentation.
File: README.ar.md
DAMN VULNERABLE WEB APPLICATION
إن Damn Vulnerable Web Application (DVWA) هو تطبيق ويب تم إضعافه عمداً ومصمم بـ PHP / MySQL. الهدف الرئيسي هو مساعدة مختصي أمن المعلومات وذلك باختبار مهاراتهم وأدواتهم في بيئة تشبه البيئة الحقيقية، ومساعدة مطوري الويب على فهم طرق تأمين تطبيقات الويب بشكل أفضل ومساعدة كل من الطلاب والمدرسين في التعرف على أمان تطبيقات الويب في بيئة محكمة.
الهدف من DVWA هو التدرب على بعض نقاط الضعف على الويب الأكثر شيوعًا ، ضمن مستويات مختلفة من الصعوبة ، بواجهة بسيطة ومباشرة.
يرجى ملاحظة أن هناك ثغرات موثقة وغير موثقة في هذا التطبيق ,هو إجراء متعمد. نحن نشجع على محاولة اكتشاف أكبر عدد ممكن من المشكلات.
تحذير!
إن Damn Vulnerable Web Application (DVWA) ضعيف للغاية أمنياً! لا تضعه في مجلد html العام في الاستضافة الخاصة بك أو الخوادم التي تعمل على الانترنت ، إذ أنه سيتم اختراقها. يُوصى باستخدام كيان افتراضي (مثل [VirtualBox] (https://www.virtualbox.org/) أو [VMware] (https://www.vmware.com/)) ، ويتم تعيينه على وضع شبكة NAT، يمكنك تنزيل وتثبيت [XAMPP] (https://www.apachefriends.org/) لخادم الويب وقاعدة البيانات.
إخلاء مسؤولية
نحن لا نتحمل مسؤولية الطريقة التي يستخدم بها أي شخص هذا التطبيق (DVWA). إذ أننا أوضحنا أغراض التطبيق ولا ينبغي استخدامه بشكل ضار. لقد أصدرنا تحذيرات واتخذنا تدابير لمنع المستخدمين من تثبيت DVWA على خوادم الويب الحقيقية. إذا تم اختراق خادم الويب الخاص بك عن طريق تثبيت DVWA ، فهذه ليست مسؤوليتنا ، بل تقع على عاتق الشخص / الأشخاص الذين قاموا بتحميله وتثبيته.
ترخيص
هذا الملف جزء من Damn Vulnerable Web Application (DVWA).
يعد تطبيق Damn Vulnerable Web Application (DVWA) برنامجًا مجانيًا: يمكنك إعادة توزيعه و / أو تعديله
بموجب شروط GNU General Public License كما تم نشرها بواسطة
Free Software Foundation ، إما الإصدار 3 من الترخيص ، أو
(حسب اختيارك) أي إصدار لاحق.
يتم توزيع Damn Vulnerable Web Application (DVWA) لتحقيق الفائدة ،
ولكن دون أي ضمان ؛ حتى بدون الضمان الضمني لـ
القابلية للتسويق أو الملاءمة لغرض معين. يرجى الاطلاع على
ترخيص GNU General Public License لمزيد من التفاصيل.
يجب أن تكون قد تلقيت نسخة من ترخيص GNU General Public License
مع Damn Vulnerable Web Application (DVWA)، إذا لم تتلقى هذه الرخصة، يرجى الاطلاع على https://www.gnu.org/licenses/.
الترجمة
هذا الملف متوفر بعدة لغات:
إذا كنت ترغب في المساهمة في ترجمة ، يرجى تقديم PR . ولا يعني ذلك مجرد استخدام خدمة الترجمة من Google وإرسال المساهمة ، إذ أنه سيتم رفضها.
التحميل
توجد إصدارات مختلفة من DVWA حولها ، والإصدار الوحيد المدعوم هو أحدث مصدر من مستودع GitHub الرسمي. يمكنك إما سحب نسخة clone من الريبو Repo:
git clone https://github.com/digininja/DVWA.gitالتثبيت
التثبيت التلقائي 🛠️
ملاحظة: هذا ليس برنامجًا نصيًا رسميًا لـ DVWA، بل تمت كتابته بواسطة @IamCarron وتتم صيانته في DVWA-Script. تم بذل الكثير من الجهد في إنشائه ومراجعته، ومع ذلك يوصى بمراجعة النص البرمجي قبل تشغيله على نظامك. يرجى الإبلاغ عن أي أخطاء في مستودع DVWA-Script وليس هنا.
برنامج نصي للتثبيت التلقائي لـ DVWA على الأنظمة المعتمدة على Debian (بما في ذلك Kali وUbuntu وKubuntu وLinux Mint وZorin OS...). يقوم تلقائيًا بتثبيت جميع التبعيات المطلوبة، وتهيئة PHP وخادم الويب، وتهيئة جداول قاعدة البيانات لتكون جاهزة لتسجيل الدخول مباشرة (admin / password).
ملاحظة: يتطلب هذا البرنامج النصي صلاحيات root وهو مخصص للأنظمة المستندة إلى Debian. تأكد من تشغيله كمستخدم root.
خطوات التثبيت
أمر السطر الواحد (One-Liner)
يقوم هذا الأمر بتنزيل وتشغيل برنامج التثبيت النصي تلقائيًا:
sudo bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/IamCarron/DVWA-Script/main/Install-DVWA.sh)"تشغيل البرنامج النصي يدويًا
تنزيل البرنامج النصي:
shwget https://raw.githubusercontent.com/IamCarron/DVWA-Script/main/Install-DVWA.shمنح صلاحيات التنفيذ:
shchmod +x Install-DVWA.shالتشغيل بصلاحيات root:
shsudo ./Install-DVWA.sh
يرجى التأكد من وجود ملف config / config.inc.php الخاص بك. إن وجود ملف config.inc.php.dist بمفرده لن يكون كافيًا ويجب عليك تعديله ليلائم بيئتك وإعادة تسميته إلى config.inc.php ، قد يخفي Windows امتدادات الملفات، يجب عليك إظهارها لتعديل امتداد الملف.](https://www.howtogeek.com/205086/beginner-how-to-make-windows-show-file-extensions/)
فيديو التثبيت
تثبيت Windows + XAMPP
أسهل طريقة لتثبيت DVWA هي تحميل [XAMPP] وتثبيته (https://www.apachefriends.org/) إذا لم يكن لديك خادم الويب جاهز ومعد مسبقاً.
يعد XAMPP وسيلة سهلة لتثبيت Apache Distribution في أنظمة Linux و Solaris و Windows و Mac OS X. تتضمن الحزمة خادم الويب Apache و MySQL و PHP و Perl وخادم FTP و phpMyAdmin.
يمكن تحميل XAMPP من هنا:
https://www.apachefriends.org/
ببساطة قم بفك ضغط dvwa.zip ، ضع الملفات التي تم فك ضغطها في مجلد html العام ، ثم اطلب العنوان التالي من المتصفح: http://127.0.0.1/dvwa/setup.php
حزم Linux
إذا كنت تستخدم توزيعة Linux مبنية على Debian ، فستحتاج إلى تثبيت الحزم التالية _ (أو ما يكافئها) _:
apt-get -y install apache2 mariadb-server php php-mysqli php-gd libapache2-mod-php
سيعمل الموقع مع MySQL بدلاً من MariaDB لكننا نوصي بشدة باستخدام MariaDB لأنه يعمل خارج الصندوق، سيتعين عليك إجراء تغييرات لتمكين MySQL من العمل بشكل صحيح.
إعداد قاعدة البيانات
لإعداد قاعدة البيانات ، ما عليك سوى الضغط على الزر Setup DVWA في القائمة الرئيسية ، ثم االضغط على الزر Create / Reset Database. سيؤدي هذا إلى إنشاء / إعادة تعيين قاعدة البيانات وإضافة بعض البيانات.
إذا ظهر خطأ أثناء محاولة إنشاء قاعدة البيانات، فتأكد من صحة بيانات الدخول قاعدة البيانات (اسم المستخدم وكلمة المرور) في الملف /config/config.inc.php وهذا الملف يختلف عن config.inc.php.dist والذي يعتبر مثال.
تم ضبط قيم المتحولات التالية افتراضياً وفق ما يلي:
$_DVWA[ 'db_server'] = '127.0.0.1';
$_DVWA[ 'db_port'] = '3306';
$_DVWA[ 'db_user' ] = 'dvwa';
$_DVWA[ 'db_password' ] = 'p@ssw0rd';
$_DVWA[ 'db_database' ] = 'dvwa';ملاحظة ، إذا كنت تستخدم MariaDB بدلاً من MySQL (يعد MariaDB افتراضيًا في Kali) ، فلا يمكنك استخدام root كمستخدم، يجب عليك إنشاء مستخدم قاعدة بيانات جديد. للقيام بذلك ، اتصل بقاعدة البيانات بصفتك المستخدم root، ونفذ الأوامر التالية:
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)تكوينات أخرى
اعتمادًا على نظام التشغيل الخاص بك وإصدار PHP ، قد ترغب في تغيير التكوين الافتراضي default configuration. سيكون موقع الملفات مختلفًا حسب كل جهاز.
سماحيات المجلد:
- المسار
/hackable/uploads/- يجب أن تستطيع خدمة الويب الكتابة على هذا الملف (لتنفيذ وظيفة تحميل الملف). - المسار
/external/phpids/0.6/lib/IDS/tmp/phpids_log.txt- يجب أن تستطيع خدمة الويب الكتابة على هذا الملف (إذا كنت ترغب باستخدام PHPIDS).
تكوين PHP:
- الخيار
allow_url_include = on- السماح بتضمين الملفات عن بعد Remote File Inclusions (RFI) [allow_url_include] - الخيار
allow_url_fopen = on- السماح بتضمين الملفات عن بعد Remote File Inclusions (RFI) [allow_url_fopen] - الخيار
safe_mode = off- (إذا كان إصدار PHP أقل من أو يساوي 5.4) السماح بحقن SQL - SQL Injection (SQLi) [safe_mode] - الخيار
magic_quotes_gpc = off- (إذا كان إصدار PHP أقل من أو يساوي 5.4) السماح بحقن SQL - SQL Injection (SQLi) [magic_quotes_gpc] - الخيار
display_errors = off- (اختياري) إخفاء رسائل تحذير PHP لجعلها أقل إسهابًا [display_errors]
الملف: config/config.inc.php:
- المتحولات
$_DVWA[ 'recaptcha_public_key' ]و$_DVWA[ 'recaptcha_private_key' ]يجب توليد قيم هذه المتحولات وذلك من خلال: https://www.google.com/recaptcha/admin/create
بيانات الدخول الافتراضية
اسم المستخدم الالافتراضي = admin
كلمة المرور الافتراضية = password
...يمكن بسهولة تخمينها باستخدام هجوم Brute Force ;)
رابط تسجيل الدخول : http://127.0.0.1/login.php
ملاحظة: سيختلف الرابط في حال تثبيت DVWA في مسار مختلف.
حاوية Docker
- يمكنك زيارة dockerhub صفحة
docker run --rm -it -p 80:80 vulnerables/web-dvwa
يرجى التأكد من أنك تستخدم aufs بسبب مشاكل MySQL السابقة. نفذ الأمر docker info للتحقق من storage driver. إذا لم يكن aufs ، يرجى تغييره على هذا النحو. هناك أدلة لكل نظام تشغيل حول كيفية القيام بذلك ، لكنها مختلفة تمامًا لذا لن نغطي ذلك هنا.
استكشاف الأخطاء وإصلاحها
يفترض هذا أنك تستخدم توزيعة قائمة على Debian ، كـ Debian و Ubuntu و Kali. بالنسبة إلى التوزيعات الأخرى ، اتبع ذلك ، ولكن قم بتعديل الأمر عند الضرورة.
الحصول على استجابة 404 عند تصفح الموقع
إذا كنت تواجه هذه المشكلة ، فأنت بحاجة إلى فهم مواقع الملفات. بشكل افتراضي ، جذر مستندات Apache (Apache document root هو المكان الذي يبدأ فيه البحث عن محتوى الويب) هو /var/www/html/ إذا وضعت الملف hello.txt في هذا المجلد، يمكن الوصول إليه بطلب http://localhost/hello.txt من المتصفح.
إذا أنشأت مجلد ووضعت الملف فيه - /var/www/html/mydir/hello.txt فيمكنك الوصول إلى الملف من الخلال المتصفح بزيارة http://localhost/mydir/hello.txt.
يعتبر Linux بشكل افتراضي حساسًا لحالة الأحرف ، وبالتالي في المثال أعلاه ، إذا حاولت التصفح للوصول إلى أي من الروابط التالية، فستحصل على 404 Not Found:
http://localhost/MyDir/hello.txthttp://localhost/mydir/Hello.txthttp://localhost/MYDIR/hello.txt
كيف يؤثر ذلك على DVWA؟ يستخدم معظم الأشخاص git للتحقق من DVWA في /var/www/html ، وهذا يمنحهم الدليل /var/www/html/DVWA/ متضمنة جميع ملفات DVWA بداخله. ثم يقومون بطلب الرابط http://localhost/من المتصفح ويحصلون على 404 أو الصفحة الافتراضية في Apache. نظرًا لأن الملفات موجودة في مجلد DVWA ، يجب طلب http://localhost/DVWA.
الخطأ الشائع الآخر هو طلب الرابط http://localhost/dvwa والذي سيعطي 404 لأن dvwa ليس DVWA بسبب حساسية الأحرف في Linux.
لذلك بعد الإعداد ، إذا حاولت زيارة الموقع والحصول على "404" ، ففكر في المكان الذي قمت بتثبيت الملفات فيه ، وأين ترتبط بالمسار الأساسي ، وما هو اسم المجلد الذي استخدمته.
مشكلة "Access denied"
إذا رأيت ما يلي عند تشغيل البرنامج النصي للإعداد setup script ، فهذا يعني أن اسم المستخدم أو كلمة المرور في ملف التكوين لا يتطابقان مع تلك التي تم تكوينها في قاعدة البيانات:
Database Error #1045: Access denied for user 'notdvwa'@'localhost' (using password: YES).يخبرك الخطأ أن اسم المستخدم هو notdvwa.
يشير الخطأ التالي إلى أنك وجهت ملف التكوين إلى قاعدة البيانات الخاطئة.
SQL: Access denied for user 'dvwa'@'localhost' to database 'notdvwa'رسالة الخطأ توضح أنك تستخدم المستخدم dvwa وتحاول الاتصال بقاعدة البيانات notdvwa.
أول ما يجب القيام به هو التحقق مرة أخرى مما تعتقد أنك قد وضعته في ملف التكوين صحيح ومطابق للبيانات الفعلية.
إذا كان يتطابق مع ما تتوقعه ، فإن الشيء التالي الذي يجب فعله هو التحقق من أنه يمكنك تسجيل الدخول كمستخدم في محرر الأوامر command line. بافتراض أن لديك مستخدم قاعدة بيانات لـ dvwa وكلمة مرور هي p@ssw0rd، قم بتنفيذ الأمر التالي:
mysql -u dvwa -pp@ssw0rd -D dvwaملاحظة: لا يوجد مسافة بعد -p
إذا ظهر الخرج التالي، فكلمة المرور صحيحة:
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]>نظرًا لأنه يمكنك الاتصال في سطر الأوامر ، فمن المحتمل أن يكون هناك خطأ ما في ملف التكوين ، تحقق مرة أخرى من ذلك ثم قم بإنشاء تذكرة للمشكلة إذا كنت لا تزال غير قادر على التشغيل.
إذا رأيت ما يلي ، فإن اسم المستخدم أو كلمة المرور التي تستخدمها غير صحيحة. كرر خطوات إعداد قاعدة البيانات وتأكد من استخدام اسم المستخدم وكلمة المرور نفسهما طوال العملية.
ERROR 1045 (28000): Access denied for user 'dvwa'@'localhost' (using password: YES)إذا حصلت على ما يلي ، فإن بيانات الدخول صحيحة ولكن ليس لدى المستخدم حق الوصول إلى قاعدة البيانات. مرة أخرى ، كرر خطوات الإعداد وتحقق من اسم قاعدة البيانات التي تستخدمها.
ERROR 1044 (42000): Access denied for user 'dvwa'@'localhost' to database 'dvwa'الخطأ النهائي الذي يمكن أن تحصل عليه هو :
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)هذه ليست مشكلة مصادقة ولكنها تخبرك أن خادم قاعدة البيانات لا يعمل. يمكنك تشغيله بتنفيذ الأمر التالي
sudo service mysql startمشكلة Unknown authentication method
مع أحدث إصدارات MySQL ، لم يعد بإمكان PHP الاتصال بقاعدة البيانات في تكوينها الافتراضي. إذا حاولت تشغيل البرنامج النصي للإعداد setup script وتلقيت الرسالة الjالية ، فهذا يعني أنه عليك إجراء بعض التعديلات على التكوين.
Database Error #2054: The server requested authentication method unknown to the client.لديك خياران ، أسهلهما هو إلغاء تثبيت MySQL وتثبيت MariaDB. تجد في الرابط التالي الدليل الرسمي لمشروع MariaDB:
https://mariadb.com/resources/blog/how-to-migrate-from-mysql-to-mariadb-on-linux-in-five-steps/
بدلاً من ذلك، اتبع الخطوات التالية:
1- باستخدام الحساب root، عدل الملف التالي: /etc/mysql/mysql.conf.d/mysqld.cnf.
2- أضف ما يلي تحت لاسطر [mysqld]:
default-authentication-plugin=mysql_native_password
3- أعد تشغيل خدمة قواعد البيانات: sudo service mysql restart.
4- تخقق من طريقة المصادقة الخاصة بحساب قاعدة البيانات:
```sql
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- من المرجح أنها caching_sha2_password، إذا كان كذلك، نفذ ما يلي:
```sql
mysql> ALTER USER dvwa@localhost IDENTIFIED WITH mysql_native_password BY 'p@ssw0rd';
```6- تحقق مجدداً، يجب أن تصبح الآن mysql_native_password .
```sql
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)
```بعد كل ما سبق، يجب أن تعمل عملية الإعدد بحالتها الطبيعية.
إذا كنت تريد المزيد من المعلومات يرجى الاطلاع على: https://www.php.net/manual/en/mysqli.requirements.php.
مشكلة Database Error #2002: No such file or directory.
إذا كان خادم قاعدة البيانات لا يعمل. وكنت تسخدم توزيعة مبنية على Debian، يمكن القيام بذلك باستخدام:
sudo service mysql startمعالجة الأخطاء "MySQL server has gone away" و "Packets out of order"
هناك عدة أسباب لحدوث هذه الأخطاء ، ولكن السبب المرجح هو عدم توافق إصدار خادم قاعدة البيانات مع إصار PHP.
وهو الأكثر شيوعًا عند تشغيل أحدث إصدار من MySQL و PHP ، لا يعمل التطبيق بشكل جيد. ولذلك ننصح باستبدال MySQL بـ MariaDB لأن هذه المشكلة لا يوجد دعم لها في الوقت الحالي.
لمزيد من المعلومات، يرجى الاطلاع على:
https://www.ryadel.com/en/fix-mysql-server-gone-away-packets-order-similar-mysql-related-errors/
لا يعمل حقن SQL باستخدام PHP v5.2.6
توقف دعم PHP 5.x منذ يناير 2019 ، لذلك نوصي بتشغيل DVWA بإصدار 7.x الحالي ، إذا كنت مضطراً لاستخدام الإصدار 5.x ..
إذا كنت تستخدم إصدار PHP v5.2.6 أو أحدث ، فستحتاج إلى القيام بما يلي حتى يعمل حقن SQL والثغرات الأمنية الأخرى.
استبدل الآتي في ملف htaccess.:
php_flag magic_quotes_gpc off
#php_flag allow_url_fopen on
#php_flag allow_url_include onبهذا:
magic_quotes_gpc = Off
allow_url_fopen = On
allow_url_include = Onفشل حقن الأوامر Command Injection
قد لا يكون لدى Apache امتيازات عالية كافية لتنفيذ الأوامر على خادم الويب. إذا كنت تقوم بتشغيل DVWA على نظام Linux ، فتأكد من تسجيل الدخول كمستخدم root. أما في Windows قم بتسجيل الدخول كـ administrator.
لماذا لا يمكن الاتصال بقاعدة البيانات في CentOS؟
قد تواجه مشاكل مع SELinux، قم إما بتعطيل SELinux أو تشغيل هذا الأمر للسماح لخادم الويب بالتخاطب مع قاعدة البيانات:
setsebool -P httpd_can_network_connect_db 1لأي مشكلة أخرى
للحصول على أحدث معلومات استكشاف الأخطاء وإصلاحها ، يرجى قراءة كل من التذاكر المفتوحة والمغلقة في الريبو git repo:
https://github.com/digininja/DVWA/issues
قبل إرسال التذكرة ، يرجى التأكد من تشغيل أحدث إصدار من الكود من الريبو. هذا ليس أحدث إصدار ، هذا هو أحدث كود من الفرع الرئيسي master branch .
في حالة إنشاء تذكرة ، يرجى تقديم المعلومات التالية على الأقل:
- نظام التشغيل
- آخر 5 أسطر من سجل أخطاء خادم الويب مباشرة بعد حدوث أي خطأ تقوم بالإبلاغ عنه
- إذا كانت المشكلة تتعلق بمصادقة قاعدة البيانات ، فانتقل إلى الخطوات السابقة أعلاه وقم بتصوير كل خطوة. وأرسلها مع لقطة شاشة لقسم ملف التكوين الذي يظهر مستخدم قاعدة البيانات وكلمة المرور.
- وصف كامل للخطأ الذي يحدث ، وما تتوقع حدوثه ، وما حاولت فعله لإصلاحه. "تعطل تسجيل الدخول" لا يكفي بالنسبة لنا لفهم مشكلتك والمساعدة في حلها.
حقن SQL في SQLite3
_ الدعم لهذا الأمر محدود ، قبل طرح مشكلتك، يرجى التأكد من استعدادك للعمل على تصحيح الأخطاء ، ولا تكتب ببساطة "أنه لا يعمل" ._
بشكل افتراضي ، يتم تنفيذ SQLi و Blind SQLi على خادم MariaDB / MySQL المستخدم في الموقع ولكن من الممكن التبديل لإجراء اختبار SQLi على SQLite3 بدلاً من ذلك.
لن نتطرق إلى كيفية تشغيل SQLite3 مع PHP ، ولكنها من المفترض أن تكون حالة بسيطة وذلك بتثبيت حزمة php-sqlite3 والتأكد من تفعيلها.
لإجراء هذا التبديل ، قم ببساطة بتعديل ملف التكوين وإضافة أو تعديل هذه الأسطر:
$_DVWA["SQLI_DB"] = "sqlite";
$_DVWA["SQLITE_DB"] = "sqli.db";بشكل افتراضي ، يستخدم الملف database/sqli.db ، إذا أحدثت خللا فيه، فما عليك سوى نسخ محتويات ملف database/sqli.db.dist ولصقها في الملف الذي تعمل عليه.
التحديات هي نفسها تمامًا مثل MySQL ، ولكنك الآن تنفذها في SQLite3 بدلاً من MySQL.
روابط
الصفحة الرئيسية للمشروع: https://github.com/digininja/DVWA
*تم إنشاؤها بواسطة فريقDVWA *
File: README.es.md
DAMN VULNERABLE WEB APPLICATION
Damn Vulnerable Web Application (DVWA) es una aplicación web hecha en PHP/MySQL que es extremadamente vulnerable. Su principal objetivo es ayudar a profesionales de seguridad a poner a prueba sus habilidades y herramientas en un entorno legal, ayudar a desarrolladores web a comprender mejor los procesos de asegurar aplicaciones web y ayudar tanto a estudiantes como a profesores a aprender sobre seguridad de aplicaciones web en un entorno de clase controlado.
El objetivo de DVWA es practicar algunas de las vulnerabilidades web más comunes, con varios niveles de dificultad, con una interfaz sencilla y directa.
Tener en cuenta que hay tanto vulnerabilidades documentadas como no documentadas en este software. Esto es intencional. Le animamos a que intente descubrir tantos problemas como sea posible.
¡AVISO!
¡Damn Vulnerable Web Application es extremadamente vulnerable! No la suba a la carpeta html pública de su proveedor de alojamiento ni a ningún servidor expuesto a Internet, ya que se verán comprometidos. Se recomienda utilizar una máquina virtual (como VirtualBox o VMware), que esté configurada en modo de red NAT. Dentro de una máquina huésped, puede descargar e instalar XAMPP para montar el servidor web y la base de datos.
Descargo de responsabilidad
No nos hacemos responsables de la forma en que cualquier persona utilice esta aplicación (DVWA). Hemos dejado claros los propósitos de la aplicación y no debe usarse de forma malintencionada. Hemos advertido y tomado medidas para evitar que los usuarios instalen DVWA en servidores web activos. Si su servidor web se ve comprometido por una instalación de DVWA, no es responsabilidad nuestra, sino de la persona o personas que lo subieron e instalaron.
Licencia
Este archivo es parte de Damn Vulnerable Web Application (DVWA).
Damn Vulnerable Web Application (DVWA) es software libre: puede redistribuirlo y/o modificarlo bajo los términos de la Licencia Pública General GNU publicada por la Free Software Foundation, ya sea la versión 3 de la Licencia, o (a su elección) cualquier versión posterior.
Damn Vulnerable Web Application (DVWA) se distribuye con la esperanza de que sea útil, pero SIN NINGUNA GARANTÍA; ni siquiera la garantía implícita de
COMERCIABILIDAD o IDONEIDAD PARA UN PROPÓSITO PARTICULAR. Consulte la Licencia Pública General GNU para más detalles.
Debería haber recibido una copia de la Licencia Pública General GNU junto con Damn Vulnerable Web Application (DVWA). Si no es así, consulte https://www.gnu.org/licenses/.
Internacionalización
Este archivo está disponible en varios idiomas:
Si desea contribuir con una traducción, envíe una PR (Pull Request). Tenga en cuenta, sin embargo, que esto no significa que sólo tiene que usar Google Translate y enviar el resultado de traducción de la herramienta, pues será rechazado. Envíe su versión traducida añadiendo un nuevo archivo 'README.xx.md' donde xx es el código de dos letras del idioma deseado (basado en ISO 639-1).
Descarga
Aunque existen varias versiones de DVWA, la única versión con soporte es la última del repositorio oficial de GitHub. Usted puede clonarlo desde el repositorio:
git clone https://github.com/digininja/DVWA.gitO descargar un ZIP con todos los archivos.
Instalación
Instalación Automatizada 🛠️
Nota, este no es un script oficial de DVWA, fue escrito por @IamCarron y se mantiene en DVWA-Script. Se ha dedicado mucho trabajo a crearlo y revisarlo, pero se recomienda revisar el script antes de ejecutarlo en su sistema. Por favor, reporte cualquier error en el repositorio de DVWA-Script, no aquí.
Un script de instalación automatizada para DVWA en sistemas basados en Debian, incluyendo Kali, Ubuntu, Kubuntu, Linux Mint, Zorin OS... Instala automáticamente todas las dependencias necesarias, configura PHP/Apache e inicializa las tablas de la base de datos listas para acceder (admin / password).
Nota: Este script requiere privilegios de root y está adaptado para sistemas basados en Debian. Asegúrese de ejecutarlo como usuario root.
Requisitos de Instalación
- Sistema Operativo: Distribuciones basadas en Debian (Kali, Ubuntu, Kubuntu, Linux Mint, Zorin OS, etc.)
- Privilegios: Ejecutar como usuario root
Pasos de Instalación
En una sola línea (One-Liner)
Esto descargará el script de instalación escrito por @IamCarron y lo ejecutará automáticamente:
sudo bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/IamCarron/DVWA-Script/main/Install-DVWA.sh)"Ejecución manual del script
Descargue el script:
shwget https://raw.githubusercontent.com/IamCarron/DVWA-Script/main/Install-DVWA.shOtorgue permisos de ejecución:
shchmod +x Install-DVWA.shEjecute como root:
shsudo ./Install-DVWA.sh
Videos de Instalación
- Instalando DVWA en Kali corriendo en VirtualBox
- Instalación de DVWA en Windows usando XAMPP
- Instalación de Damn Vulnerable Web Application (DVWA) en Windows 10
Windows + XAMPP
La forma más fácil de instalar DVWA es descargar e instalar XAMPP si aún no tiene un servidor web configurado.
XAMPP es una distribución de Apache muy fácil de instalar para Linux, Solaris, Windows y Mac OS X. El paquete incluye el servidor web Apache, MySQL, PHP, Perl, un servidor FTP y phpMyAdmin.
Este video le guiará a través del proceso de instalación para Windows, pero debería ser similar para otros sistemas operativos.
Archivo de configuración
DVWA se entrega con una plantilla del archivo de configuración que tendrá que copiar en su lugar y luego hacer los cambios apropiados. En Linux, suponiendo que se encuentra en el directorio DVWA, esto se puede hacer de la siguiente manera:
cp config/config.inc.php.dist config/config.inc.phpEn Windows, esto puede ser un poco más difícil si está ocultando las extensiones de archivo, si no está seguro acerca de esto, esta publicación de blog explica más sobre eso:
Cómo hacer que Windows muestre las extensiones de archivo
Paquetes Linux
Si utiliza una distribución de Linux basada en Debian, necesitará instalar los siguientes paquetes (o sus equivalentes):
- apache2
- libapache2-mod-php
- mariadb-server
- mariadb-client
- php php-mysqli
- php-gd
Se recomienda hacer una actualización antes de esto, sólo para asegurarse de que va a obtener la última versión de todos los paquetes.
apt update
apt install -y apache2 mariadb-server mariadb-client php php-mysqli php-gd libapache2-mod-phpEl sitio funcionará con MySQL en lugar de MariaDB, pero recomendamos MariaDB, ya que funciona con su instalación por defecto y sin cambio alguno, mientras que usted tendrá que hacer cambios para hacer que para MySQL funcione correctamente.
Configuración de la base de datos
Para configurar la base de datos, simplemente haga clic en el botón Setup DVWA en el menú principal, a continuación, haga clic en el botón Create / Reset Database. Esto creará / reiniciará la base de datos e insertará algunos datos de ejemplo.
Si recibe un error al intentar crear su base de datos, asegúrese de que sus credenciales de la base de datos dentro de ./config/config.inc.php están correctamente escritas. Esto difiere de config.inc.php.dist, que es un archivo de ejemplo.
Las variables son las siguientes por defecto:
$_DVWA[ 'db_server'] = '127.0.0.1';
$_DVWA[ 'db_port'] = '3306';
$_DVWA[ 'db_user' ] = 'dvwa';
$_DVWA[ 'db_password' ] = 'p@ssw0rd';
$_DVWA[ 'db_database' ] = 'dvwa';Nota, si está usando MariaDB en lugar de MySQL (MariaDB viene por defecto en Kali), entonces no podrá usar el usuario root de la base de datos, por tanto, debe crear un nuevo usuario de base de datos. Para hacer esto, debe conectarse a la base de datos como usuario root y usar los siguientes comandos:
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)Desactivar Autenticación
Algunas herramientas no funcionan bien con mecanismos de autenticación, por lo que no se pueden utilizar con DVWA si la autenticación está habilitada. Para resolver esto, existe una opción de configuración para desactivar la verificación de autenticación. Para ello, simplemente establezca lo siguiente en el archivo de configuración:
$_DVWA[ 'disable_authentication' ] = true;También tendrá que establecer el nivel de seguridad a uno que sea apropiado para las pruebas que desea hacer:
$_DVWA[ 'default_security_level' ] = 'low';En este estado, puede acceder a todas las funciones sin necesidad de iniciar sesión y tampoco tener que configurar cookies.
Otras Configuraciones
Dependiendo de su sistema operativo, así como la versión de PHP, es posible que desee modificar la configuración por defecto. La ubicación de los archivos será diferente para cada máquina.
Permisos de carpeta:
./hackable/uploads/- El servicio web necesita tener permisos de escritura en esta carpeta (para la subida de archivos)../external/phpids/0.6/lib/IDS/tmp/phpids_log.txt- El servicio web necesita tener permisos de escritura en esta carpeta (si desea usar PHPIDS).
Configuración de PHP:
- Para permitir la inclusión remota de archivos (RFI):
allow_url_include = on[allow_url_include]allow_url_fopen = on[allow_url_fopen]
- Para reducir opcionalmente la verbosidad ocultando los mensajes de advertencia de PHP:
display_errors = off[display_errors]
Archivo: config/config.inc.php:
$_DVWA[ 'recaptcha_public_key' ]&$_DVWA[ 'recaptcha_private_key' ]- Estos valores deben ser generados desde: https://www.google.com/recaptcha/admin/create
Credenciales por defecto
Nombre de usuario por defecto = admin
Contraseña por defecto = password
...puede ser fácilmente crackeada con fuerza bruta ;)
URL de Acceso: http://127.0.0.1/login.php
Nota: La URL de acceso será diferente si ha instalado DVWA en un directorio distinto.
Contenedor Docker
Esta sección del readme ha sido añadida por @thegrims, para soporte en temas Docker, por favor contactar con él o con @opsxcq que es quien mantiene la imagen Docker y el repositorio. Cualquier ticket de incidencia será probablemente referenciado a esto y cerrado.
- Página DockerHub
docker run --rm -it -p 80:80 vulnerables/web-dvwa
Por favor, asegúrese de que está utilizando aufs debido a problemas anteriores con MySQL. Ejecute docker info para comprobar su controlador de almacenamiento. Si no es aufs, por favor cámbielo. Hay guías para cada sistema operativo sobre cómo hacerlo, pero son bastante diferentes por lo que no lo cubriremos aquí.
Solución de problemas
Esta sección supone que está usando una distribución basada en Debian, como Debian, Ubuntu y Kali. Para otras distribuciones, siga el mismo procedimiento, pero actualice el comando donde corresponda.
He navegado hasta el sitio web y he obtenido un Error 404
Si está teniendo este problema, necesita entender la ubicación correcta de los archivos. Por defecto, el directorio raíz de los documentos de Apache (el lugar donde empieza a buscar contenido web) es /var/www/html. Si coloca el archivo hello.txt en este directorio, para acceder a él deberá navegar a http://localhost/hello.txt.
Si crea un directorio y pone el archivo allí - /var/www/html/mydir/hello.txt - tendrá que navegar a http://localhost/mydir/hello.txt.
Linux distingue por defecto entre mayúsculas y minúsculas, por lo que en el ejemplo anterior, si intentara navegar a cualquiera de estos sitios, obtendría un mensaje 404 Not Found:
¿Cómo afecta esto al DVWA? La mayoría de la gente utiliza git para obtener el DVWA en /var/www/html, esto les da el directorio /var/www/html/DVWA/ con todos los archivos DVWA dentro de él. Entonces navegan a http://localhost/ y obtienen un 404 o la página de bienvenida por defecto de Apache. Como los archivos están en DVWA, debe navegar a http://localhost/DVWA.
Otro error común es navegar a http://localhost/dvwa que dará un 404 porque dvwa no es DVWA en lo que se refiere a la correspondencia de directorios de Linux.
Así que después de la instalación, si intenta visitar el sitio y obtiene un 404, piense dónde instaló los archivos, dónde están en relación con el directorio raíz de documentos, y recuerde si utilizó mayúsculas o minúsculas en ese directorio.
"Access denied" ejecutando setup
Si ve lo siguiente al ejecutar el script de instalación significa que el nombre de usuario o la contraseña en el archivo de configuración no coinciden con los configurados en la base de datos:
Database Error #1045: Access denied for user 'notdvwa'@'localhost' (using password: YES).El error le está diciendo que está usando el nombre de usuario notdvwa.
El siguiente error indica que en el archivo de configuración ha escrito un nombre de base de datos equivocado.
SQL: Access denied for user 'dvwa'@'localhost' to database 'notdvwa'Está diciendo que está usando el usuario dvwa y tratando de conectarte a la base de datos notdvwa.
Lo primero que hay que hacer es comprobar que lo que se cree que ha puesto en el fichero de configuración es realmente lo que está ahí.
Si coincide con lo que se espera, lo siguiente es comprobar que se puede iniciar sesión como el usuario en cuestión a través de la línea de comandos. Asumiendo que tiene un usuario de base de datos dvwa y una contraseña p@ssw0rd, ejecute el siguiente comando:
mysql -u dvwa -pp@ssw0rd -D dvwaNota: No hay espacio después de -p
Si ve lo siguiente, la contraseña es correcta:
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]>Como puede conectarse en la línea de comandos, es probable que haya algo mal en el archivo de configuración, compruebe dos veces y luego plantee un Issue si todavía no puede hacer que las cosas funcionen.
Si ve lo siguiente, el nombre de usuario o la contraseña que está utilizando son incorrectos. Repita los pasos de Database Setup y asegúrese de usar el mismo nombre de usuario y contraseña durante todo el proceso.
ERROR 1045 (28000): Access denied for user 'dvwa'@'localhost' (using password: YES)Si obtiene lo siguiente, las credenciales del usuario son correctas pero el usuario no tiene acceso a la base de datos. De nuevo, repita los pasos de configuración y compruebe el nombre de la base de datos que está utilizando.
ERROR 1044 (42000): Access denied for user 'dvwa'@'localhost' to database 'dvwa'El último error que puede obtener es el siguiente:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)Esto no es un problema de autenticación, sino que indica que el servidor de base de datos no se está ejecutando. Puede iniciar el servidor con lo siguiente:
sudo service mysql startMétodo de autenticación desconocido
Con las versiones más recientes de MySQL, PHP ya no puede comunicarse con la base de datos en su configuración por defecto. Si intenta ejecutar el script de instalación y obtiene el siguiente mensaje significa que tiene la configuración por defecto.
Database Error #2054: The server requested authentication method unknown to the client.Tiene dos opciones, la más fácil es desinstalar MySQL e instalar MariaDB. La siguiente es la guía oficial del proyecto MariaDB:
https://mariadb.com/resources/blog/how-to-migrate-from-mysql-to-mariadb-on-linux-in-five-steps/
Alternativamente, siga estos pasos:
Como root, edite el siguiente archivo
/etc/mysql/mysql.conf.d/mysqld.cnf.Bajo la línea
[mysqld], añada lo siguiente:
default-authentication-plugin=mysql_native_password.Reinicie el servidor de base de datos:
sudo service mysql restartCompruebe el método de autenticación del usuario de la base de datos:
sqlmysql> 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)Es probable que vea
caching_sha2_password. Si es así, ejecute el siguiente comando:sqlmysql> ALTER USER dvwa@localhost IDENTIFIED WITH mysql_native_password BY 'p@ssw0rd';Al volver a ejecutar la verificación, ahora debería ver
mysql_native_password.sqlmysql> 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)
Después de todo esto, el proceso de configuración debería funcionar con normalidad.
Si desea más información consulte la siguiente página: https://www.php.net/manual/en/mysqli.requirements.php.
Database Error #2002: No such file or directory.
El servidor de base de datos no se está ejecutando. En una distro basada en Debian esto se puede hacer con:
sudo service mysql startErrores "MySQL server has gone away" y "Packets out of order"
Hay algunas razones por las que podría estar obteniendo estos errores, pero la más probable es que la versión del servidor de base de datos que está ejecutando no sea compatible con la versión de PHP.
Esto se encuentra de forma más común cuando se está ejecutando la última versión de MySQL y PHP, y estás no se llevan bien. El mejor consejo, deshágase de MySQL e instale MariaDB ya que esto no es algo con lo que podamos ayudarte.
Para más información, vea:
https://www.ryadel.com/en/fix-mysql-server-gone-away-packets-order-similar-mysql-related-errors/
La Inyección de Comandos no funcionará
Es posible que Apache no tenga privilegios suficientes para ejecutar comandos en el servidor web. Si está ejecutando DVWA en Linux asegúrese de que ha iniciado sesión como root. Bajo Windows inicie sesión como Administrador.
¿Por qué no se puede conectar la base de datos en CentOS?
Puede estar teniendo problemas con SELinux. Desactive SELinux o ejecute este comando para permitir que el servidor web se comunique con la base de datos:
setsebool -P httpd_can_network_connect_db 1Cualquier otra cosa
Para obtener la información más reciente sobre solución de problemas, lea los tickets abiertos y cerrados en el repositorio git:
https://github.com/digininja/DVWA/issues
Antes de enviar un ticket, por favor asegúrese de que está ejecutando la última versión del código del repositorio. No se trata de la última versión liberada (released), sino del último código disponible en la rama master.
Si desea enviar un ticket, por favor envíe al menos la siguiente información:
- Sistema operativo
- Las últimas 5 líneas del log de errores del servidor web justo después de que se produzca el error del que está informando.
- Si se trata de un problema de autenticación de base de datos, siga los pasos anteriores y haga una captura de pantalla de cada paso. Envíelas junto con una captura de pantalla de la sección del archivo de configuración que muestra el usuario y la contraseña de la base de datos.
- Una descripción completa de lo que está fallando, lo que espera que ocurra y lo que ha intentado hacer para solucionarlo. "inicio de sesión roto" no es suficiente para que entendamos su problema y le ayudemos a solucionarlo.
Inyección SQL en SQLite3
El soporte para esto es limitado, antes de abrir tickets en Issues, por favor asegúrese de que está preparado para trabajar en la depuración del problema, no se limite a decir "no funciona".
Por defecto, SQLi y Blind SQLi se hacen contra el servidor MariaDB/MySQL utilizado por el sitio, pero es posible cambiar la configuración para hacer las pruebas SQLi contra SQLite3 en su lugar.
No se va a cubrir cómo hacer que SQLite3 funcione con PHP, pero debería ser un simple caso de instalar el paquete php-sqlite3 y asegurarse de que está habilitado.
Para hacer el cambio, simplemente edite el archivo de configuración y añada o edite estas líneas:
$_DVWA["SQLI_DB"] = "sqlite";
$_DVWA["SQLITE_DB"] = "sqli.db";Por defecto se utiliza el fichero database/sqli.db, si lo estropea al archivo por error, simplemente copiar el archivo database/sqli.db.dist y sobreescribir el existente estropeado.
Los retos son exactamente los mismos que para MySQL, sólo que se ejecutan contra SQLite3 en su lugar.
👨💻 Contribuyentes
Gracias por todas sus contribuciones y por mantener este proyecto actualizado. :heart:
Si tienes una idea, algún tipo de mejora o simplemente quieres colaborar, eres bienvenido de contribuir y participar en el proyecto, siéntete libre de enviar tu PR.
Enlaces
Inicio del proyecto: https://github.com/digininja/DVWA
Creado por el Equipo de DVWA
File: README.fa.md
وب اپلیکیشن آسیب پذیر لعنتی
وب اپلیکیشن آسیب پذیر لعنتی (DVWA)، یک وب اپلیکیشن مبتنی بر پیاچپی/مایاسکیوال است که به شدت آسیبپذیر طراحی شده است. هدف اصلی این وب اپلیکیشن برای متخصصان امنیت می باشد که در یک محیط امن ابزار ها و توانایی خودشان را محک بزنند، به توسعهدهندگان کمک می کند تا نحوه ایمن سازی یک وب اپلیکیشن را متوجه شوند همچنین به دانش آموزان و معلمان کمک می کند تا در یک محیط تحت نظارت در مورد امنیت وب اپلیکیشن مطالعه کنند.
هدف DVWA، تمرین بخشی از متداولترین آسیبپذیریهای وب، در سطوح متفاوتی از دشواری، با بهراگیری از یک رابط کاربری آسان است.
لطفاً در نظر داشته باشد که در این نرمافزار آسیبپذیریهای مستند شده و مستند نشده وجود دارد.
این عمدی است. شما را تشویق میکنیم که تا حد امکان سعی کنید مشکلات بیشتری را کشف کنید.
هشدار!
وب اپلیکیشن آسیب پذیر لعنتی، به شکل خطرناکی آسیبپذیر است! آن را در پوشههای اچتیامال عمومی سرویس دهندهٔ میزبانی خود یا هر سروری که در اینترنت قرار دارد بارگذاری نکنید، چراکه مورد نفوذ قرار خواهند گرفت. برای این کار استفاده از یک ماشین مجازی پیشنهاد میشود (مثل ورچوال باکس یا ویامویر) که در حالت شبکهای NAT پیکربندی شده باشد. در داخل ماشین مجازی میتوانید زمپ را برای سرور وب و پایگاه دادهٔ خود دانلود کنید.
تکذیبنامه
ما در مورد اینکه از این اپلیکیشن (DVWA) چگونه استفاده میشود هیچ مسؤولیتی نمیپذیریم. ما هدف این برنامه را به صراحت بیان کردهایم و از آن نباید برای مقاصد بدخواهانه استفاده شود. ما هشدارها و اقدامات خود را در جهت جلوگیری از نصب DVWA بر روی سرویسدهندگان وب برخط انجام دادهایم. اگر به سرور وب شما از طریق یک نسخه از DVWA نفوذ شد، تقصیری متوجه ما نیست. مسؤولیت آن بر عهدهٔ کسی است که آن را بارگذاری و نصب کرده است.
مجوز
این فایل بخشی از وب اپلیکیشن آسیب پذیر لعنتی (DVWA) است.
وب اپلیکیشن آسیب پذیر لعنتی (DVWA) یک نرمافزار آزاد است. شما میتوانید آن را تحت مجوز نسخه سوم یا بهاختیر خودتان نسخههای جدیدتری از مجوز عمومی گنو (GNU) که توسط بنیاد نرمافزار آزاد منشر شده است، توزیع کنید و/یا تغییر دهید.
وب اپلیکیشن آسیب پذیر لعنتی (DVWA) به امید اینکه سودمند واقع شود توزیع شده است، لیکن بدون هیچگونه تضمینی، حتی به صورت ضمنی که برای مقاصد خاصی مناسب باشد ارائه میشود. مجوز عمومی گنو را برای اطلاعات بیشتر ببینید.
شما میبایست یک رونوشت از مجوز عمومی گنو را همرا با وب اپلیکیشن آسیب پذیر لعنتی (DVWA) دریافت کردهباشید. اگر این اتفاق نیفتاده است، https://www.gnu.org/licenses/ را ببینید.
بینالمللی سازی
این فایل به زبانهای مختلف دیگری موجود است:
- انگلیسی: English (نسخهٔ مرجع)
- عربی: العربية
- چینی: 简体中文
- فرانسوی: Français
- کره ای: 한국어
- لهستانی: Polski
- پرتغالی: Português
- اسپانیایی: Español
- ترکی: Türkçe
- اندونزی: Indonesia
- ویتنامی: Vietnamese
- ایتالیایی: Italiano
اگر مایل به ارائه ترجمه هستید، لطفاً یک PR ارسال کنید. البته توجه داشته باشید که این به این معنی نیست که فقط آن را از طریق Google Translate اجرا کنید و ارسال کنید، در غیر این صورت رد خواهد شد. نسخه ترجمه شده خود را با اضافه کردن یک فایل جدید 'README.xx.md' ارسال کنید که در آن xx کد دو حرفی زبان مورد نظر شما است (بر اساس ISO 639-1).
دانلود
در حالیکه ممکن است نسخههای متفاوتی از DVWA در اطراف پراکنده شده باشند، تنها نسخه پشتیبانی شده،آخرین نسخه از مخزن رسمی گیتهاب است. شما یا میتوانید آن را از طریق کلون کردن مخزن:
git clone https://github.com/digininja/DVWA.gitیا دانلود نسخهٔ زیپشدهٔ فایلها.
نصب
نصب خودکار 🛠️
توجه داشته باشید، این یک اسکریپت رسمی DVWA نیست، بلکه توسط @IamCarron و در DVWA-Script نگهداری میشود نوشته شده است. کار زیادی برای ایجاد این اسکریپت انجام شده است و وقتی ایجاد شد، هیچ کار مخربی انجام نداد، با این حال توصیه میشود محظ احتیاط قبل از اجرای کورکورانه اسکریپت روی سیستم خود، آن را بررسی کنید. لطفاً هرگونه اشکالی را به @IamCarron و در DVWA-Script نگهداری میشود گزارش دهید، نه اینجا.
یک اسکریپت پیکربندی خودکار برای DVWA در دستگاههای مبتنی بر دبیان، از جمله کالی، اوبونتو، کوبونتو، لینوکس مینت، زورین او اس...
توجه: این اسکریپت به دسترسی روت نیاز دارد و برای سیستمهای مبتنی بر دبیان طراحی شده است. مطمئن شوید که آن را با کاربر روت اجرا میکنید.
الزامات نصب
یک خطی
این دستور، اسکریپت نصب نوشته شده توسط @IamCarron را دانلود و به طور خودکار اجرا میکند. اگر ما به نویسنده و اسکریپت، همانطور که در زمان بررسی آن بود، اعتماد نداشتیم، این مورد در اینجا لحاظ نمیشد، اما همیشه احتمال سوءاستفادهی کسی وجود دارد، بنابراین اگر از اجرای کد شخص دیگری بدون بررسی آن توسط خودتان احساس امنیت نمیکنید، مراحل دستی را دنبال کنید و میتوانید پس از دانلود، آن را بررسی کنید.
sudo bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/IamCarron/DVWA-Script/main/Install-DVWA.sh)"اجرای دستی اسکریپت
۱. اسکریپت را دانلود کنید:
wget https://raw.githubusercontent.com/IamCarron/DVWA-Script/main/Install-DVWA.sh۲. اسکریپت را قابل اجرا کنید
chmod +x Install-DVWA.sh۳. اسکریپت را با دسترسی root اجرا کنید:
sudo ./Install-DVWA.shویدئوهای نصب
ویندوز+زمپ
اگر تا به حال تنظیمات وب سرور را انجام ندادهاید، سادهترین راه برای نصب DVWA دانلود و نصب XAMPP است.
برنامه XAMPP یک توزیع آپاچی با نصب بسیار آسان برای لینوکس، سولاریس، ویندوز و مک او اس ایکس است. این برنامه شامل وب سرور آپاچی، MySQL، PHP، Perl، یک سرور FTP و phpMyAdmin است.
این ویدیو مراحل نصب ویندوز را به شما نشان میدهد، در سایر سیستم عاملها نصب آن زیاد تفاوت ندارد.
داکر
به لطف hoang-himself و JGillam، هر کامیت به شاخه master باعث میشود یک Image داکر ساخته شود و آماده دریافت از ساخت کانتینر گیتهاب باشد.
برای اطلاعات بیشتر در مورد آنچه دریافت میکنید، میتوانید [Image از پیش ساخته شده داکر] (https://github.com/digininja/DVWA/pkgs/container/dvwa) را مرور کنید.
شروع کار
پیشنیازها: داکر و داکر کامپوز.
- اگر از Docker Desktop استفاده میکنید، هر دوی این موارد باید از قبل نصب شده باشند.
- اگر Docker Engine را روی لینوکس ترجیح میدهید، حتماً [راهنمای نصب] آنها (https://docs.docker.com/engine/install/#server) را دنبال کنید.
همانطور که در بالا مشاهده می کنید، ما از آخرین نسخه Docker پشتیبانی میکنیم.
اگر روی لینوکس از نسخهی Docker که از طریق package manager نصب شده استفاده کنید، احتمالاً کار میکند؛ اما اگر مشکلی پیش بیاد، پشتیبانی رسمی و تضمینی نداره و فقط در حد «تلاش میکنیم کمک کنیم» خواهد بود.
ارتقاء داکر از نسخه مدیریت بسته به نسخه آپاستریم مستلزم آن است که نسخههای قدیمی را همانطور که در دفترچههای راهنمای آنها برای اوبونتو، فدورا و سایر موارد مشاهده شده است، حذف نصب کنید. دادههای داکر شما (کانتینرها، تصاویر، ولومها و غیره) نباید تحت تأثیر قرار گیرند، اما در صورت بروز مشکل، حتماً به داکر اطلاع دهید و در عین حال از موتورهای جستجو استفاده کنید.
سپس، برای شروع:
۱. برای بررسی نصب صحیح داکر و داکر کامپوز، دستورهای docker version و docker compose version را اجرا کنید. باید بتوانید نسخههای آنها را در خروجی مشاهده کنید.
برای مثال:
>>> 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اگر نتیجه ای نمیبینید یا خطای command not found دریافت میکنید، پیشنیازهای راهاندازی Docker و Docker Compose را دنبال کنید.
۲. این مخزن را کلون یا دانلود کرده و از حالت فشرده خارج کنید (به دانلود مراجعه کنید).
۳. یک ترمینال باز کنید و دایرکتوری آن را به این پوشه (DVWA) تغییر دهید.
۴. دستور docker compose up -d را اجرا کنید.
حالا DVWA در آدرس http://localhost:4280 در دسترس است.
توجه داشته باشید که DVWA موجود در کانتینر، به جای پورت پیشفرض ۸۰، بر روی پورت ۴۲۸۰ حالت Listening میباشد.
برای اطلاعات بیشتر در مورد این تصمیم، به من میخواهم DVWA را روی یک پورت متفاوت اجرا کنم مراجعه کنید.
ساخت در Local
اگر تغییرات Local ایجاد کردهاید و میخواهید پروژه را از Local بسازید، به compose.yml بروید و pull_policy: always را به pull_policy: build تغییر دهید.
اجرای دستور docker compose up -d باید باعث شود که داکر صرف نظر از آنچه در رجیستری موجود است، یک تصویر از سیستم محلی بسازد.
همچنین این را هم مطالعه کنید: pull_policy.
پردازش فایل های Local
اگر تغییرات محلی ایجاد میکنید و نمیخواهید پروژه را برای هر تغییر Build کنید:
۱. به فایل compose.yml بروید و این خط را از حالت کامنت خارج کنید:
# volumes:
# - ./:/var/www/html۲. برای کپی کردن فایل پیکربندی پیشفرض، دستور cp config/config.inc.php.dist config/config.inc.php را اجرا کنید.
۳. دستور docker compose up -d را اجرا کنید تا تغییرات در فایلهای محلی روی کانتینر اعمال شود.
نسخه PHP
در حالت ایدهآل، شما باید از آخرین نسخه پایدار PHP استفاده کنید، زیرا این نسخهای است که این برنامه روی آن توسعه داده و آزمایش خواهد شد.
به کسانی که سعی در استفاده از PHP 5.x دارند، پشتیبانی ارائه نخواهد شد.
نسخههای پایینتر از ۷.۳ مشکلات شناختهشدهای دارند که باعث ایجاد عدم عملکرد صحیح میشود، بیشتر برنامه کار خواهد کرد، اما ممکن است مواردی به صورت تصادفی درست عمل نکنند. مگر اینکه دلیل بسیار خوبی برای استفاده از چنین نسخه قدیمی داشته باشید، پشتیبانی ارائه نخواهد شد.
دسترسی های لینوکس
اگر از توزیع لینوکس مبتنی بر دبیان استفاده میکنید، باید بستههای زیر (یا معادل آنها) را نصب کنید:
- apache2
- libapache2-mod-php
- mariadb-server
- mariadb-client
- php php-mysqli
- php-gd
توصیه میکنم قبل از این کار، یک بهروزرسانی انجام دهید، فقط برای اینکه مطمئن شوید آخرین نسخه همه چیز را دریافت میکنید.
apt update
apt install -y apache2 mariadb-server mariadb-client php php-mysqli php-gd libapache2-mod-phpاین سایت به جای MariaDB با MySQL کار خواهد کرد، اما ما اکیداً MariaDB را توصیه میکنیم زیرا به صورت پیشفرض کار میکند، در حالی که برای عملکرد صحیح MySQL باید تغییراتی ایجاد کنید.
ماژولهای آپاچی
اگر میخواهید از API lab استفاده کنید، باید ماژول آپاچی mod_rewrite را فعال کنید. برای انجام این کار در لینوکس، دستور زیر را اجرا کنید:
a2enmod rewriteسپس Apache را راه اندازی مجدد کنید:
apachectl restartفایل های Vendor
اگر میخواهید از ماژول API استفاده کنید، باید مجموعهای از فایلهای Vendor را با استفاده از Composer نصب کنید.
اول، مطمئن شوید که Composer را نصب کردهاید. به نظر میرسد نسخ قدیمی دارای مشکلاتی باشد، بنابراین من همیشه آخرین نسخه را از اینجا دریافت میکنم:
https://getcomposer.org/doc/00-intro.md
برای نصب، دستورالعملهایی که سایت ارائه میدهد را دنبال کنید.
حالا به پوشه vulnerabilities/api بروید و دستور زیر را اجرا کنید:
composer.phar installاگر Composer را در مسیر سیستم نصب نکردهاید، مطمئن شوید که امکان ارجاع به آن وجود دارد.
پیکربندیها
فایل کانفیگ
برنامهٔ DVWA همرا با یک فایل کانفیگ دمدستی توزیع میشود که لازم است شما آن را در جای مناسب کپی کنید و تغییرات لازم را بر روی آن اعمال کنید. در لینوکس با فرض بر اینکه در پوشهٔ DVWAقرار دارید، به این طریق میتوانید فایل را کپی کنید:
cp config/config.inc.php.dist config/config.inc.php
در ویندوز، اگر پسوند فایلها مخفی باشد، کار اندکی دشوارتر میشود. اگر در این مورد مطمئن نیستید، برای توضیحات بیشتر این پست وبلاگ را ببینید:
چگونه در ویندوز پسوند ها را نمایش دهیم
پیکربندی با متغیرهای محیطی
به جای تغییر فایل پیکربندی، میتوانید اکثر تنظیمات را با استفاده از متغیرهای محیطی نیز تنظیم کنید. در یک پیادهسازی Docker یا Kubernetes، این به شما امکان میدهد پیکربندی را بدون ایجاد یک تصویر Docker جدید تغییر دهید. متغیرها را در فایل config/config.inc.php.dist خواهید یافت.
اگر میخواهید سطح امنیتی پیشفرض را روی «پایین» تنظیم کنید، کافیست خط زیر را به فایل compose.yml اضافه کنید:
environment:
- DB_SERVER=db
- DEFAULT_SECURITY_LEVEL=lowنصب دیتابیس
برای راهاندازی پایگاه داده، کافیست روی دکمهی «Setup DVWA» در منوی اصلی کلیک کنید، سپس روی دکمهی «Create / Reset Database» کلیک کنید. این کار پایگاه داده را برای شما با مقداری داده ایجاد/بازنشانی میکند.
اگر هنگام ایجاد پایگاه داده خود با خطایی مواجه شدید، مطمئن شوید که اعتبارنامههای ( نام کاربری و رمز عبور ) پایگاه داده شما در./config/config.inc.php
صحیح هستند.
نکته: فایل config.inc.php.dist یک فایل نمونه است، و با config.inc.php متفاوت است.
متغیرها به طور پیشفرض به صورت زیر تنظیم شدهاند:
$_DVWA[ 'db_server'] = '127.0.0.1';
$_DVWA[ 'db_port'] = '3306';
$_DVWA[ 'db_user' ] = 'dvwa';
$_DVWA[ 'db_password' ] = 'p@ssw0rd';
$_DVWA[ 'db_database' ] = 'dvwa';نکته، اگه شما از MariaDB به جای MySQL (به صورت پیشفرضMariaDB در Kali وجود دارد)، نمیتونید از کاربر root استفاده کنید و باید یک کاربر در دیتابیس بسازید برای انجام این کار به دیتابیس خودتون متصل بشید و دستورات زیر را اجرا کنید:
MariaDB [(none)]> create database dvwa;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create user dvwa@localhost identified by 'p@ssw0rd';
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> grant all on dvwa.* to dvwa@localhost;
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)غیرفعال سازی احراز هویت
بعضی از ابزارها با بخش ورود به خوبی کار نمیکنند و با DVWA نمیتوانند استفاده شوند. برای رفع این مشکل، گزینهای در کانفیگ وجود دارد که بتوانید کنترل ورود را غیر فعال کنید. برای این کار کافیست تنظیم زیر را در فایل کانفیگ انجام دهید:
$_DVWA[ 'disable_authentication' ] = true;همچنین لازم است سطح امنیت را به مقداری که برای آزمونتان مد نظر دارید تغییر دهید:
$_DVWA[ 'default_security_level' ] = 'low';در این حالت شما میتوانید از تمامی امکانات بدون نیاز به ورود و تنظیم کوکیها بهره ببید.
سطح دسترسی به پوشهها
./hackable/uploads/
باید توسط وب سرویس قابل نوشتن باشد (برای آپلود فایل)../external/phpids/0.6/lib/IDS/tmp/phpids_log.txt
باید توسط وب سرویس قابل نوشتن باشد (اگر قصد استفاده از PHPIDS را دارید ).
تنظیمات PHP
تنظیمات PHP در سیستمهای لینوکس، احتمالاً در/etc/php/x.x/fpm/php.ini
یا/etc/php/x.x/apache2/php.ini
یافت میشود.
جهت بهرهبرداری به آسیبپذیری Remote File Inclusions (RFI)
* تنظیمallow_url_include = onمستندات: [allow_url_include]
* تنظیمallow_url_fopen = onمستندات: [allow_url_fopen]برای خاموشکردن هشدارهای پیاچپی که کمتر شلوغ باشد (در صورت نیاز)
* تنظیمdisplay_errors = offمستندات: [display_errors]حتما پس از ایجاد تغییرات سرویس PHP یا Apache را راه اندازی مجدد کنید.
تنظیمات reCAPTCHA
این فقط برای آزمایشگاه "CAPTCHA ناامن" مورد نیاز است، اگر نمیخواهید این آزمایشگاه را ارزیابی کنید، می توانید این بخش را نادیده بگیرید.
یک جفت کلید API از https://www.google.com/recaptcha/admin/create دریافت کنید.
سپس به فایل./config/config.inc.php
بروید و این مقادیر را به آن اضافه کنید:
$_DVWA[ 'recaptcha_public_key' ]$_DVWA[ 'recaptcha_private_key' ]
اطلاعات ورود پیشفرض
نام کاریری پیشفرض = admin
کلمه عبور پیشفرض = password
...که به راحتی میتواند مورد حملات بروتفورس قرار گیرد ;)
نشانی ورود: http://127.0.0.1/login.php
نکته: اگر DVWA را در مسیرمتفاوتی نصب کرده باشد، این نیز برای شما تفاوت خواهد داشت.
عیب یابی
تمامی مراحل با فرض این که شما در یک توزیع مبتنی بر دبیان، مانند دبیان، اوبونتو و کالی هستید. برای سایر توزیعها، هستید نوشته شده است، اما دستور را در صورت لزوم بهروزرسانی کنید.
اگر ترجیح می دهید به جای خواندن، ویدیو تماشا کنید، رایج ترین مشکلات در ویدیو [رفع مشکلات راه اندازی DVWA] (https://youtu.be/C-kig5qrPSA?si=_a4Bop505-1tXb_F) پوشش داده شده است.
کانتینر داکر
میخواهم به لاگ دسترسی داشته باشم
اگر از Docker Desktop استفاده میکنید، میتوانید از برنامه گرافیکی به گزارشها دسترسی پیدا کنید.
برخی از جزئیات جزئی ممکن است با نسخه های جدیدتر تغییر کنند، اما روش دسترسی باید یکسان باشد.
همچنین می توانید از طریق Terminal به لاگ ها دسترسی داشته باشید.
- یک ترمینال را باز کنید و دایرکتوری کاری آن را به DVWA تغییر دهید
- گزارش های ادغام شده را نشان دهید
docker compose logsدر صورتی که میخواهید لاگ ها در یک فایل ذخیره شوند این دستور را اجرا کنید:
docker compose logs > dvwa.logمیخواهم DVWA را روی پورت متفاوتی اجرا کنم
به صورت پیش فرض ما از پورت 80 به چند دلیل استفاده نمیکنیم:
- برخی کاربران ممکن است روی پورت 80 چیزی در حال اجرا داشته باشند
- برخی کاربران ممکن است از کانتینر هایی که rootless هستند (مثل Podman) استفاده کنند، دسترسی به پورت 80 نداشته باشند.
با تغییر اتصال پورت در فایل «compose.yml» میتوانید DVWA را در پورت دیگری در معرض دید قرار دهید.
به عنوان مثال، شما می توانید مقدار زیر را
ports:
- 127.0.0.1:4280:80به
ports:
- 127.0.0.1:8806:80تغییر دهید.
حالا DVWA روی آدرس http://localhost8806 در دسترس است.
در مواردی که می خواهید DVWA برای همه کاربران موجود در یک شبکه قابل دسترس باشد، مقدار 127.0.0.1: را از فایل compose.yml حذف کنید (یا آن را با IP LAN خود جایگزین کنید). در این حالت امکان مشاهده DVWA در کل شبکه فراهم می باشد.
به این
دستگاه لوپ بک محلی پس از همه، این یک برنامه وب آسیب پذیر لعنتی است که روی دستگاه شما اجرا می شود.
شروع خودکار DVWA در هنگام اجرای Docker
فایل موجود compose.yml به طور خودکار DVWA و پایگاه داده آن را با شروع Docker اجرا می کند.
برای غیرفعال کردن این قابلیت، میتوانید خط
restart: unless-stoppedرا در فایل compose.yml حذف یا کامنت کنید.
اگر میخواهید این رفتار را بهطور موقت غیرفعال کنید، میتوانید docker compose stop را اجرا کنید، یا از Docker Desktop استفاده کنید، DVWA را پیدا کنید و روی Stop کلیک کنید.
اگر میخواهید کانتینر را متوقف کنید دستور docker compose down را اجرا کنید.
فایل LOG
در سیستمهای لینوکس، آپاچی بهطور پیشفرض دو فایل گزارش ایجاد میکند، «access.log» و «error.log» و در سیستم مبتنی بر دبیان معمولاً در /var/log/apache2/ یافت میشوند.
هنگام ارسال گزارش خطا، مشکلات و مواردی از این قبیل، لطفاً حداقل پنج خط آخر هر یک از این فایل ها را وارد کنید. در سیستم های مبتنی بر دبیان می توانید موارد زیر را دریافت کنید:
tail -n 5 /var/log/apache2/access.log /var/log/apache2/error.logسایت را مرور میکنم، ولی خطای ۴۰۴ میگیرم
اگر شما این خطا را دریافت میکنید، نیاز است تسبت به محل فایلها آگاهی بیشتری کسب کنید. بهشکل پیشفرض، پوشهٔ ریشهٔ فایلهای آپاچی (جایی که آن را بهدنبال محتوای وبی جستجو میکند)، در /var/www/html واقع شده است. اگر شما فایل hello.txt را در آن قرار دهید، برای مرور آن میبایست از آدرس http://localhost/hello.txt استفاده کنید.
اما اگر یک پوشه در آنجا ساختهاید و فایل را دروت آن قرار دادهاید - /var/www/html/mydir/hello.txt - میبایست برای مرور آن از آدرس http://localhost/mydir/hello.txt استفاده کنید.
لینوکس، نسبت به بزرگی و کوچکی حروف حساس است. لذا در مثال بالا تلاش برای مرور هرکدام از آدرسهای زیر نیز به شما خطای ۴۰۴ را گزارش خواهد داد:
http://localhost/MyDir/hello.txthttp://localhost/mydir/Hello.txthttp://localhost/MYDIR/hello.txt
این چه تأثیری بر روی DVWAخواهد داشت؟ بسیاری از افراد با استفاده از گیت، DVWA را در پوشهٔ /var/www/html دانلود میکنند. این منجر به ایجاد پوشهٔ /var/www/html/DVWA/ خواهد شد که تمام فایلهای DVWA درون آن قرار میگیرند. پس از آن سراغ آپاچی رفته و http://localhost/ را مرور کرده و با خطای ۴۰۴ یا صفحهٔ خوشآمدگویی آپاچی مواجه میشوند. از آنجایی که فایلها درون پوشهٔ DVWA قرار دارند، باید بجای آن، آدرس http://localhost/DVWA را مرور کرد.
اشتباه رایج دیگر استفاده از آدرس http://localhost/dvwa است که باز هم خطای ۴۰۴ را خواهد داد. چراکه dvwa با DVWA در لینوکس یکی نیستند و لینوکس به حروف بزرگ و کوچک حساس می باشد.
بنابرین وقتی پس از نصب با خطای 404 مواجه شدید، یک مرتبه مرور کنید که فایها را در کجا نصب کردهاید، نسبت به پوشهٔ ریشهٔ فایلها در چه موقعیتی قرار گرفتهاند و بزرگی و کوچکی حروف در نام پوشههای استفادهشده چه شکلی است.
در هنگام باز شدن صفحه سایت صفحه سفید می باشد
این معمولاً یک مشکل پیکربندی است که مشکل دیگری را پنهان می کند. بهطور پیشفرض، PHP خطاها را نمایش نمیدهد، و بنابراین اگر فراموش کردهاید که نمایش خطا را در طول فرآیند راهاندازی روشن کنید، هر گونه مشکل دیگری مانند عدم اتصال به پایگاه داده، بارگذاری برنامه را متوقف میکند اما پیامی که به شما میگوید چه چیزی اشتباه است پنهان میشود.
برای رفع این مشکل، مطمئن شوید که display_errors و display_startup_errors را در [پیکربندی PHP] (#php-configuration) تنظیم کردهاید و سپس Apache را مجدداً راهاندازی کنید.
خطای"Access denied" موقع اجرای نصب
اگر حین اجرای اسکریپت نصب این خطا را دریافت میکنید، بدان معنی است که نام کاربری و کلمهٔ عبور تنظیمشده در قایل تنظیمات با آنچه در پایگاه داده تنظیم شده است تطابق ندارد. ویدیو رفع مشکل
Database Error #1045: Access denied for user 'notdvwa'@'localhost' (using password: YES).این پیام خطا به شما میگوید که در حال استفاده از نام کاربری notdvwa هستید.
خطای زیر می گوید که فایل پیکربندی را به سمت پایگاه داده اشتباهی نشانه رفته اید. راهنمای ویدیو
SQL: Access denied for user 'dvwa'@'localhost' to database 'notdvwa'این به شما میگوید که با استفاده از نام کاربری dvwa در حال تلاش برای اتصال به پایگاه دادهٔ notdvwa هستید.
اولین قدم این است که بررسی کنید نام کاربری، رمزعبور، نام دیتابیس در فایل کانفیگ به صورت صحیح وجود دارد خیر
اگر مقادیر به درستی در فایل کانفیگ تعریف شده بودند، مرحلهٔ بعدی تلاش برای ورود با نام کاریری از طریق خط فرمان است. با فرض بر اینکه شما یک نام کاربری با نام dvwa و یک کلمهٔ عبور با مقدار p@ssw0rd دارید، میتوانید دستور زیر را اجرا کنید:
mysql -u dvwa -pp@ssw0rd -D dvwaدقت کنید که هیچ فاصلهٔ خالی بعد از p- قرار ندارد
اگر یک چنین چیزی میبینید، کلمهٔ عبور شما صحیح است:
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]>از آنجا که از طریق خط فرمان به شکل موفقیت آمیز توانستهاید متصل شوید، به احتمال زیاد چیزی در فایل کانفیگ اشتباه است. مجدداً آن را بررسی کنید و اگر همچنان نتوانستید موفق شوید یک issue برای رسیدگی ایجاد کنید.
اگر چنین چیزی میبینید، یا نام کاربری یا کلمهٔ عبورتان اشتباه است. مراحل نصب پایگاه داده را مجدداً تکرار کنید و اطمینان حاصل کنید که در کل این فرایند از همان نام کاربری و کلمهٔ عبور استفاده میکنید.
ERROR 1045 (28000): Access denied for user 'dvwa'@'localhost' (using password: YES)اگر خطای زیر را میگیرید، بدین معنا است که نام کاربری و کلمهٔ عبور شما صحیح است، لبکن سطح دسترسی آن به پایگاه داده کافی نیست. در این حالت نیز مراحل نصب را تکرار کنید و نام پایگاه دادهای که به آن متصل میشوید را چک کنید.
ERROR 1044 (42000): Access denied for user 'dvwa'@'localhost' to database 'dvwa'آخرین خطایی که ممکن است دریافت کنید نیز به شرح زیر است:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)این یک خطای احراز هویت نیست، اما به شما میگوید که سرور پایگاه داده در حال اجرا نیست. آن را با دستور زیر اجرا کنید:
sudo service mysql startخطای اتصال
یک خطای مشابه هم میتوان مشاهده کرد
Fatal error: Uncaught mysqli_sql_exception: Connection refused in /var/sites/dvwa/non-secure/htdocs/dvwa/includes/dvwaPage.inc.php:535به این معنی که سرور دیتابیس شما اجرا نشده است یا آدرس IP اشتباهی تعریف شده است.
برای دیدن محل مورد انتظار سرور پایگاه داده، این خط را در فایل پیکربندی بررسی کنید:
$_DVWA[ 'db_server' ] = '127.0.0.1';سپس بررسی کنید که ایا MariaDB در حال اجرا است؟
در لینوکس این کار را میتوان با دستور زیر انجام داد:
systemctl status mariadb.serviceدر نتیجه این دستور باید همچین خروجی داشته باشد:
● 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اگه مقدار active (running) را مشاهده کردید یعنی سرویس MariaDB فعال می باشد.
اگر اجرا نشده بود دستور زیر را اجرا کنید
sudo systemctl stop mariadb.serviceبه sudo توجه کنید و در صورت درخواست، مطمئن شوید که رمز عبور کاربر لینوکس خود را وارد میکنید.
در ویندوز، وضعیت را در کنسول XAMPP بررسی کنید.
روش ورود ناشتاخته
در جدیدترین نسخههای MySQL، PHP دیگر نمیتواند با پایگاه داده در پیکربندی پیشفرض آن ارتباط برقرار کند. اگر سعی کنید اسکریپت راهاندازی را اجرا کنید و پیام زیر را دریافت کنید، به این معنی است که پیکربندی انجام شده است.
Database Error #2054: The server requested authentication method unknown to the client.دو راه حل پیش رو دارید که آسانترین آنها حذف مایاسکیوال و نصب ماریادیبی بجای آن است. در پایین میتوانید راهنمای رسمی پروژهٔ ماریادیبی را ببینید:
https://mariadb.com/resources/blog/how-to-migrate-from-mysql-to-mariadb-on-linux-in-five-steps/
راهحل دیگر اجرای مراحل زیر است:
- با کاربر روت، فایل
/etc/mysql/mysql.conf.d/mysqld.cnfرا برای ویرایش باز کنید. - زیر سطر
[mysqld]، عبارت زیر را اضافه کنید:default-authentication-plugin=mysql_native_password - سرویس پایگاه داده را ریستارت کنید:
sudo service mysql restart - حالت ارزیابی ورود را برای کاربرتان بررسی کنید:
sql 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)
- احتمالاً
caching_sha2_passwordبه چشمتان خواهد خورد در این صورت دستور زیر را اجرا کنید:
sql mysql> ALTER USER dvwa@localhost IDENTIFIED WITH mysql_native_password BY 'p@ssw0rd';
- اگر دوباره بررسی کنید، ایندفعه میبایست
mysql_native_passwordرا ببینید.
sql 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)
پس از تمام این کارها، الان فرایند نصب باید بتواند به صورت عادی انجام شود.
برای اطلاعات بیشتر صفحهٔ زیر را دنبال کنید:
https://www.php.net/manual/en/mysqli.requirements.php.
خطای شماره ۲۰۰۲ پایگاه داده: چنین فایل یا پوشهای وجود ندارد
سرور پایگاه داده در حال اجرا نیستو در توزیعهای مبتنی بر دبیان میتوانید اینگونه مشکل را برطرف کنید:
sudo service mysql startخطاهای "MySQL server has gone away" و "Packets out of order"
چندین دلیل ممکن است برای گرفتن خطاهای بالا وجود داشته باشد. اما شایعترینشان این است که نسخهٔ سرور پایگاه دادهٔ شما با نسخهٔ پیاچپی سازگاری ندارد.
این ممکن است وقتی استفاده از آخرین نسخههای مایاسکیوال و پیاچپی به خوبی پیشنرود مشاهده شود. بهترین توصیه کنارگذاشتن مایاسکیوال و نصب ماریادیبی است چرا که این موضوعی نیست که بتوانیم پشتیبانی بیشتری در مورد آن بدهیم.
برای اطلاعات بیشتر اینجا را ببینید:
https://www.ryadel.com/en/fix-mysql-server-gone-away-packets-order-similar-mysql-related-errors/
دلیل عدم اتصال به دیتابیس در CentOS
ممکن است با SELinux به مشکل برخورده باشید. یا SELinux را غیرفعال کنید یا این دستور را اجرا کنید تا به وب سرور اجازه دهید با پایگاه داده ارتباط برقرار کند:
setsebool -P httpd_can_network_connect_db 1داکر MariaDB شروع به کار نمیکند
اگر هنگام تلاش برای شروع MariaDB خطای زیر را در گزارشهای Docker مشاهده کردید، احتمالاً به دلیل کمبود حافظه کافی در دستگاه میزبان است. اگر از این در یک محیط میزبانی شده استفاده میکنید، بهترین راه حل افزایش اندازه دستگاه برای دریافت حافظه بیشتر و دوباره امتحان کردن است.
[Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.11.15+maria~ubu2204 started.
[Warn] [Entrypoint]: /sys/fs/cgroup///memory.pressure not writable, functionality unavailable to MariaDBهمچنین ممکن است لازم باشد خط زیر را به بخش volums فایل compose.yml خود اضافه کنید:
- /sys/fs/cgroup/memory.pressure:/sys/fs/cgroup/memory.pressureچیز دیگه ای میمونه
برای آخرین اطلاعات عیبیابی، لطفاً تیکتهای باز و بسته را در مخزن گیت مطالعه کنید:
https://github.com/digininja/DVWA/issues
قبل از ارسال تیکت، لطفاً مطمئن شوید که آخرین نسخه کد را از مخزن اجرا میکنید. این آخرین نسخه نیست، این آخرین کد از شاخه اصلی است.
در صورت درخواست، لطفاً حداقل اطلاعات زیر را ارسال کنید:
- سیستم عامل
- ۵ خط آخر از گزارش خطای وب سرور بلافاصله پس از وقوع هر خطایی که گزارش میدهید
- اگر مشکل از احراز هویت پایگاه داده است، مراحل بالا را طی کنید و از هر مرحله اسکرین شات بگیرید. این مراحل را به همراه اسکرین شاتی از بخشی از فایل پیکربندی که نام کاربری و رمز عبور پایگاه داده را نشان میدهد، ارسال کنید.
- شرح کاملی از مشکل، آنچه انتظار دارید اتفاق بیفتد و آنچه برای رفع آن تلاش کردهاید. عبارت «ورود به سیستم خراب است» برای درک مشکل شما و کمک به رفع آن برای ما کافی نیست.
آموزش
من سعی میکنم چند ویدیوی آموزشی تهیه کنم که برخی از آسیبپذیریها را بررسی کرده و نحوه شناسایی و سپس بهرهبرداری از آنها را نشان دهد. در اینجا ویدیوهایی که تاکنون ساختهام را مشاهده میکنید:
Finding and Exploiting Reflected XSS
تزریق SQL در SQLite3
پشتیبانی از این موضوع بسیار محدود است. قبل از ثبت خطا باید اطمینان داشتهباشید برای کارکردن بر روی اشکالزدایی آمادگی کافی را داشته باشید. از مطرحکردن "فلان چیز کار نمیکند" بپرهیزید
به طور پیشفرض SQLi و Blind SQLi بر روی سرور ماریادیبی یا مایاسکیوال استفاده شده در سایت انجام میشوند. اما این امکان وجود دارد که تست SQLi را بجای آن بر روی یک SQLite3 انجام دهید.
در اینجا چگونگی راهاندازی و کارکردن SQLite3 با PHP توضیح داده نمیشود، اما چیز سادهای در حد نصب php-sqlite3 و اطمینان از فعال بودن آن را یادآوری میکنیم.
برای تغییر، کافیست فایل کانفیگ را ویرایش کنید و خطوط زیر را تغییر داده یا اضافه کنید:
$_DVWA["SQLI_DB"] = "sqlite";
$_DVWA["SQLITE_DB"] = "sqli.db";به طور پیشفرض از فایل database/sqli.db استفاده میشود. اگر به طور اتفاقی به این فایل آسب زدید، آن را از مبدا database/sqli.db.dist بازنویسی کنید
باقی مسائل همانند مایاسکیوال است با این تفاوت که از SQLite3 بجای آن استفاده کردهایم.
👨💻 مشارکتکنندگان
از تمام مشارکتهایتان و بهروزرسانی این پروژه متشکرم. :heart:
اگر ایدهای، نوعی بهبود یا صرفاً تمایل به همکاری دارید، از مشارکت و حضور در پروژه استقبال میشود، لطفاً PR خود را ارسال کنید.
گزارش آسیبپذیریها
ساده بگم، این کارو نکنید!
سالی یک بار، کسی گزارشی برای آسیبپذیریای که در برنامه پیدا کرده است، ارسال میکند، برخی از آنها به خوبی نوشته شدهاند، گاهی اوقات بهتر از آنچه در گزارشهای تست نفوذ پولی دیدهام، برخی فقط میگویند «هدرها را گم کردهاید، به من پول بدهید».
در سال ۲۰۲۳، این موضوع به سطح کاملاً جدیدی ارتقا یافت، زمانی که کسی تصمیم گرفت برای یکی از آسیبپذیریها درخواست CVE کند، CVE-2023-39848 به او داده شد. کلی سر و صدا به پا شد و وقت زیادی برای اصلاح این موضوع تلف شد.
این برنامه آسیبپذیریهایی دارد، و این عمدی است. اکثر آنها به خوبی مستند شدهاند و شما به عنوان درس روی آنها کار میکنید، بقیه موارد "پنهان" هستند، مواردی که باید خودتان آنها را پیدا کنید. اگر واقعاً میخواهید مهارتهای خود را در یافتن موارد اضافی پنهان نشان دهید، یک پست وبلاگ بنویسید یا یک ویدیو بسازید زیرا احتمالاً افرادی هستند که علاقهمند به یادگیری در مورد آنها و نحوه یافتن آنها توسط شما هستند. اگر لینک را برای ما ارسال کنید، حتی ممکن است آن را در منابع قرار دهیم.
پیوندها
صفحهٔ اصلی پروژه: https://github.com/digininja/DVWA
تهیهشده توسط تیم DVWA
File: README.fr.md
Translation / Traduction
Philibert Gentil:@Philibert-Gentil
Vous pouvez me contacter en cas d'erreur de traduction / d'interprétation.
DAMN VULNERABLE WEB APPLICATION / BORDEL D'APPLICATION WEB VULNÉRABLE
Bordel d'application web vulnérable (BAWV, traduit DVWA) est une application web PHP/MySQL vulnérable. Son but principal est d'être une aide pour les experts en sécurité pour tester leurs compétences et outils dans un environnement légal, aider les développeurs web à mieux comprendre la sécurisation des applications web et d'aider les élèves et professeurs à apprendre la sécurité des applications web dans un environnement d'études.
L'objectif de BAWV est d'expérimenter les vulnérabilités web les plus communes, avec différents niveaux de difficulté, avec une interface intuitive.
Notez qu'il existe des vulnérabilités documentées ou non avec ce programme. C'est intentionnel. Vous êtes encourragés à essayer et découvrir autant de failles que possible.
ATTENTION !
Bordel D'application web vulnérable est vachement vulnérable ! Ne la publiez pas sur le dossier html public de votre hébergeur ni aucun serveur visible sur internet, ou ils seront compromis. Il est recommendé d'utiliser une machine virtuelle (comme VirtualBox ou VMware), réglé sur le mode réseau NAT. Dans une machine invitée, vous pouvez télécharger et installer XAMPP pour le serveur web et la base de données.
Non-responsabilité
Nous ne sommes pas responsables de la manière dont vous utilisez BAWV. Nous avons clairement défini les objectifs de l'application et elle ne dois pas être utilisée de manière malveillante. Nous vous avons averti et avons pris les mesures nécessaires pour informer les utilisateurs de BAWV à propos de son installation sur un serveur. Si votre serveur est compromis à cause d'une installation de BAWV, il n'en découle pas de notre responsabilité, mais de celle de la/les personne(s) qui l'a/ont téléchargé ou installé, envoyé.
License
Ce fichier fait parie du bordel d'application web vulnérable (BAWV)
Bordel d'application web vulnérable (BAWV) est un logiciel libre: vous pouvez le re-distribuer et/ou le modifier en respectant les termes de la licence publique générale GNU (GNU General Public License) tel que publié par
La fondation des logiciels libres (the Free Software Foundation),
soit la troisième version de la licence, soit une version ultérieure.
Bordel d'application web vulnérable (BAWV) est distribué dans l'espoir qu'il vous sera utile,
mais SANS GARANTIE; sans même la garantie implicite de qualité professionnelle ou particulière.
Voyez la license publique générale GNU pour plus de détails.
Vous devriez avoir reçu une copie de la license publique générale GNU
en même temps que le bordel d'application web vulnérable (BAVW). Sinon, consultez https://www.gnu.org/licenses/.
Internationalisation
Ce fichier est disponibles dans diverses langues ci-dessous :
Si vous souhaitez contribuer à la traduction, faite une demande d'extraction (pull request, PR). Par contre, ça ne doit pas être juste du Google Trad, ou ce sera rejeté.
Téléchargement
Même s'il y a diverses versions de BAVW, la seule version soutenue via cette source du dépôt GitHub est celle-ci. Vous pouvez la cloner depuis le dépôt suivant :
git clone https://github.com/digininja/DVWA.gitOu télécharger le fichier zippé.
Installation
Installation Automatisée 🛠️
Remarque : ce n'est pas un script officiel de DVWA, il a été écrit par @IamCarron et est maintenu sur DVWA-Script. Beaucoup d'efforts ont été consacrés à sa création et à sa vérification, mais il est recommandé d'inspecter le script avant de l'exécuter sur votre système. Veuillez signaler tout bogue sur le dépôt DVWA-Script, et non ici.
Un script d'installation automatisée pour DVWA sur les systèmes basés sur Debian (notamment Kali, Ubuntu, Kubuntu, Linux Mint, Zorin OS...). Il installe automatiquement toutes les dépendances requises, configure PHP/Apache et initialise les tables de la base de données prêtes pour la connexion (admin / password).
Remarque : Ce script nécessite les privilèges root et est adapté aux systèmes basés sur Debian. Assurez-vous de l'exécuter en tant qu'utilisateur root.
Prérequis d'installation
- Système d'exploitation : Distributions basées sur Debian (Kali, Ubuntu, Kubuntu, Linux Mint, Zorin OS, etc.)
- Privilèges : Exécuter en tant qu'utilisateur root
Étapes d'installation
En une seule ligne (One-Liner)
Cette commande télécharge le script d'installation écrit par @IamCarron et l'exécute automatiquement :
sudo bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/IamCarron/DVWA-Script/main/Install-DVWA.sh)"Exécution manuelle du script
Téléchargez le script :
shwget https://raw.githubusercontent.com/IamCarron/DVWA-Script/main/Install-DVWA.shRendez le script exécutable :
shchmod +x Install-DVWA.shExécutez-le en tant que root :
shsudo ./Install-DVWA.sh
Soyez sûrs que le fichier config/config.inc.php existe. Avoir le fichier config.inc.php.dist ne suffira pas, vous devrez le modifier par rapport à votre environnement et le renommer config.inc.php. Windows cachera peut-être l'extension
Vidéos d'installation
- (en anglais) Installing DVWA on Kali running in VirtualBox
- (En anglais) Installing Damn Vulnerable Web Application (DVWA) on Windows 10 [12:39 minutes]
Win + XAMPP
La solution la plus facile pour installer BAVW est de télécharger et d'installer XAMPP si vous n'avez pas déjà de serveur web.
XAMPP est une distribution apache pour Linux, Solaris, Windows et MacOS très facile d'installation. Le paquet inclut le serveur web apache, MySQL, PHP, Perl, un serveur FTP et phpMyAdmin.
XAMPP peut être téléchargé depuis :
https://www.apachefriends.org/
Dézippez simplement dvwa.zip, placez le fichier décompressé dans votre fichier HTML public, puis allez avec votre navigateur sur http://localhost/dvwa/setup.php
Paquets Linux
Si vous utilisez une distribution basée sur Debian (Debian, ubuntu, kali, parrot, Rapberry pi OS etc), vous devez installer les paquets suivants (ou leurs équivalents):
- apache2
- libapache2-mod-php
- mariadb-server
- mariadb-client
- php
- php-mysql
- php-gd
- php-mbstring
La commande suivante vous permet de les installer.
apt install apache2 mariadb-server php php-mysqli php-gd php-mbstring libapache2-mod-php
Note: php-mbstring permet de gérer les caractères européens, arabes, caligraphiques et caetera, notamment la table de caractères UTF-8. Ne pas la télécharger pourrait entrainez des problèmes d'affichage si vous n'avez pas un langage germanique comme l'anglais ou l'allemand.
Le site fonctionnera avec MySQL à la place de MariaDB mais nous recommendons fortement MariaDB car cela fonctionne directement, contrairement à MySQL que vous devrez modifier.
Paramétrage de la base de données
Pour créer une base de données (BDD), cliquez simplement sur le bouton Setup DVWA (configurer BAWV) dans le menu principal puis cliquez sur le bouton Create / Reset Database (créez / réinitialisez la BDD). Cela créera / réinitialisera la BDD pour vous avec des données dedans.
Si vous rencontrez une erreur en essayant de créer la BDD, soyez sûrs que les identifiants de la BDD soient corrects dans ./config/config.inc.php. Elles diffèrent de config.inc.php.dist, qui est un fichier bateau.
Les variables sont définies comme ceci par défaut:
$_DVWA[ 'db_server'] = '127.0.0.1'; //l'IP du serveur
$_DVWA[ 'db_port'] = '3306'; //Le port pour accéder à la BDD
$_DVWA[ 'db_user' ] = 'dvwa'; //L'utilisateur de la BDD
$_DVWA[ 'db_password' ] = 'p@ssw0rd'; //Le mdp
$_DVWA[ 'db_database' ] = 'dvwa'; //Le nom de la BDDPS: si vous utilisez MariaDB plutôt que MySQL (MariaDB est là par défaut sur Kali), vous ne pouvez utilisez la BDD en tant que root, vous devez créer un nouvel utilisateur. Pour faire cela, connectez vous à la BDD en tant que super-administrateur (root) dans un terminal et tapez les commandes suivantes:
mysql> create database dvwa; //On crée la BDD
Query OK, 1 row affected (0.00 sec)
mysql> create user dvwa@localhost identified by 'p@ssw0rd'; //On crée l'utilisateur
Query OK, 0 rows affected (0.01 sec)
mysql> grant all on dvwa.* to dvwa@localhost;//On lui donne toute les permissions dans la BDD dvwa
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;//On actualise les privilèges (en gros)
Query OK, 0 rows affected (0.00 sec)Autres configurations
En fonction de votre système d'exploitaiton (SE), tout comme la version de PHP, vous devrez peut-être modifier la configuration initiale. La localisation des fichiers sera éventuellement différente, selon votre machine.
Permissions du fichier
./hackable/uploads/- Doit être disponible en écriture par le serveur web (des fichiers y seront uploadés)../external/phpids/0.6/lib/IDS/tmp/phpids_log.txt- Doit être disponible en écriture par le serveur web (si vous voulez utiliser les PHPIDS).
Configuration PHP
allow_url_include = on- Autorise l'utilisation du gestionnaire des URL par certaines fonctions (RFI) [allow_url_include]allow_url_fopen = on- Autorisation pour l'accès au fichiers (RFI) [allow_url_fopen]safe_mode = off- (Si PHP <= v5.4) Autorise l'injection SQL (SQLi) [safe_mode]magic_quotes_gpc = off- (Si PHP <= v5.4) Autorise l'injection SQL (SQLi) [magic_quotes_gpc]display_errors = off- (Optional) Cache les messages d'avertissement PHP [display_errors]
Fichier: config/config.inc.php:
$_DVWA[ 'recaptcha_public_key' ]&$_DVWA[ 'recaptcha_private_key' ]- Ces valeurs doivent être générées depuis: https://www.google.com/recaptcha/admin/create
Identifiants par défaut
Identifiant par défaut = admin
Clef par défaut = password
... peut être facilement craqué ;)
URL de connection: http://127.0.0.1/login.php
PS: Ce sera différent si vous installez BAWV dans un autre fichier.
Container Docker
Cette section du fichier à été ajouté par @thegrims, pour de l'aide à propos d'erreurs docker, veuillez le contacter ou contactez @opsxcq, qui est le maître du dépôt et de l'image docker. Un signalement d'erreur lui sera sûrement adressé et celle-ci sera collematée
- page dockerhub
docker run --rm -it -p 80:80 vulnerables/web-dvwa
Soyez sûrs d'utiliser AUFS à cause d'erreurs antérieurs de MySQL. Lancez docker info pour vérifier le stockage de votre lecteur. Si il n'est pas en AUFS, veuillez le changer. Il y a un manuel pour chaque SE (OS), mais il sont tellement différents que nous n'aborderons pas ce sujet.
Construction locale
Si vous avez fais des changements et voulez construire le projet à partir de votre version locale, editez le fichier compose.yml et changez pull_policy: always par pull_policy: build.
Exécuter la commande docker compose up -d va déclancher Docker à construire une image à partir de votre version locale, sans regard sur ce qui est disponible dans le registre.
Pour plus d'informations (En anglais): pull_policy.
Servir les fichiers locaux
Si vous faites des changements et ne voulez pas avoir à reconstruire l'image après chaque changement :
- Éditer le fichier
compose.ymlet décommenter :text# volumes: # - ./:/var/www/html - Exécuter
cp config/config.inc.php.dist config/config.inc.phppour copier le fichier de configuration par défaut. - Exécuter
docker compose up -det les changements au fichiers locaux seront réfléchies sur le conteneur.
Dépannage
Nous considérons que vous êtes sur une distribution basée sur Debian, comme Debian, Ubuntu, Kali ou Raspberry pi OS. Pour les autres distributions, suivez les instructions en adaptant les commandes à votre distribution.
Le site me donne une erreur 404
Si vous avez ce problème, vous devez comprendre la localistaion des fichiers. Par défaut, le fichier racine apache (l'endroit où il cherche le contenu du site) est /var/www/html. Si vous mettez un fichier nommé salut.txt dans ce dossier, vous devrez, pour y accéder, noter http://localhost/salut.txt.
Si vous créer un dossier et que vous y mettez un fichier - /var/www/html/mondossier/salut.txt - vous devrez écrire http://localhost/mondossier/salut.txt.
Linux est sensible à la casse (par exemps, "é" n'est pas la même lettre que "e"; et "E" n'est pas lettre que "e"), donc vous pourriez tomber sur un 404 si vous n'y prenez pas garde.
Les URL suivantes vous donneront une erreur 404 :
http://localhost/MonDossier/salut.txthttp://localhost/mondossier/Salut.txthttp://localhost/MONDOSSIER/salut.txt
Pourquoi cela affecte BAWV ? La plupart des gens utilisent Git intégrer BAWV dans leur répertoire /var/www/html, cela leur donne donc le chemin /var/www/html/DVWA avec tous les fichiers de BAWV dedans. Du coup si vous cherchez http://localhost/ ça vous retourne une erreur 404, ou la page par défaut d'apache. Comme les fichiers sont dans le dossier DVWA, ous devez rechercher http://localhost/DVWA/.
L'autre erreur commune est de rechercher http://localhost/dvwa ce qui retourne une erreur 404 parce que dvwa n'est pas pareil que DVWA, à cause de la casse.
Après la configuration, si vous obtenez une erreur 404, pensez à là où vous avez enregistré vos fichiers, qui est accessible par un chemin relatif, et quelle est l'orthographe des dossiers dans lesquels il se situe.
"Accès refusé" pendant la configuration
Si vous avez l'erreur suivante en exécutant le programme de configuration, cela veut dire que l'ID et la clef que vous avez défini ne correspond pas à celle de la BDD.
Database Error #1045: Access denied for user 'nimporte'@'localhost' (using password: YES).
//signifie: "Erreur de la BDD #1045: accès refusé pour l'utilisateur 'nimporte'@'localhost' (utilise un mdp: OUI)"Cette erreur signifie que vous utilisez le nom d'utilisateur nimporte.
L'erreur suivante dit que vous demandez une mauvaise base de donnée.
SQL: Access denied for user 'dvwa'@'localhost' to database 'notdvwa'
//signifie : "SQL: Accès refusé pour l'utilisateur 'dvwa'@'localhost' à la BDD `nimporte`."Ça dit que vous vous connectez en tant que dvwa et que vous essayez de vous connecter à la BDD nimporte.
La première chose à faire est de revérifier ce que vous avez renseigné dans le fichier de configuration.
Si les informations semblent être correctes, la chose à revérifier est de regarder les journaux systèmes à propos de l'utilisateur en ligne de commande. Considérons que vous avez une BDD dénominée dvwa et un mot de passe p@ssw0rd, lancez la commande suivante.
mysql -u dvwa -p -D dvwa
//puis tapez votre mot de passe dans le champ qui apparaîtSi le texte suivant apparaît (peut varier), les identifiants sont corrects:
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]>Puisque vous pouvez vous connecter en ligne de commande, il y a quelque chose qui cloche dans le fichier de configuration, re-vérifiez-le et signaler nus une erreur si vous n'arrivez pas à la trouver (sur github).
Si le texte qui est apparu est le suivant, les identifiants sont incorrects. Répétez la [configuration de la base de données](#Paramétrage de la base de données) et soyez sûrs d'utiliser toujours les même identifiants durant la procédure.
ERROR 1045 (28000): Access denied for user 'dvwa'@'localhost' (using password: YES)
//signifie: "Erreur 1045 (28000): Accès refusé pour l'utilisateur 'dvwa'@'localhost' (clé renseignée: OUI)"Si vous obtenez l'erreur suivante, les identifiants sont corrects mais l'utilisateur n'a pas accès à la database.
Réitérez aussi le paramétrage de la base de données et vérifiez le nom de la base de données.
ERROR 1044 (42000): Access denied for user 'dvwa'@'localhost' to database 'dvwa'
//signifie: "Erreur 1044 (42000): Accès refusé pour l'utilisateur 'dvwa'@'localhost' à la BDD 'dvwa'."La dèrnière erreur peut être celle-ci:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)Ça n'est pas une erreur d'authentification, c'est juste que le système de gestion de la BDD n'est pas activée. Démarrez-le en tapant :
sudo service mysql startMéthode d'identification inconnue
Avec les versions les plus récentes de MySQL, PHP ne peut plus échanger avec la BDD dans sa configuration initiale. Si vous obtenez cette erreur, c'est que vous possédez cette configuration :(.
Database Error #2054: The server requested authentication method unknown to the client.
//Signification: "Erreur de BDD #2045: la méthode authentification utilisée est inconnue."Vous avez deux options, la première étant de désinstaller MySQL et d'installez MariaDB. Ce lien vous envoie vers le manuel officiel de MariaDB.
https://mariadb.com/resources/blog/how-to-migrate-from-mysql-to-mariadb-on-linux-in-five-steps/ (en anglais)
Sinon, suivez ces étapes:
- En tant que root, éditez le fichier
/etc/mysql/mysql.conf.d/mysqld.cnf - sous la ligne
[mysqld], ajoutezdefault-authentication-plugin=mysql_native_password - redémarrez MySQL:
sudo service mysql restart - Vérifiez le méthode de connexion pour votre utilisateur:sql
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) - Vous verrez probablement
caching_sha2_password. Si c'est le cas, tapez:sqlmysql> ALTER USER dvwa@localhost IDENTIFIED WITH mysql_native_password BY 'p@ssw0rd'; - Relancez la vérification, vous devriez voir
mysql_native_password.sqlmysql> 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)
Après tout ça, le processus de configuration devrait fonctionner.
Pour plus d'infos, voyez: https://www.php.net/manual/fr/mysqli.requirements.php.
Database Error #2002: No such file or directory.
Le serveur de BDD est inactif. Sur une distro basée Debian, tapez:
sudo service mysql startErreurs "MySQL server has gone away" et "Packets out of order"
Vous pourriez rencontrer cette erreur pour maintes raisons, mais la plus plausible est que la version de votre SGBDD est incompatible avec PHP.
Cela ce produit généralement quand vous utilisez la dernière version de MySQL, mais pas de PHP et que ça ne foncitonne pas oufement bien. Notre meilleur conseil est de désinstaller MySQL et d'installer MariaDB, sinon nous ne pouvons pas vous aider.
L'injection de commande ne fonctionne pas
Apache n'a peut être pas assez de privilèges sur le serveur web. Si vous utilisez BAWV sur linux, veillez à être connecté en tant que root et sous windows, en tant qu'administrateur.
Pourquoi ne puis-je pas me connecter à ma BDD sous CentOS
Vous avez sûrement des prolèmes avec SELinux. Désinstaller SELinux ou lancez cette commande pour autoriser le serveur web à discutter avec la base de donnée:
setsebool -P httpd_can_network_connect_db 1Autre chose
Si vous avez besoin d'aide, lisez les rapports d'erreurs ouvert et/ou fermés dans le dépôt git:
https://github.com/digininja/DVWA/issues
Avant d'envoyer un rapport, soyez-sûr que vous utilisez la dernière version du code du dépôt. Pas que la dernière version, mais aussi les derniers codes de la branche maîtresse (master).
Si vous envoyez un rapport, renseignez ces informations:
- Système d'exploitation
- Les cinq dernières lignes du journal (log) du serveur web juste après la déclaration de votre erreur
- Si c'est un problème de connection à la base de données, effectuées les étapes renseignées au dessus et faites une capture d'écran de chacune d'entre elles, et du fichier de configuration contenant vos identifiants.
- une description détaillée de ce qui ne va pas, ce que vous éspèreriez qu'il arrive, et comment vous avez essayé de résoudre le problème. "problème de connection" n'est pas assez détaillé pour nous aidez à résoudre votre problème.
Injection SQL SQLite3
Le support pour cette section est limitée, avant d'envoyer un rapport d'erreur, soyez préparé à faire un déboguage, ne déclarez pas juste "ça marche pas !".
Par défaut, SQLi et Blind SQLi sont exécutés sur les serveurs MariaDB/MySQL utilisés par le site mais il est possible de basculer vers des tests SQLi sur SQLite3 à la place.
Je ne vais pas vous montrer comment fonctionne SQLite3 avec PHP, mais juste un exemple d'installation de php-sqlite3 et d'être sûr qu'il soit actif.
Pour faire ce changement éditez le fichier de configuration et éditez ces lignes:
$_DVWA["SQLI_DB"] = "sqlite";
$_DVWA["SQLITE_DB"] = "sqli.db";Par défaut, ça utilise le fichier database/sqli.db, si vous vous gourrez, copiez database/sqli.db.dist par dessus.
Le challenge est le même pour MySQL, il sont juste antagoniste à SQLite3.
Liens
Dépôt GitHub: https://github.com/digininja/DVWA
Créé par l'équipe BAWV.
File: README.id.md
DAMN VULNERABLE WEB APPLICATION / APLIKASI WEB YANG RENTAN TERHADAP ANCAMAN
Damn Vulnerable Web Application (DVWA) atau yang dapat diartikan sebagai Aplikasi Web Yang Rentan Terhadap Ancaman merupakan aplikasi web berbasis PHP/MySQL yang sangat rentan.
Tujuan utamanya adalah menjadi alat bantu bagi para profesional keamanan untuk menguji keterampilan dan alat mereka dalam lingkungan hukum.
DVWA juga bertujuan membantu pengembang web memahami proses pengamanan aplikasi web serta memberikan dukungan bagi siswa dan guru untuk mempelajari keamanan aplikasi web dalam lingkungan kelas yang terkendali.
Tujuan dari DVWA adalah melatih pengguna dalam menghadapi beberapa kerentanan web paling umum dengan berbagai tingkat kesulitan, yang disajikan melalui antarmuka yang sederhana dan langsung. Harap dicatat bahwa ada kerentanan yang didokumentasikan dan tidak didokumentasikan dalam perangkat lunak ini. Hal ini sengaja dilakukan untuk mendorong pengguna mencoba dan menemukan sebanyak mungkin masalah.
PERINGATAN
Damn Vulnerable Web Application sangat rentan! Jangan mengunggahnya ke folder html publik penyedia hosting Anda atau server yang terhubung langsung ke internet karena dapat mengakibatkan kompromi keamanan.
Disarankan untuk menggunakan mesin virtual (seperti VirtualBox atau VMware), yang diatur dalam mode jaringan NAT.
Di dalam mesin virtual, Anda dapat mengunduh dan menginstal XAMPP untuk web server dan database.
Penyangkalan
Kami tidak bertanggung jawab atas cara penggunaan aplikasi ini (DVWA) oleh siapa pun.
Tujuan dari aplikasi ini telah kami jelaskan dan seharusnya tidak digunakan dengan niat jahat.
Kami telah memberikan peringatan dan mengambil langkah-langkah untuk mencegah pengguna menginstal DVWA di server web aktif secara langsung.
Jika server web Anda terpengaruh melalui instalasi DVWA, itu bukan tanggung jawab kami melainkan tanggung jawab orang/orang yang mengunggah dan menginstalnya.
Lisensi
Berkas ini merupakan bagian dari Damn Vulnerable Web Application (DVWA).
Damn Vulnerable Web Application (DVWA) adalah perangkat lunak bebas: Anda dapat mendistribusikannya dan/atau mengubahnya
sesuai dengan ketentuan Lisensi Umum GNU yang diterbitkan oleh
Free Software Foundation, versi 3 Lisensi, atau
(pilihan Anda) versi selanjutnya.
Damn Vulnerable Web Application (DVWA) didistribusikan dengan harapan akan bermanfaat,
tetapi TANPA GARANSI APA PUN; tanpa garansi tersirat pun
DAGANG atau SESUAI UNTUK TUJUAN TERTENTU. Lihat
Lisensi Umum GNU untuk lebih banyak detail.
Anda seharusnya telah menerima salinan Lisensi Umum GNU bersama dengan Damn Vulnerable Web Application (DVWA). Jika tidak, lihat https://www.gnu.org/licenses/.
Internasionalisasi
Berkas ini tersedia dalam beberapa bahasa:
- Arab: العربية
- Tiongkok: 简体中文
- Perancis: Français
- Persia: فارسی
- Portugis: Português
- Spanyol: Español
- Turki: Türkçe
- Indonesia: id
Jika Anda ingin berkontribusi dengan terjemahan, silakan kirimkan PR (Permintaan Tarik).
Namun perlu diperhatikan, ini bukan berarti hanya menjalankannya melalui Google Translate dan mengirimkannya, karena itu akan ditolak.
Kirimkan versi terjemahan Anda dengan menambahkan file baru 'README.xx.md' di mana xx adalah kode dua huruf dari bahasa yang Anda inginkan (berdasarkan ISO 639-1).
Unduh
Meskipun terdapat berbagai versi DVWA, satu-satunya versi yang didukung adalah sumber terbaru dari repositori resmi GitHub.
Anda dapat mengklonnya dari repositori:git clone https://github.com/digininja/DVWA.git
Atau unduh arsip ZIP dari file-file.
Instalasi
Instalasi Otomatis 🛠️
Catatan: ini bukan skrip resmi DVWA, skrip ini ditulis oleh @IamCarron dan dikelola di DVWA-Script. Banyak upaya dilakukan untuk membuat dan memverifikasinya, namun disarankan untuk meninjau skrip sebelum menjalankannya di sistem Anda. Harap laporkan bug apa pun ke repositori DVWA-Script, bukan di sini.
Skrip instalasi otomatis untuk DVWA pada sistem berbasis Debian (termasuk Kali, Ubuntu, Kubuntu, Linux Mint, Zorin OS...). Skrip ini menginstal semua dependensi yang diperlukan, mengonfigurasi PHP/Apache, dan secara otomatis menginisialisasi tabel database siap untuk login (admin / password).
Catatan: Skrip ini memerlukan hak akses root dan disesuaikan untuk sistem berbasis Debian. Pastikan Anda menjalankannya sebagai pengguna root.
Persyaratan Instalasi
- Sistem Operasi: Sistem berbasis Debian (Kali, Ubuntu, Kubuntu, Linux Mint, Zorin OS, dll.)
- Hak Akses: Jalankan sebagai pengguna root
Langkah-langkah Instalasi
Satu Baris (One-Liner)
Perintah ini akan mengunduh skrip instalasi yang ditulis oleh @IamCarron dan menjalankannya secara otomatis:
sudo bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/IamCarron/DVWA-Script/main/Install-DVWA.sh)"Menjalankan Skrip Secara Manual
Unduh skrip:
shwget https://raw.githubusercontent.com/IamCarron/DVWA-Script/main/Install-DVWA.shBeri izin eksekusi pada skrip:
shchmod +x Install-DVWA.shJalankan sebagai root:
shsudo ./Install-DVWA.sh
Video Instalasi
- Instalasi DVWA di Kali yang berjalan di VirtualBox
- Instalasi DVWA di Windows menggunakan XAMPP
- Instalasi Damn Vulnerable Web Application (DVWA) di Windows 10
Windows + XAMPP
Cara paling mudah untuk menginstal DVWA adalah dengan mengunduh dan menginstal XAMPP jika Anda belum memiliki pengaturan server web.
XAMPP adalah Distribusi Apache yang sangat mudah diinstal untuk Linux, Solaris, Windows, dan Mac OS X. Paket ini mencakup server web Apache, MySQL, PHP, Perl, server FTP, dan phpMyAdmin.
Video ini memandu Anda melalui proses instalasi untuk Windows, tetapi seharusnya serupa untuk OS lainnya.
Docker
Terima kasih kepada hoang-himself dan JGillam, setiap commit ke cabang master menyebabkan pembangunan Docker image dan siap untuk diunduh dari GitHub Container Registry.
Untuk informasi lebih lanjut tentang apa yang Anda dapatkan, Anda dapat menjelajahi Docker images yang sudah dibangun sebelumnya.
Memulai
Prasyarat: Docker dan Docker Compose.
- Jika Anda menggunakan Docker Desktop, keduanya seharusnya sudah terinstal.
- Jika Anda lebih memilih Docker Engine di Linux, pastikan untuk mengikuti panduan instalasi mereka.
Kami memberikan dukungan untuk rilis Docker terbaru seperti yang ditunjukkan di atas.
Jika Anda menggunakan Linux dan paket Docker yang disertakan dengan pengelola paket Anda, kemungkinan besar juga akan berfungsi, tetapi dukungan akan berusaha sebaik mungkin.
Memperbarui Docker dari versi paket manajer ke upstream memerlukan penghapusan versi lama seperti yang terlihat dalam panduan mereka untuk Ubuntu, Fedora, dan lainnya.
Data Docker Anda (container, gambar, volume, dll.) seharusnya tidak terpengaruh, tetapi jika Anda mengalami masalah, pastikan untuk memberi tahu Docker dan gunakan mesin pencari dalam waktu yang bersamaan.
Kemudian, untuk memulai:
Jalankan
docker versiondandocker compose versionuntuk melihat apakah Docker dan Docker Compose terinstal dengan benar. Anda seharusnya dapat melihat versi mereka dalam output.Contoh:
text>>> 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.3Jika Anda tidak melihat apa-apa atau mendapatkan pesan kesalahan "command not found" ikuti prasyarat untuk menyiapkan Docker dan Docker Compose.
Klon atau unduh repositori ini dan ekstrak (lihat Unduh).
Buka terminal pilihan Anda dan ubah direktori kerjanya ke dalam folder ini (
DVWA).Jalankan
docker compose up -d.
DVWA sekarang tersedia di http://localhost:4280.
Perhatikan bahwa untuk menjalankan DVWA dalam kontainer, server web mendengarkan port 4280 daripada port biasa 80.
Untuk informasi lebih lanjut mengenai keputusan ini, lihat Saya ingin menjalankan DVWA di port yang berbeda.
Pembangunan Lokal
Jika Anda melakukan perubahan lokal dan ingin membangun proyek dari lokal, buka compose.yml dan ubah pull_policy: always menjadi pull_policy: build.
Menjalankan docker compose up -d seharusnya akan memicu Docker untuk membangun gambar dari lokal tanpa memperdulikan apa yang tersedia di registri.
Lihat juga: pull_policy.
Paket-paket Linux
Jika Anda menggunakan distribusi Linux berbasis Debian, Anda perlu menginstal paket-paket berikut (atau yang setara):
- apache2
- libapache2-mod-php`
- mariadb-server
- mariadb-client
- php php-mysqli
- php-gd
Saya sarankan melakukan pembaruan sebelumnya, agar Anda memastikan mendapatkan versi terbaru dari semuanya.
apt update
apt install -y apache2 mariadb-server mariadb-client php php-mysqli php-gd libapache2-mod-phpSitus akan berfungsi dengan MySQL alih-alih MariaDB, tetapi kami sangat menyarankan MariaDB karena berfungsi tanpa masalah sedangkan Anda harus melakukan perubahan agar MySQL dapat berfungsi dengan benar.
Konfigurasi
Berkas Konfigurasi
DVWA disertakan dengan salinan palsu dari berkas konfigurasinya yang perlu Anda salin dan lakukan perubahan yang sesuai. Pada Linux, bila Anda berada di direktori DVWA, langkah ini dapat dilakukan seperti berikut:
cp config/config.inc.php.dist config/config.inc.php
Pada Windows, langkah ini mungkin sedikit lebih sulit jika ekstensi file disembunyikan. Jika Anda tidak yakin mengenai hal ini, blog post berikut menjelaskan lebih lanjut:
Cara Membuat Windows Menampilkan Ekstensi File
Pengaturan Database
Untuk mengatur database, cukup klik tombol Setup DVWA di menu utama, kemudian klik tombol Create / Reset Database. Ini akan membuat/mereset database untuk Anda dengan beberapa data di dalamnya.
Jika Anda menerima pesan kesalahan saat mencoba membuat database Anda, pastikan kredensial database Anda benar dalam ./config/config.inc.php. Ini berbeda dari config.inc.php.dist, yang merupakan berkas contoh.
Variabel-variabelnya diatur secara default sebagai berikut:
$_DVWA['db_server'] = '127.0.0.1';
$_DVWA['db_port'] = '3306';
$_DVWA['db_user'] = 'dvwa';
$_DVWA['db_password'] = 'p@ssw0rd';
$_DVWA['db_database'] = 'dvwa';Perhatikan, jika Anda menggunakan MariaDB daripada MySQL (MariaDB adalah default di Kali), maka Anda tidak dapat menggunakan pengguna root database, Anda harus membuat pengguna database baru. Untuk melakukannya, sambungkan ke database sebagai pengguna root kemudian gunakan perintah-perintah berikut:
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)Menonaktifkan Otentikasi
Beberapa alat tidak berfungsi dengan baik dengan otentikasi sehingga tidak dapat digunakan dengan DVWA. Untuk mengatasi ini, ada opsi konfigurasi untuk menonaktifkan pemeriksaan otentikasi. Untuk melakukannya, cukup atur yang berikut dalam berkas konfigurasi:
$_DVWA['disable_authentication'] = true;Anda juga perlu mengatur tingkat keamanan ke tingkat yang sesuai dengan pengujian yang ingin Anda lakukan:
$_DVWA['default_security_level'] = 'low';Dalam kondisi ini, Anda dapat mengakses semua fitur tanpa perlu masuk dan mengatur cookie apapun.
Izin Folder
./hackable/uploads/- Perlu dapat ditulisi oleh layanan web (untuk Unggahan File).
Konfigurasi PHP
Pada sistem Linux, kemungkinan ditemukan di /etc/php/x.x/fpm/php.ini atau /etc/php/x.x/apache2/php.ini.
Untuk mengizinkan Remote File Inclusions (RFI):
allow_url_include = on[allow_url_include]allow_url_fopen = on[allow_url_fopen]
Untuk memastikan PHP menampilkan semua pesan kesalahan:
display_errors = on[display_errors]display_startup_errors = on[display_startup_errors]
Pastikan Anda me-restart layanan php atau Apache setelah melakukan perubahan.
reCAPTCHA
Ini hanya diperlukan untuk lab "Insecure CAPTCHA", jika Anda tidak bermain dengan lab tersebut, Anda dapat mengabaikan bagian ini.
Buat sepasang kunci API dari https://www.google.com/recaptcha/admin/create.
Kemudian masukkan kunci-kunci tersebut ke bagian-bagian berikut di dalam ./config/config.inc.php:
$_DVWA['recaptcha_public_key']$_DVWA['recaptcha_private_key']
Kredensial Default
Username default = admin
Password default = password
...dapat dengan mudah di-brute force ;)
URL Login: http://127.0.0.1/login.php
Catatan: Ini akan berbeda jika Anda menginstal DVWA ke direktori yang berbeda.
Pemecahan Masalah
Asumsi ini berlaku jika Anda menggunakan distribusi berbasis Debian, seperti Debian, Ubuntu, dan Kali. Untuk distribusi lainnya, ikuti langkah-langkah ini, tetapi perbarui perintah sesuai kebutuhan.
Kontainer
Saya ingin mengakses log
Jika Anda menggunakan Docker Desktop, log dapat diakses dari aplikasi grafis.
Beberapa detail kecil mungkin berubah dengan versi terbaru, tetapi metode akses seharusnya tetap sama.
Log juga dapat diakses dari terminal.
Buka terminal dan ubah direktori kerjanya ke DVWA.
Tampilkan log yang telah digabungkan.
textdocker compose logsJika Anda ingin mengekspor log ke file, misalnya
dvwa.logtextdocker compose logs >dvwa.log
Saya ingin menjalankan DVWA di port yang berbeda
Kami tidak menggunakan port 80 secara default karena beberapa alasan:
- Beberapa pengguna mungkin sudah menjalankan sesuatu di port 80.
- Beberapa pengguna mungkin menggunakan mesin kontainer tanpa hak istimewa (seperti Podman), dan 80 adalah port yang memerlukan hak istimewa (< 1024). Konfigurasi tambahan (misalnya, pengaturan
net.ipv4.ip_unprivileged_port_start) diperlukan, tetapi Anda harus melakukan penelitian sendiri.
Anda dapat mengekspos DVWA di port yang berbeda dengan mengubah ikatan port dalam berkas compose.yml.
Sebagai contoh, Anda dapat mengubah
ports:
- 127.0.0.1:4280:80Menjadi
ports:
- 127.0.0.1:8806:80DVWA sekarang dapat diakses di http://localhost:8806.
DVWA Mulai Otomatis Saat Docker Berjalan
Berkas compose.yml yang disertakan secara otomatis menjalankan DVWA dan basis data ketika Docker berjalan.
Untuk menonaktifkan ini, Anda dapat menghapus atau mengomentari baris restart: unless-stopped dalam berkas compose.yml.
Jika Anda ingin menonaktifkan perilaku ini secara sementara, Anda dapat menjalankan docker compose stop, atau menggunakan Docker Desktop, temukan dvwa dan klik Stop.
Selain itu, Anda dapat menghapus kontainer atau menjalankan docker compose down.
Berkas Log
Pada sistem Linux, Apache secara default menghasilkan dua berkas log, access.log dan error.log, dan pada sistem berbasis Debian biasanya berada di /var/log/apache2/.
Ketika mengirimkan laporan kesalahan, masalah, atau hal lainnya, harap sertakan setidaknya lima baris terakhir dari masing-masing berkas ini. Pada sistem berbasis Debian, Anda dapat mendapatkannya seperti ini:
tail -n 5 /var/log/apache2/access.log /var/log/apache2/error.logSaya mencoba membuka situs dan mendapatkan 404
Jika Anda mengalami masalah ini, Anda perlu memahami lokasi berkas. Secara default, root dokumen Apache (tempat mulai mencari konten web) adalah /var/www/html. Jika Anda meletakkan berkas hello.txt di direktori ini, untuk mengaksesnya, Anda akan membuka http://localhost/hello.txt.
Jika Anda membuat direktori dan meletakkan berkas di dalamnya - /var/www/html/mydir/hello.txt - Anda kemudian perlu membuka http://localhost/mydir/hello.txt.
Linux secara default bersifat case-sensitive, sehingga dalam contoh di atas, jika Anda mencoba membuka salah satu dari ini, Anda akan mendapatkan 404 Not Found:
http://localhost/MyDir/hello.txthttp://localhost/mydir/Hello.txthttp://localhost/MYDIR/hello.txt
Bagaimana ini memengaruhi DVWA? Kebanyakan orang menggunakan git untuk mengecek DVWA ke dalam /var/www/html, ini memberi mereka direktori /var/www/html/DVWA/ dengan semua berkas DVWA di dalamnya. Mereka kemudian membuka http://localhost/ dan mendapatkan entah 404 atau halaman selamat datang Apache default. Karena berkas berada di DVWA, Anda harus membuka http://localhost/DVWA.
Kesalahan umum lainnya adalah membuka http://localhost/dvwa yang akan memberikan 404 karena dvwa bukanlah DVWA yang dianggap oleh pencocokan direktori Linux.
Jadi setelah instalasi, jika Anda mencoba mengunjungi situs dan mendapatkan 404, pertimbangkan di mana Anda menginstal berkas tersebut, di mana berkas tersebut relatif terhadap root dokumen, dan apa huruf kecil dan besar dari direktori yang Anda gunakan.
"Access denied" saat menjalankan setup
Jika Anda melihat pesan berikut saat menjalankan skrip setup, itu berarti nama pengguna atau kata sandi dalam berkas konfigurasi tidak sesuai dengan yang dikonfigurasi pada basis data:
Database Error #1045: Access denied for user 'notdvwa'@'localhost' (using password: YES).Error ini memberi tahu Anda bahwa Anda menggunakan nama pengguna notdvwa.
Error berikut mengatakan bahwa Anda telah menunjuk berkas konfigurasi ke basis data yang salah.
SQL: Access denied for user 'dvwa'@'localhost' to database 'notdvwa'Ini mengatakan bahwa Anda menggunakan pengguna dvwa dan mencoba terhubung ke basis data notdvwa.
Hal pertama yang harus dilakukan adalah memeriksa kembali apakah yang Anda kira telah dimasukkan ke dalam berkas konfigurasi sesuai dengan yang sebenarnya ada di sana.
Jika sesuai dengan harapan Anda, langkah berikutnya adalah memeriksa apakah Anda dapat masuk sebagai pengguna tersebut melalui baris perintah. Mengasumsikan Anda memiliki pengguna basis data dvwa dan kata sandi p@ssw0rd, jalankan perintah berikut:
mysql -u dvwa -pp@ssw0rd -D dvwaCatatan: Tidak ada spasi setelah -p
Jika Anda melihat yang berikut, kata sandi sudah benar:
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]>Seiring terhubung melalui baris perintah, kemungkinan ada kesalahan dalam berkas konfigurasi. Periksa kembali dan laporkan masalah jika Anda masih belum bisa membuat semuanya berfungsi.
Jika Anda melihat yang berikut, nama pengguna atau kata sandi yang Anda gunakan salah. Ulangi langkah-langkah Database Setup dan pastikan Anda menggunakan nama pengguna dan kata sandi yang sama sepanjang proses.
ERROR 1045 (28000): Access denied for user 'dvwa'@'localhost' (using password: YES)Jika Anda mendapatkan yang berikut, kredensial pengguna benar tetapi pengguna tidak memiliki akses ke basis data. Sekali lagi, ulangi langkah-langkah setup dan periksa nama basis data yang Anda gunakan.
ERROR 1044 (42000): Access denied for user 'dvwa'@'localhost' to database 'dvwa'Kesalahan yang mungkin Anda dapatkan adalah ini:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)Ini bukan masalah otentikasi tetapi memberi tahu Anda bahwa server basis data tidak berjalan. Mulailah dengan perintah berikut:
sudo service mysql startMetode otentikasi tidak dikenal
Dengan versi MySQL terbaru, PHP tidak lagi dapat berkomunikasi dengan basis data dalam konfigurasi default. Jika Anda mencoba menjalankan skrip setup dan mendapatkan pesan berikut, itu berarti Anda memiliki konfigurasi.
Database Error #2054: The server requested authentication method unknown to the client.Anda memiliki dua pilihan, yang paling mudah adalah menghapus MySQL dan menginstal MariaDB. Berikut adalah panduan resmi dari proyek MariaDB:
https://mariadb.com/resources/blog/how-to-migrate-from-mysql-to-mariadb-on-linux-in-five-steps/
Sebagai alternatif, ikuti langkah-langkah berikut:
Sebagai root, edit berkas berikut:
/etc/mysql/mysql.conf.d/mysqld.cnfDi bawah baris [mysqld], tambahkan baris berikut:
default-authentication-plugin=mysql_native_passwordRestart database:
sudo service mysql restartPeriksa metode autentikasi untuk pengguna database Anda:
sqlmysql> 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)Kemungkinan besar Anda akan melihat
caching_sha2_password. Jika ya, jalankan perintah berikut:sqlmysql> ALTER USER dvwa@localhost IDENTIFIED WITH mysql_native_password BY 'p@ssw0rd';Menjalankan pemeriksaan ulang, seharusnya sekarang Anda akan melihat
mysql_native_password.sqlmysql> 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)
Setelah semua langkah tersebut, proses penyiapan seharusnya sekarang berjalan dengan normal.
Jika Anda ingin informasi lebih lanjut, lihat halaman berikut: https://www.php.net/manual/en/mysqli.requirements.php.
Database Error #2002: Tidak ada file atau direktori yang sesuai.
Server database tidak berjalan. Pada distribusi berbasis Debian, ini dapat dilakukan dengan perintah:
sudo service mysql startErrors "MySQL server has gone away" and "Packets out of order"
Ada beberapa alasan mengapa Anda bisa mendapatkan kesalahan ini, tetapi yang paling mungkin adalah versi server basis data yang Anda jalankan tidak kompatibel dengan versi PHP.
Ini biasanya terjadi ketika Anda menjalankan versi terbaru MySQL yang tidak selaras dengan PHP. Saran terbaik, ganti MySQL dengan menginstal MariaDB, karena ini bukan sesuatu yang dapat kami dukung.
Untuk informasi lebih lanjut, lihat:
https://www.ryadel.com/en/fix-mysql-server-gone-away-packets-order-similar-mysql-related-errors/
Perintah Injection tidak bekerja
Apache mungkin tidak memiliki hak istimewa yang cukup untuk menjalankan perintah pada server web. Jika Anda menjalankan DVWA di bawah Linux, pastikan Anda masuk sebagai root. Di bawah Windows, masuk sebagai Administrator.
Database tidak terhubung pada CentOS?
Anda mungkin mengalami masalah dengan SELinux. Matikan SELinux atau jalankan perintah berikut untuk mengizinkan web server berkomunikasi dengan basis data:
setsebool -P httpd_can_network_connect_db 1Yang lainnya
Untuk informasi pemecahan masalah terbaru, harap baca masalah terbuka dan yang sudah ditutup di repositori Git:
https://github.com/digininja/DVWA/issues
Sebelum mengajukan tiket, pastikan Anda menjalankan versi terbaru kode dari repositori. Ini bukan versi terbaru yang dirilis, tetapi kode terbaru dari cabang master.
Jika Anda mengajukan tiket, harap kirimkan setidaknya informasi berikut:
- Sistem Operasi
- 5 baris terakhir dari log kesalahan server web segera setelah kesalahan yang Anda laporkan terjadi
- Jika ini adalah masalah otentikasi basis data, ikuti langkah-langkah di atas dan tangkap layar setiap langkah. Kirimkan ini bersama dengan tangkapan layar bagian file konfigurasi yang menunjukkan pengguna dan kata sandi basis data.
- Deskripsi lengkap tentang apa yang salah, apa yang Anda harapkan terjadi, dan apa yang sudah Anda coba lakukan untuk memperbaikinya. "login broken" tidak cukup bagi kami untuk memahami masalah Anda dan membantu memperbaikinya.
Panduan
Saya akan mencoba membuat beberapa video tutorial yang menguraikan beberapa kerentanan dan menunjukkan cara mendeteksinya, dan kemudian bagaimana cara mengeksploitasi mereka. Berikut adalah yang sudah saya buat sejauh ini:
Finding and Exploiting Reflected XSS
SQLite3 SQL Injection
Dukungan untuk ini terbatas, sebelum mengajukan masalah, pastikan Anda siap untuk melakukan debug, jangan hanya mengklaim "tidak berfungsi".
Secara default, SQLi dan Blind SQLi dilakukan terhadap server MariaDB/MySQL yang digunakan oleh situs, tetapi memungkinkan untuk beralih untuk melakukan pengujian SQLi terhadap SQLite3.
Saya tidak akan membahas cara menggunakan SQLite3 dengan PHP, tetapi seharusnya cukup mudah dengan menginstal paket php-sqlite3 dan memastikan bahwa paket tersebut diaktifkan.
Untuk beralih, cukup edit file konfigurasi dan tambahkan atau edit baris-baris berikut:
$_DVWA["SQLI_DB"] = "sqlite";
$_DVWA["SQLITE_DB"] = "sqli.db";Secara default, program ini menggunakan file database/sqli.db. Jika Anda mengalami kesalahan, cukup salin file database/sqli.db.dist di atasnya.
Tantangannya sama persis seperti untuk MySQL, hanya saja dijalankan dengan menggunakan SQLite3.
👨💻 Kontributor
Terima kasih atas semua kontribusi Anda dan menjaga proyek ini tetap terkini. :heart:
Jika Anda memiliki ide, jenis perbaikan, atau hanya ingin berkolaborasi, Anda dipersilakan untuk berkontribusi dan berpartisipasi dalam Proyek ini. Jangan ragu untuk mengirimkan permintaan tautan (PR) Anda.
Tautan
Beranda Proyek: https://github.com/digininja/DVWA
Dibuat oleh tim DVWA
File: README.it.md
DAMN VULNERABLE WEB APPLICATION
Damn Vulnerable Web Application (DVWA) è un'applicazione web PHP/MariaDB che è dannatamente vulnerabile. Il suo principale obiettivo è: essere d'aiuto a professionisti di sicurezza informatica per testare le loro skill e i loro strumenti in un ambiente legale,aiutare i web developers a mettere in sicurezza le web applications e aiutare sia studenti che docenti a capire la sicurezza delle web applications in un'ambiente controllato.
L'obiettivo di DVWA è praticare alcune tra le più comuni vulnerabilità web con vari livelli di difficoltàe con una semplice e diretta interfaccia. È opportuno notare che sono presenti sia vulnerabilità documentate e non documentate con questo software. Questo è stato fatto intenzionalmente. Si è pregati di provare a scoprire più vulnerabilità possibili.
ATTENZIONE!
Damn Vulnerable Web Application è dannatamente vulnerabile! Non caricarla nella cartella contentente i file html del tuo provider di hosting né su alcun server accessibile da Internet perché saranno compromessi. È raccomandato utilizzare una macchina virtuale (ad esempio VirtualBox oppure VMware), che sia settata su NAT modalità networking. Dentro una macchina guest, bisogna scaricare ed installare XAMPP per il server web ed il database.
Disclaimer
Non ci assumiamo la responsabilità del modo in cui verrà utilizzata questa applicazione (DVWA). L'obiettivo di questa applicazione è stato dichiarato in modo chiaro e non dovrebbe essere usata per altri scopi. Abbiamo avvisato e dato misure di sicurezza per fare in modo che gli utenti non installino DVWA nei loro live web servers. Se il tuo live web server è compromesso da un'installazione di DVWA, non è nostra responsabilità, è responsabilità della persona che ha caricato e installato il software.
Licensa
Questo file è parte di Damn Vulnerable Web Application (DVWA).
Vulnerable Web Application (DVWA). è un software libero:
si può ridistribuire e/o modificarlo sotto i termini del GNU General Public LIcense come pubblicato dalla Free Software Foundation, sia la versione 3 della licensa o qualsiasi versione posteriore.
Damn Vulnerable Web Application (DVWA) è distribuito nella speranza che sarà utile, ma senza ALCUNA GARANZIA; neppure la garanzia implicita di COMMERCIABILITÀ o IDONEITÀ PER UNO SCOPO PARTICOLARE. Vedi la GNU General Public License per ulteriori dettagli.
È necessario avere una copia del GNU General Public License assieme a Damn Vulnerable Web Application (DVWA). Altrimenti, vedere https://www.gnu.org/licenses/.
Internazionalizzazione
Questo file è disponibile in diverse lingue:
- Arabo: العربية
- Cinese: 简体中文
- Francese: Français
- Coreano: 한국어
- Persiano: فارسی
- Polacco: Polski
- Portoghese: Português
- Spagnolo: Español
- Turco: Türkçe
- Indonesiano: Indonesia
- Vietnamita: Vietnamese
- Italiano: Italiano
Se si desidera contribuire ad una traduzione, si invii per favore una PR. Nota però: questo non significa semplicemente passare il testo su Google Translate e inviarlo, tali traduzioni verranno rifiutate. Invia la tua versione tradotta aggiungendo un nuovo file chiamato README.xx.md, dove xx è il codice a due lettere della lingua desiderata (basato sullo standard ISO 639-1).
Download
Anche se ci sono varie versione di DVWA in circolazione, l'unica supportata è l'ultima dal repository ufficiale di GitHub. Si può sia clonare dal repo:
git clone https://github.com/digininja/DVWA.gitInstallazione
Installazione Automatica 🛠️
Nota, questo non è uno script ufficiale di DVWA, è stato scritto da @IamCarron ed è mantenuto su DVWA-Script. Creare questo script è costato molto lavoro e, quando è stato creato, era sicuro, tuttavia è consigliato leggere lo script prima di eseguirlo alla cieca, per sicurezza. Per favore segnalare qualsiasi bug a DVWA-Script, non qui.
Uno script di configurazione automatica per DVWA su macchine basate su Debian, inclusa Kali, Ubunut, Kubuntu, Linux Mint, Zorin OS...
Nota: Questo script richiede i permessi di root ed è pensato per sistemi basati su Debian. È necessario assicurarsi che si è utente root.
Requisiti per l'installazione
- Sistema operativo: Sistemi basati su Debian (Kali, Ubuntu, Kubuntu, Linux Mint, Zorin Os)
- Privilegi- Eseguire come utente root
Step dell'installazione
One-Liner
Questo comando scarica lo script scritto da @IamCarron e lo esegue automaticamente. Questo non sarebbe incluso qui se non avessimo fiducia nell'autore e nello script così com'era al momento della revisione, ma esiste sempre la possibilità che qualcuno agisca in modo malevolo. Pertanto, se non ti senti al sicuro nell'eseguire codice di terzi senza prima esaminarlo personalmente, segui la procedura manuale e potrai rivedere lo script una volta scaricato.
sudo bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/IamCarron/DVWA-Script/main/Install-DVWA.sh)"Esecuzione manuale dello Script
##Scarica lo script:
shwget https://raw.githubusercontent.com/IamCarron/DVWA-Script/main/Install-DVWA.shRendi lo script eseguibile:
shchmod +x Install-DVWA.shEsegui lo script come utente root:
shsudo ./Install-DVWA.sh
Video di installazione
- Installa DVWA su Kali utilizzando Virtualbox
- Installa DVWA su Windows utilizzando XAMPP
- Installa Damn Vulnerable Web Application (DVWA) on Windows 10
Windows + XAMPP
Il modo più semplice per installare DVWA è scaricare ed installare XAMPP qualora già non si abbia un setup di un Web Server.
XAMPP è una distribuzione Apache per Linux, Solaris, Window e MAC OS X molto semplice da installare. I pacchetti includono il web server Apache, MYSQL, PHP Perl, un server FTP e phpMyAdmin.
Questo video mostra gli step per l'installazione per Windows. Tuttavia dovrebbe essere simile per altri sistemi operativi.
Docker
Grazie a hoang-himself e JGillam, ogni commit al master branch fa in modo che un'immagine Docker sia buildata per ogni branch e sia pronta da essere pullata dal GitHub Container Registry.
Per più informazioni, si visiti le Immagini Docker prebuildate.
Per iniziare
Prerequisiti: Docker e Docker Compose.
- Se si usa Docker Desktop, entrambi i requisiti dovrebbero essere già installati.
- Se si preferisce l'utilizzo di Docker Engine su Linux, è importante seguire correttamente la guida d'installazione.
Forniamo assistenza per l'ultima versione di Docker come discusso sopra.
Se stai usando Linux e il pacchetto Docker fornito dal tuo gestore di pacchetti, probabilmente funzionerà comunque, ma il supporto sarà fornito solo best-effort.
Aggiornare Docker dalla versione del gestore pacchetti a quella ufficiale ("upstream") richiede la disinstallazione delle vecchie versioni, come indicato nella documentazione per Ubuntu, Fedora e altre distribuzioni.
I tuoi dati Docker (container, immagini, volumi, ecc.) non dovrebbero essere influenzati, ma nel caso si presentino problemi, assicurati di segnalarli a Docker e nel frattempo utilizza i motori di ricerca.
Poi, per iniziare:
Esegui
docker versionanddocker compose versionper verificare di avere correttamente installati Docker e Docker Compose. Si dovrebbe essere in grado di vedere le versioni dei pacchetti in output.Per esempio:
text>>> 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.3Se non si vede nulla oppure si ha un "errore: comando non trovato", seguire i prerequisiti per fare il setup di Docker e Docker Compose.
Clonare e scaricare questo repository ed estrarre (vedere Download).
Aprire un terminale di tua scelta e cambiare la cartella di lavoro in questa cartella (
DVWA).Eseguire
docker compose up -d.
DVWA è ora disponibile all'indirizzo http://localhost:4280.
Nota che per eseguire DVWA nei container, il web server è in ascolto sulla porta 4280 invece che la solita porta 80.
Per più informazioni su questa decisione, vedere Voglio eseguire DVWA su una porta differente
Build locale
Se si sono fatti cambiamente e si vuole buildare il progetto da locale, andare a compose.yml e cambiare pull_policy: always in pull_policy: build.
Eseguire docker compose up -d dovrebbe spingere Docker a buildare un'immagine da locale indipendentemente da ciò che è disponibile nel registro.
See also: pull_policy.
Serve local files
Se si stanno facendo cambiamenti in locale e non si vuole effettuare una build per ogni cambiamente:
- Andare a
compose.ymle rimuovare il commento da :text# volumes: # - ./:/var/www/html - Eseguire
cp config/config.inc.php.dist config/config.inc.phpper copiare il file di configurazione di default. - Eseguire
docker compose up -de i cambiamenti sui file locale si rifletteranno sul container.
Versioni PHP
Idealmente, dovresti utilizzare l'ultima versione stabile di PHP, poiché è su quella versione che questa applicazione verrà sviluppata e testata.
Non verrà fornito supporto a chi tenta di utilizzare PHP 5.x.
Le versioni inferiori alla 7.3 presentano problemi noti che possono causare malfunzionamenti: gran parte dell'app funzionerà, ma alcune funzionalità potrebbero comportarsi in modo imprevedibile. A meno che tu non abbia un motivo davvero valido per utilizzare una versione così obsoleta, il supporto non sarà garantito.
Pacchetti Linux
Se stai usando una distribuzione Linux basata su Debian, saranno necessari i seguenti pacchetti (o loro equivalenti):
- apache2
- libapache2-mod-php
- mariadb-server
- mariadb-client
- php php-mysqli
- php-gd
Raccomanderei di fare un update prima di scaricarli, in modo tale da avere sicuramente l'ultima versione di tutto.
apt update
apt install -y apache2 mariadb-server mariadb-client php php-mysqli php-gd libapache2-mod-phpIl sito funzionerà con MySQL invece di MariaDB ma incoraggiamo vivamente MariaDB poiché funziona out of the box. Con MYSQL è necessario fare dei cambiamenti affinché funzioni.
Moduli Apache
Se si vuole usare il lab API è necessario avere il modulo Apache mod_rewrite abilitato. Per fare questo in linux eseguire:
a2enmod rewritePoi riavviare Apache con:
apachectl restartFile sellers
Se si vuole usare il modulo API sarà necessario scaricare un insieme di file sellers usando Composer.
In primo luogo, assicurarsi di avere Composer installato. Sembrano esserci problemi di incompatibilità tra le versioni. Io ottengo le versioni più recenti da qui:
https://getcomposer.org/doc/00-intro.md
Seguire le istruzioni del sito per installare Composer.
Poi andare dentro la cartella vulnerabilities/api ed eseguire:
composer.phar installSe non si è scaricato Composer nella cartella di sistema, assicurarsi di avere come riferimento il percorso completo.
Configurations
Config File
DVWA viene fornito con una copia fittizia del suo file di configurazione, che dovrai copiare nella posizione corretta e poi modificare opportunamente. Su Linux, assumendo che tu sia nella directory di DVWA, questo può essere fatto come segue:
cp config/config.inc.php.dist config/config.inc.php
Su Windows, questo può essere un po’ più complicato se le estensioni dei file sono nascoste. Se non si è sicuri di questo aspetto, questo articolo del blog lo spiega più nel dettaglio:
Come mostrare l'estensione dei file su Windows
Configurazione con variabili di ambiente
Invece di modificare il file di configurazione, puoi anche impostare la maggior parte delle opzioni utilizzando delle variabili d'ambiente. In un deployment Docker o Kubernetes, questo ti permette di modificare la configurazione senza dover creare una nuova immagine Docker. Troverai le variabili nel config/config.inc.php.dist file.
Se si desidera impostare il livello di sicurezza su "basso", aggiungere semplicemente la seguente linea al file compose.yml:
environment:
- DB_SERVER=db
- DEFAULT_SECURITY_LEVEL=lowSetup Del Database
Per fare il setup del database, semplicemente cliccare sul bottone Setup DVWA nel menu principale, poi cliccare il bottone Create / Reset Database. Questo creerà / resetterà il database per te con un po' di dati al suo interno.
Qualora si riceva un errore durante la creazione del database, assicurarsi di aver inserito delle credenziali corrette dentro ./config/config.inc.php. Questo è diverso da config.inc.php.dist, è solo un file di esempio.
Le variabili sono settate ai seguenti valori di 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';Nota, se si sta usando MariaDB invece di MySQL (MariaDB è il default in Kali), non si può usare l'utente root del database, bisogna creare un nuovo utente del database. Per fare questo, connettersi al database come utente root e usare i seguenti comandi:
MariaDB [(none)]> create database dvwa;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create user dvwa@localhost identified by 'p@ssw0rd';
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> grant all on dvwa.* to dvwa@localhost;
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)Disabilitare L'Autenticazione
Alcuni strumenti non funzionano bene con l'autenticazione quindi non possono essere usati con DVWA. Per risolvere questo, c'è un'impostazione di configurazione per disabilitare il controllo dell'autenticazione. Per farlo, bisogna semplicemente settare il seguente flag nel file di configurazione
$_DVWA[ 'disable_authentication' ] = true;Sarà anche necessario impostare il livello di sicurezza su uno che sia appropriato sul livello di test che si vuole fare:
$_DVWA[ 'default_security_level' ] = 'low';In questo caso, si può accedere a tutte le features senza il bisogno di essere loggati o senza alcun cookie.
Cartella Permessi
./hackable/uploads/- È necessario che sia scrivibile dal Web Service (per il File Upload).
Configurazione PHP
Sui sistemi Linux, probabilmente si trova in /etc/php/x.x/fpm/php.ini o /etc/php/x.x/apache2/php.ini.
Per abilitare il Remote File Inclusions (RFI):
allow_url_include = on[allow_url_include]allow_url_fopen = on[allow_url_fopen]
Per essere sicuri che PHP mostri tutti i messaggi di errore:
display_errors = on[display_errors]display_startup_errors = on[display_startup_errors]
È necessario riavviare il servizio php o Apache dopo aver effettuato i cambiamenti.
reCAPTCHA
È necessario eseguire quanto riportato qui sotto solo per il laboratorio "CAPTCHA insicuro", se non si vuole usare con quel laboratorio, si può ignorare questo capitolo.
Generare un paio di chiavi da https://www.google.com/recaptcha/admin/create.
Poi andare nelle seguenti sezioni di ./config/config.inc.php:
$_DVWA[ 'recaptcha_public_key' ]$_DVWA[ 'recaptcha_private_key' ]
Credenziali Di Default
Default username = admin
Default password = password
...può essere bruteforzato facilmente ;)
URL DI LOGIN: http://127.0.0.1/login.php
Nota: Questo sarà differente se si è installato DVWA in una cartella differente.
Risoluzione Di Problemi
Si presume che si stia utilizzando una distribuzione basata su Debian, come Debian, Ubuntu o Kali. Per altre distribuzioni, si può comunque seguire la guida, aggiornando i comandi dove opportuno.
Se si preferisce guardare un video anziché leggere, i problemi più comuni vengono trattati nel video Fixing DVWA Setup Issues.
Containers
Vorrei accedere i log
Se si sta usando Docker Desktop, i log possono essere acceduti dall'applicazione grafica. Alcuni cambiamenti minori ci possono essere nelle versioni più recenti ma il metodo di accesso dovrebbe essere il medesimo.
I log possono essere anche acceduti dal terminale.
Aprire un terminale e cambiare la cartella di lavoro di DVWA.
Mostrare i log uniti
shdocker compose logsIn caso si vogliano esportare i log, i.e.
dvwa.logshdocker compose logs > dvwa.log
Voglio eseguire DVWA in un'altra porta
Non si utilizza la porta 80 come predefinita per alcuni motivi:
- Alcuni utenti potrebbero avere già qualcosa in esecuzione sulla porta 80.
- Alcuni utenti potrebbero usare un container senza privilegi (come Podman), e la porta 80 è una porta privilegiata (< 1024). Sarebbe necessaria una configurazione aggiuntiva (ad esempio impostare
net.ipv4.ip_unprivileged_port_start) è necessario, ma su questo bisognerà informarsi autonomamente.
Si può esporre DVWA su una porta diversa modificando l'associazione della porta nel file compose.yml.
Per esempio, si può cambiare
ports:
- 127.0.0.1:4280:80in
ports:
- 127.0.0.1:8806:80DVWA è ora accessibile a http://localhost:8806.
Nei casi in cui si desideri che DVWA sia accessibile non solo dal proprio dispositivo, ma anche dalla rete locale (ad esempio perché si sta configurando una macchina di test per un workshop), si può rimuovere il 127.0.0.1: dall’associazione delle porte (oppure sostituirlo con l’indirizzo IP della propria LAN). In questo modo, l'applicazione ascolterà su tutte le interfacce di rete disponibili.
La scelta predefinita e più sicura dovrebbe comunque essere quella di limitare l’ascolto al solo dispositivo locale (loopback). In fin dei conti, si tratta di un'applicazione web deliberatamente vulnerabile, in esecuzione sulla propria macchina.
437
Il file incluso compose.yml esegue automaticamente DVWA e il suo database quando Docker viene inizializzato.
Per disabilitare questa funzione, si può eliminare o commentare la linea restart: unless-stopped nel file compose.yml
Se si vuole disabilitare questo comportamento temporaneamente, si può eseguire docker compose stop, o usare Docker Desktop, trovare dvwa e cliccare Stop.
Addizionalmente, si possono eliminare i container oppure eseguire docker compose down.
File di log
Sui sistemi Linux Apache genera due file di log di default, access.log e error.log e sui sistemi Debian sono solitamente nella cartella /var/log/apache2/.
Durante la segnalazione di errori, problemi o qualsiasi cosa del genere, per favore includere almeno cinque linee da ognuno di questi file. Sui sistemi basati su Debian si possono ottenere questi file così
tail -n 5 /var/log/apache2/access.log /var/log/apache2/error.logNavigando sul sito ho ottenuto un errore 404 o la pagina predefinita di Apache2
Se si sta avendo questo problema bisogna capire come funziona la posizione dei file. Di default, la root dei documenti di Apache (il posto in cui comincia a cercare i documenti) è /var/www/html, Se si posiziona il file hello.txt in questa cartella, per accedere questo file sarà necessario navigare a http://localhost/hello.txt.
Se si è creata una cartella e messi i file lì dentro - /var/www/html/mydir/hello.txt - si avrà bisogno di navigare a http://localhost/mydir/hello.txt.
Linux è attento alle maiuscole e minuscole, se non si fa attenzione si può ottenere un errore 404 Not Found:
http://localhost/MyDir/hello.txthttp://localhost/mydir/Hello.txthttp://localhost/MYDIR/hello.txt
Che effetto ha questo su DVWA? Diverse persone usano git per clonare DVWA in /var/www/html, questo crea la cartella /var/www/html/DVWA/ con tutti i file al suo interno. Successivamente navigano http://localhost/ e ottengono o 404 o la pagina predefinita di Apache. Poiché i file sono in DVWA bisogna navigare in http://localhost/DVWA.
L'altro errore comune è quello di navigare su http://localhost/dvwa, il che porta a un errore 404 perché dvwa non è DVWA, dato che in Linux si fa distinzione tra maiuscole e minuscole nei nomi delle directory.
Quindi, dopo l'installazione, se si prova a visitare il sito e si riceve un errore 404, si deve riflettere su dove sono stati installati i file, su dove si trovano rispetto alla radice del documento e su come siano scritte le lettere della directory usata.
Navigando la pagina ho ottenuto uno schermo vuoto
Questo è di solito un problema di configurazione che ne nasconde un altro. Di default, PHP non mostra gli errori, e quindi, se ci si è dimenticati di attivare la visualizzazione degli errori durante il processo di configurazione, qualsiasi altro problema, come un fallimento nella connessione al database, impedirà all'applicazione di caricarsi, ma il messaggio che dice cosa non va sarà nascosto.
Per sistemare questo, bisogna essere sicuri di impostare display_errors e display_startup_errors come discusso in Configurazione di PHP e poi riavviare Apache.
"Access denied" mentre si esegue il setup
Se si vede quanto segue durante l'esecuzione dello script di configurazione, significa che il nome utente o la password nel file di configurazione non corrispondono a quelli configurati nel database.
Video d'aiuto
Database Error #1045: Access denied for user 'notdvwa'@'localhost' (using password: YES).L'errore sta dicendo che si sta usando lo username notdvwa.
Il seguente errore dice che si è scritto il file di configurazione al database sbagliato. Video d'aiuto
SQL: Access denied for user 'dvwa'@'localhost' to database 'notdvwa'Questo errore sta invece dicendo che l'utente dvwa sta provando a connettersi al database notdvwa.
La prima cosa da fare è ricontrollare che ciò che si pensa di aver inserito nel file di configurazione sia effettivamente quello che è presente.
Se corrisponde a quanto ci si aspetta, la cosa successiva da fare è verificare se si riesce ad accedere come l’utente voluto da linea di comando. Supponendo di avere un utente del database chiamato dvwa e una password di p@ssw0rd, eseguire il seguente comando:
mysql -u dvwa -pp@ssw0rd -D dvwaNota: non c'è uno spazio dopo -p
Se si vede il seguente output, il codice è corretto:
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]>Poiché si riesce a connettersi dalla riga di comando, è probabile che ci sia qualcosa di sbagliato nel file di configurazione, lo si ricontrolli attentamente e poi si apra un issue se ancora non si riesce a far funzionare le cose.
Se si vede quanto segue, il nome utente o la password che si sta usando è sbagliato. Si ripetano i passaggi della Database Setup e ci si assicuri di usare lo stesso nome utente e la stessa password per tutto il processo.
ERROR 1045 (28000): Access denied for user 'dvwa'@'localhost' (using password: YES)Se si ottiene quanto segue, le credenziali dell'utente sono corrette ma l'utente non ha accesso al database. Anche in questo caso, si ripetano i passaggi di configurazione e si controlli il nome del database che si sta usando.
ERROR 1044 (42000): Access denied for user 'dvwa'@'localhost' to database 'dvwa'L'errore finale che si potrebbe ottenere è questo:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)Questo non è un errore di autenticazione ma dice che il server del database non è in esecuzione. Si può avviarlo con il seguente comando.
sudo service mysql startConnessione rifiutata
Un errore simile a questo:
Fatal error: Uncaught mysqli_sql_exception: Connection refused in /var/sites/dvwa/non-secure/htdocs/dvwa/includes/dvwaPage.inc.php:535Significa che il server del database non è in esecuzione oppure si ha l'indirizzo ip errato nel file di configurazione.
Controllare questa linea nel file di configurazione per vedere dove il server del database dovrebbe essere:
$_DVWA[ 'db_server' ] = '127.0.0.1';Poi andare a questo server e controllare che sia in esecuzione. In linux si può fare questo con:
systemctl status mariadb.serviceE si deve cercare qualcosa del genere, la cosa importante è che dica qualcosa come 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 agoSe non è in esecuzione, si può avviare con:
sudo systemctl stop mariadb.serviceNota sudo e assicurarsi di mettere la password di Linux se richiesto.
In Windows, controllare lo status nella console XAMPP.
Metodo Di Autenticazione Sconosciuto
Con le versioni più recenti di MySQL, non è più possibile far comunicare PHP con il database nella sua configurazione predefinita. Se si prova a eseguire lo script di installazione e viene visualizzato il seguente messaggio, significa che è stata configurata una configurazione.
Database Error #2054: The server requested authentication method unknown to the client.Si hanno due opzioni, la più semplice è disinstallare MySQL e installare MariaDB. La seguente è la guida ufficiale dal progetto di MariaDB:
https://mariadb.com/resources/blog/how-to-migrate-from-mysql-to-mariadb-on-linux-in-five-steps/
Alternativamente, seguire questi passi:
Da utente root, modificare il seguente file:
/etc/mysql/mysql.conf.d/mysqld.cnfSotto la linea
[mysqld], aggiungere:
default-authentication-plugin=mysql_native_passwordRiavviare il database:
sudo service mysql restartControllare il metodo di autenticazione per l'utente del database:
sqlmysql> 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)Si vedrà verosimilmente
caching_sha2_password. Se sì, eseguire eseguire i seguenti comandi:sqlmysql> ALTER USER dvwa@localhost IDENTIFIED WITH mysql_native_password BY 'p@ssw0rd';Ri-eseguendo i controlli, si dovrebbe ora vedere
mysql_native_password.sqlmysql> 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)
Dopo tutto, il processo di inizializzazione dovrebbe funzionare normalmente.
Se si vogliono più informazioni vedere la seguente pagina:
https://www.php.net/manual/en/mysqli.requirements.php.
Errore Del Database #2002: No such file or directory
Il server del database non è in esecuzione. In un sistema basato su Debian questo si può risolvere con:
sudo service mysql startErrori "MySQL server has gone away" e "Packets out of order"
Ci sono diverse ragioni per cui si può ricevere questi errori, ma la più probabile è che la versione del server database che si sta utilizzando non è compatibile con la versione di PHP.
Questo problema si riscontra più comunemente quando si utilizza l’ultima versione di MySQL, poiché PHP e MySQL non funzionano bene insieme. Il consiglio migliore è abbandonare MySQL e installare MariaDB, poiché questo è un problema che non possiamo supportare.
Per più informazioni, vedere:
https://www.ryadel.com/en/fix-mysql-server-gone-away-packets-order-similar-mysql-related-errors/
Perché il database non si connette a CentOS?
Si potrebbero star riscontrando problemi con SELinux. Si può sia disabilitare SELinux oppure eseguire il seguente comando che consente di far comunicare il web server con il database:
setsebool -P httpd_can_network_connect_db 1Qualsiasi Altra Cosa
Per le informazioni più aggiornate sulla risoluzione dei problemi, si prega di leggere sia i ticket aperti che quelli chiusi nel repository Git:
https://github.com/digininja/DVWA/issues
Prima di inviare un ticket, assicurati di utilizzare l’ultima versione del codice dal repository. Questa non è l’ultima release, ma l’ultima versione del codice dal ramo master.
Quando si apre un ticket, si prega di fornire almeno le seguenti informazioni:
-Sistema operativo
-Le ultime 5 righe del log degli errori del server web subito dopo che si è verificato l’errore che stai segnalando
-Se si tratta di un problema di autenticazione al database, segui i passaggi indicati sopra e fai uno screenshot di ogni passaggio. Invia questi screenshot insieme a uno screenshot della sezione del file di configurazione che mostra l’utente e la password del database.
-Una descrizione completa di cosa sta andando storto, cosa ti aspetti che accada e cosa hai provato a fare per risolverlo. "Login non funziona" non è sufficiente per permetterci di capire il tuo problema e aiutarti a risolverlo.
Tutorials
Cercherò di realizzare alcuni video tutorial che illustrino alcune vulnerabilità e mostrino come individuarle e poi come sfruttarle. Ecco quelli che ho realizzato finora:
Trovare e Sftruttare Reflected XSS
SQLite3 SQL Injection
Il supporto per questo è limitato; prima di segnalare problemi, assicurati di essere pronto a lavorare sul debug, non limitarti a dire “non funziona”.
Per impostazione predefinita, gli attacchi SQLi e Blind SQLi vengono eseguiti contro il server MariaDB/MySQL utilizzato dal sito, ma è possibile passare a eseguire i test SQLi su SQLite3.
Non spiegherò come far funzionare SQLite3 con PHP, ma dovrebbe essere sufficiente installare il pacchetto php-sqlite3 e assicurarsi che sia abilitato.
Per effettuare il cambio, modifica semplicemente il file di configurazione aggiungendo o modificando queste righe:
$_DVWA["SQLI_DB"] = "sqlite";
$_DVWA["SQLITE_DB"] = "sqli.db";Di default viene usato il file database/sqli.db, qualora si abbiano problemi, semplicemente copiare database/sqli.db.dist in alto.
Le challenge sono esattamente quelle come per MariaDB, tuttavia ora utilizzano SQLite3.
👨💻 Contributors
Grazie per tutti i vostri contributi e per mantenere aggiornato questo progetto. :heart:
Se hai un'idea, qualche tipo di miglioramento o semplicemente vuoi collaborare, sei il benvenuto a contribuire e partecipare al progetto. Sentiti libero di inviare una pull request.
Segnalare Vulnerabilità
Per essere semplici, non fatelo!
Circa una volta all’anno, qualcuno invia un report riguardo a una vulnerabilità trovata nell’applicazione. Alcuni di questi report sono ben scritti, a volte persino meglio di quelli che ho visto in test di penetrazione a pagamento; altri si limitano a dire “mancano degli header, pagatemi”.
Nel 2023, la cosa ha raggiunto un nuovo livello quando qualcuno ha deciso di richiedere un CVE per una delle vulnerabilità, ottenendo CVE-2023-39848. Ne è seguito molto divertimento e si è perso tempo per sistemare la questione.
L’applicazione contiene vulnerabilità, ed è voluto. La maggior parte sono quelle ben documentate che si affrontano come esercizi, altre sono vulnerabilità “nascoste”, da scoprire autonomamente. Se vuoi davvero dimostrare le tue capacità trovando quelle extra, scrivi un post sul blog o crea un video: probabilmente ci sono persone interessate ad apprendere come le hai individuate. Se ci mandi il link, potremmo anche includerlo tra i riferimenti.
Link
Home del progetto: https://github.com/digininja/DVWA
Creato dal team DVWA
File: README.ko.md
DAMN VULNERABLE WEB APPLICATION
Damn Vulnerable Web Application (DVWA)은 매우 취약한 PHP/MySQL 웹 애플리케이션입니다. DVWA의 주요 목표는 보안 전문가들이 자신의 기술과 도구를 합법적인 환경에서 테스트하고, 웹 개발자들이 웹 애플리케이션 보안 프로세스를 더 잘 이해하도록 돕는 것입니다. 또한, 학생과 교사들이 통제된 교실 환경에서 웹 애플리케이션 보안에 대해 배우는 데 도움을 주고자 합니다.
DVWA의 목표는 가장 흔한 웹 취약점들에 대한 연습을 다양한 난이도로 제공하는 것입니다. 간단하고 직관적인 인터페이스를 갖추고 있습니다. 이 소프트웨어에는 문서화된 취약점과 문서화되지 않은 취약점이 모두 존재합니다. 이는 의도적인 것으로, 가능한 많은 문제를 발견해 보시기를 권장합니다.
주의!
Damn Vulnerable Web Application은 매우 취약합니다! 호스팅 제공자의 공개 html 폴더나 인터넷에 노출된 서버에 업로드하지 마십시오. 그렇지 않으면 서버가 침해될 수 있습니다. 가상 머신(예: VirtualBox or VMware)을 사용하고 NAT 네트워킹 모드로 설정하는 것이 좋습니다. 게스트 머신 내에서 XAMPP를 다운로드하여 웹 서버와 데이터베이스를 설치할 수 있습니다.
면책 조항
우리는 DVWA의 사용 방식에 대해 책임을 지지 않습니다. 애플리케이션의 목적은 명확히 설명되어 있으며, 악의적으로 사용해서는 안 됩니다. 사용자가 DVWA를 라이브 웹 서버에 설치하지 않도록 경고와 조치를 취했습니다. DVWA 설치를 통해 웹 서버가 침해된 경우, 이는 설치한 개인의 책임입니다.
라이선스
이 파일은 Damn Vulnerable Web Application (DVWA)의 일부입니다.
Damn Vulnerable Web Application (DVWA)은 자유 소프트웨어입니다: 귀하는 이를 재배포하거나 수정할 수 있으며, GNU 일반 공중 사용 허가서(GNU General Public License) 버전 3 또는 (옵션으로) 그 이후 버전의 조건에 따라 이를 사용할 수 있습니다.
Damn Vulnerable Web Application (DVWA)은 유용할 것이라는 희망으로 배포되지만, 어떠한 형태의 보증도 제공하지 않습니다. 상업성이나 특정 목적에의 적합성에 대한 묵시적인 보증도 포함되지 않습니다. 자세한 내용은 GNU 일반 공중 사용 허가서를 참조하십시오.
Damn Vulnerable Web Application (DVWA)와 함께 GNU 일반 공중 사용 허가서 사본을 받았어야 합니다. 그렇지 않다면 https://www.gnu.org/licenses/에서 확인하십시오.
국제화
이 파일은 여러 언어로 제공됩니다:
- 스페인어: Espaol
- 아랍어: العربية
- 영어: English
- 인도네시아어: Indonesia
- 중국어: 简体中文
- 터키어: Trke
- 페르시아어: فارسی
- 포르투갈어: Portugus
- 프랑스어: Franais
- 한국어: 한국어
번역에 기여하고자 한다면 PR을 제출해 주십시오. 단, 구글 번역기를 사용한 번역은 거부됩니다. 번역본을 제출하려면, 번역된 'README.xx.md' 파일을 추가하십시오. 여기서 xx는 원하는 언어의 두 글자 코드(ISO 639-1 기반)입니다.
다운로드
DVWA에는 여러 가지 버전이 있지만, 유일하게 지원되는 버전은 공식 GitHub 저장소에서 제공하는 최신 소스입니다. 저장소에서 클론할 수 있습니다:
git clone https://github.com/digininja/DVWA.git또는 파일의 ZIP을 다운로드할 수 있습니다.
설치
자동 설치 🛠️
참고: 이것은 공식 DVWA 스크립트가 아니며, @IamCarron에 의해 작성되었으며 DVWA-Script에서 유지 관리됩니다에 의해 작성되었습니다. 스크립트를 작성하는 데 많은 노력이 들어갔으며, 작성 당시에는 악의적인 행동을 하지 않았지만, 시스템에서 무작정 실행하기 전에 스크립트를 검토하는 것이 좋습니다. 버그가 발견되면 이곳이 아닌 @IamCarron에 의해 작성되었으며 DVWA-Script에서 유지 관리됩니다에게 보고해 주세요.
Debian 기반 머신(Kali, Ubuntu, Kubuntu, Linux Mint, Zorin OS 등)에서 DVWA를 자동으로 구성하는 스크립트입니다.
참고: 이 스크립트는 루트 권한이 필요하며 Debian 기반 시스템에 맞춰져 있습니다. 반드시 루트 사용자로 실행하세요.
설치 요구 사항
- 운영 체제: Debian 기반 시스템 (Kali, Ubuntu, Kubuntu, Linux Mint, Zorin OS)
- 권한: 루트 사용자로 실행
설치 단계
스크립트 다운로드:
bashwget https://raw.githubusercontent.com/IamCarron/DVWA-Script/main/Install-DVWA.sh스크립트 실행 권한 부여:
bashchmod +x Install-DVWA.sh루트로 스크립트 실행:
bashsudo ./Install-DVWA.sh
설치 동영상
- VirtualBox에서 실행 중인 Kali에 DVWA 설치
- Windows에서 XAMPP를 사용하여 DVWA 설치
- Windows 10에 Damn Vulnerable Web Application (DVWA) 설치
Windows + XAMPP
가장 쉬운 DVWA 설치 방법은 XAMPP를 다운로드하여 설치하는 것입니다. 이미 웹 서버가 설정되어 있지 않은 경우에 유용합니다.
XAMPP는 Linux, Solaris, Windows 및 Mac OS X용으로 설치하기 쉬운 Apache 배포판입니다. 이 패키지에는 Apache 웹 서버, MySQL, PHP, Perl, FTP 서버 및 phpMyAdmin이 포함되어 있습니다.
이 비디오는 Windows에 대한 설치 과정을 안내하지만, 다른 OS에서도 유사할 것입니다.
Docker
hoang-himself와 JGillam 덕분에 master 브랜치에 대한 모든 커밋은 Docker 이미지를 빌드하고 GitHub Container Registry에서 내려받을 수 있게 합니다.
얻을 수 있는 것에 대한 자세한 내용은 사전 빌드된 Docker 이미지를 참조하십시오.
시작하기
선행 요건: Docker 및 Docker Compose.
- Docker Desktop을 사용하는 경우, 두 가지가 이미 설치되어 있어야 합니다.
- Linux에서 Docker Engine을 선호하는 경우, 설치 가이드를 따라 설치하세요.
위에서 언급한 최신 Docker 릴리스에 대한 지원을 제공합니다.
Linux에서 패키지 관리자를 통해 제공된 Docker 패키지를 사용하는 경우에도 작동할 가능성이 있지만, 지원은 최선의 노력을 다합니다.
패키지 관리자 버전에서 업스트림으로 Docker를 업그레이드하려면 Ubuntu, Fedora 등에서 설명하는 대로 이전 버전을 제거해야 합니다.
Docker 데이터(컨테이너, 이미지, 볼륨 등)는 영향을 받지 않아야 하지만 문제가 발생하면 Docker에 알리고 검색 엔진을 사용하는 것이 좋습니다.
그런 다음 시작하려면:
docker version및docker compose version을 실행하여 Docker 및 Docker Compose가 제대로 설치되었는지 확인하세요. 출력에서 해당 버전을 확인할 수 있어야 합니다.예를 들어:
text>>> 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아무것도 표시되지 않거나 명령어를 찾을 수 없다는 오류가 발생하면 Docker 및 Docker Compose를 설정하기 위한 필수 조건을 따르세요.
이 리포지토리를 클론하거나 다운로드하여 압축을 풉니다 (참조 다운로드).
선택한 터미널을 열고 작업 디렉터리를 이 폴더(
DVWA)로 변경합니다.docker compose up -d를 실행합니다.
이제 DVWA는 http://localhost:4280에서 사용할 수 있습니다.
컨테이너에서 DVWA를 실행할 때, 웹 서버는 일반적인 포트 80 대신 포트 4280에서 수신 대기하고 있습니다.
이 결정에 대한 자세한 내용은 다른 포트에서 DVWA를 실행하고 싶습니다를 참조하세요.
로컬 빌드
로컬에서 변경 사항을 적용하고 프로젝트를 빌드하려면 compose.yml 파일에서 pull_policy: always를 pull_policy: build로 변경하십시오.
docker compose up -d를 실행하면 레지스트리에 무엇이 있든 상관없이 Docker가 로컬에서 이미지를 빌드하도록 트리거됩니다.
참조: pull_policy.
PHP 버전
이상적으로는 최신 안정 버전의 PHP를 사용하는 것이 좋습니다. 이는 이 앱이 개발 및 테스트되는 버전입니다.
PHP 5.x를 사용하려는 사람에게는 지원이 제공되지 않습니다.
7.3 미만의 버전은 문제가 발생할 수 있는 알려진 이슈가 있으며, 대부분의 앱은 작동하겠지만 무작위로 문제가 발생할 수 있습니다. 아주 좋은 이유가 없는 한, 그렇게 오래된 버전을 사용하는 경우 지원이 제공되지 않습니다.
Linux 패키지
Debian 기반 Linux 배포판을 사용하는 경우, 다음 패키지 (또는 이에 상응하는 것) 를 설치해야 합니다:
- apache2
- libapache2-mod-php
- mariadb-server
- mariadb-client
- php
- php-mysqli
- php-gd
모든 최신 버전을 받기 위해 설치 전에 업데이트를 수행하는 것이 좋습니다.
apt update
apt install -y apache2 mariadb-server mariadb-client php php-mysqli php-gd libapache2-mod-php이 사이트는 MariaDB 대신 MySQL로도 작동하지만, MySQL을 올바르게 작동시키기 위해 변경해야 하는 반면, MariaDB는 별다른 설정 없이 바로 작동하므로 MariaDB를 강력히 추천합니다.
구성
설정 파일
DVWA에는 해당 위치에 복사한 다음 적절한 변경 사항을 가할 필요가 있는 설정 파일의 더미 복사본이 함께 제공됩니다. 리눅스에서는 DVWA 디렉토리에 있는 것으로 가정하면 다음과 같이 수행할 수 있습니다:
cp config/config.inc.php.dist config/config.inc.php
Windows에서는 파일 확장자를 숨기는 경우 조금 더 어려울 수 있습니다. 이에 대해 자세히 알아보려면 다음 블로그 포스트를 참조하세요:
데이터베이스 설정
데이터베이스를 설정하려면, 단순히 주 메뉴의 Setup DVWA 버튼을 클릭한 다음 Create / Reset Database 버튼을 클릭하면 됩니다. 이렇게 하면 데이터베이스가 생성되거나 재설정되며 일부 데이터가 포함됩니다.
데이터베이스를 생성하는 동안 오류가 발생하면 ./config/config.inc.php 내의 데이터베이스 자격 증명이 올바른지 확인하십시오. 이는 예제 파일인 config.inc.php.dist와 다릅니다.
변수는 다음과 같이 기본값으로 설정됩니다:
$_DVWA[ 'db_server'] = '127.0.0.1';
$_DVWA[ 'db_port'] = '3306';
$_DVWA[ 'db_user' ] = 'dvwa';
$_DVWA[ 'db_password' ] = 'p@ssw0rd';
$_DVWA[ 'db_database' ] = 'dvwa';참고로, MySQL 대신 MariaDB를 사용하는 경우 (Kali의 기본값은 MariaDB입니다), 데이터베이스 루트 사용자를 사용할 수 없으므로 새 데이터베이스 사용자를 생성해야 합니다. 이를 위해 루트 사용자로 데이터베이스에 연결한 다음 다음 명령을 사용하십시오:
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)인증 비활성화
일부 도구는 인증을 사용할 수 없으므로 DVWA와 함께 사용할 수 없습니다. 이를 해결하기 위해 인증 확인을 비활성화하는 구성 옵션이 있습니다. 이를 위해 설정 파일에서 다음을 설정하면 됩니다:
$_DVWA[ 'disable_authentication' ] = true;또한 테스트하려는 내용에 적합한 보안 수준으로 보안 수준을 설정해야 합니다:
$_DVWA[ 'default_security_level' ] = 'low';이 상태에서는 로그인할 필요 없이 모든 기능에 액세스할 수 있습니다.
폴더 권한
./hackable/uploads/- 웹 서비스에 의해 쓰기 가능해야 합니다 (파일 업로드를 위해).
PHP 구성
리눅스 시스템에서는 일반적으로 /etc/php/x.x/fpm/php.ini 또는 /etc/php/x.x/apache2/php.ini에서 찾을 수 있습니다.
원격 파일 포함 (RFI)을 허용하려면:
allow_url_include = on[allow_url_include]allow_url_fopen = on[allow_url_fopen]
PHP가 모든 오류 메시지를 표시하도록 하려면:
display_errors = on[display_errors]display_startup_errors = on[display_startup_errors]
변경 사항을 적용한 후 php 서비스 또는 Apache를 다시 시작하는지 확인하세요.
reCAPTCHA
이는 "Insecure CAPTCHA" 랩에서만 필요하며 해당 랩을 사용하지 않는다면 이 섹션을 무시할 수 있습니다.
https://www.google.com/recaptcha/admin/create에서 API 키 쌍을 생성합니다.
그런 다음 이 키는 ./config/config.inc.php의 다음 섹션에 들어갑니다:
$_DVWA[ 'recaptcha_public_key' ]$_DVWA[ 'recaptcha_private_key' ]
기본 자격 증명
기본 사용자 이름 = admin
기본 암호 = password
... 쉽게 브루트 포스될 수 있음 ;)
로그인 URL: http://127.0.0.1/login.php
참고: DVWA를 다른 디렉토리에 설치한 경우 이 URL이 다를 수 있습니다.
문제 해결
이 문제 해결 방법은 Debian 기반 배포판인 Debian, Ubuntu 및 Kali를 사용한다고 가정합니다. 다른 배포판의 경우 해당 명령을 업데이트하여 따르세요.
컨테이너
로그에 접근하고 싶어요
Docker Desktop을 사용하는 경우 로그는 그래픽 애플리케이션에서 접근할 수 있습니다.
새로운 버전에서 약간의 세부 사항이 변경될 수 있지만 접근 방법은 동일해야 합니다.
로그는 터미널에서도 확인할 수 있습니다.
터미널을 열고 작업 디렉토리를 DVWA로 변경하세요.
병합된 로그 표시
shelldocker compose logs로그를 파일로 내보내려는 경우, 예를 들어
dvwa.logshelldocker compose logs >dvwa.log
다른 포트에서 DVWA 실행하고 싶어요
기본적으로 포트 80을 사용하지 않는 이유는 몇 가지 있습니다.
- 일부 사용자는 이미 포트 80에서 무언가를 실행 중일 수 있습니다.
- 일부 사용자는 루트리스 컨테이너 엔진(예: Podman)을 사용할 수 있으며 80은 특권 포트(< 1024)입니다. 추가 구성(예:
net.ipv4.ip_unprivileged_port_start설정)이 필요하지만 직접 조사해야 합니다.
compose.yml 파일에서 포트 바인딩을 변경하여 DVWA를 다른 포트에서 노출할 수 있습니다.
예를 들어,
ports:
- 127.0.0.1:4280:80를
ports:
- 127.0.0.1:8806:80로 변경할 수 있습니다.
DVWA는 이제 http://localhost:8806에서 접근할 수 있습니다.
디바이스에서만 독점적으로 DVWA에 액세스하고 싶을 때가 있습니다(예: 워크샵을 위한 테스트 머신을 설정하는 경우), 로컬 네트워크에서도 액세스할 수 있도록 하려면 포트 매핑에서 127.0.0.1:을 제거하거나(또는 LAN IP로 대체)하세요. 이렇게 하면 모든 사용 가능한 디바이스에서 수신됩니다. 안전한 기본 설정은 항상 로컬 루프백 디바이스에서만 수신하는 것입니다. 결국, 이것은 사용자의 머신에서 실행되는 위험한 웹 응용 프로그램입니다.
Docker 실행 시 DVWA 자동 시작
포함된 compose.yml 파일은 Docker가 시작될 때 자동으로 DVWA와 해당 데이터베이스를 실행합니다.
이 기능을 비활성화하려면 compose.yml 파일에서 restart: unless-stopped 라인을 삭제하거나 주석 처리하세요.
이 동작을 일시적으로 비활성화하려면 docker compose stop을 실행하거나 Docker Desktop을 사용하여 dvwa를 찾아 중지를 클릭하세요.
또는 컨테이너를 삭제하거나 docker compose down을 실행할 수 있습니다.
로그 파일
리눅스 시스템에서는 Apache가 기본적으로 두 가지 로그 파일을 생성합니다. access.log와 error.log로, 데비안 기반 시스템에서는 보통 /var/log/apache2/에 있습니다.
에러 보고서, 문제 등을 제출할 때, 적어도 각각의 파일의 마지막 다섯 줄을 포함해야 합니다. 데비안 기반 시스템에서는 다음과 같이 가져올 수 있습니다.
tail -n 5 /var/log/apache2/access.log /var/log/apache2/error.log사이트에 접속하여 404 오류가 발생했습니다
이 문제가 발생하면 파일 위치를 이해해야 합니다. 기본적으로 Apache 문서 루트(웹 콘텐츠를 찾는 곳)는 /var/www/html입니다. 이 디렉토리에 파일 hello.txt을 넣은 경우에는 http://localhost/hello.txt로 접속해야 합니다.
디렉토리를 만들고 파일을 넣은 경우 - /var/www/html/mydir/hello.txt - 그러면 http://localhost/mydir/hello.txt로 접속해야 합니다.
리눅스는 기본적으로 대소문자를 구분하므로 위의 예에서는 다음에 대한 404 Not Found가 발생합니다.
http://localhost/MyDir/hello.txthttp://localhost/mydir/Hello.txthttp://localhost/MYDIR/hello.txt
이것이 DVWA에 어떻게 영향을 미치는가요? 대부분의 사람들은 DVWA를 /var/www/html에 체크아웃하기 때문에 모든 DVWA 파일이 들어 있는 /var/www/html/DVWA/ 디렉토리가 생깁니다. 그런 다음 http://localhost/로 접속하면 404 또는 기본 Apache 환영 페이지를 받게 됩니다. 파일이 DVWA에 있으므로 http://localhost/DVWA로 접속해야 합니다.
다른 흔한 실수는 http://localhost/dvwa로 접속하는 것입니다. 이는 리눅스 디렉토리 매칭에 따라 dvwa가 DVWA가 아니기 때문에 404가 발생합니다.
따라서 설치 후에 사이트에 접속하여 404를 받는 경우, 파일을 어디에 설치했는지, 문서 루트와의 관계는 무엇인지, 사용한 디렉토리의 경우를 고려하세요.
설정 실행 중 "Access denied" 오류가 발생했습니다
설치 스크립트를 실행하는 도중 다음을 보게 되면, 설정 파일의 사용자 이름 또는 비밀번호가 데이터베이스에 구성된 것과 일치하지 않는다는 것입니다.
Database Error #1045: Access denied for user 'notdvwa'@'localhost' (using password: YES).이 오류는 사용자 이름이 notdvwa임을 알려줍니다.
다음 오류는 설정 파일을 잘못된 데이터베이스에 연결한 것입니다.
SQL: Access denied for user 'dvwa'@'localhost' to database 'notdvwa'이것은 사용자가 dvwa 사용자를 사용하고 notdvwa 데이터베이스에 연결하려고 시도했다고 말하고 있습니다.
첫 번째 할 일은 설정 파일에 입력한 것이 실제로 있는지 확인하는 것입니다.
예상한 대로 맞는다면, 다음으로 할 일은 명령 줄에서 사용자로 로그인할 수 있는지 확인하는 것입니다. 데이터베이스 사용자가 dvwa이고 암호가 p@ssw0rd인 경우 다음 명령을 실행하세요.
mysql -u dvwa -pp@ssw0rd -D dvwa참고: -p 뒤에 공백이 없습니다.
다음과 같이 보인다면, 암호가 올바릅니다.
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]>명령 줄에서 연결할 수 있다면, 설정 파일에 무엇인가 잘못된 것이 있을 확률이 높습니다. 그러면 설정을 다시 확인한 후 문제를 해결할 수 없으면 문제를 제기하세요.
다음과 같은 내용을 보게 되면 사용자 이름 또는 비밀번호가 잘못되었습니다. Database Setup 단계를 반복하고 전체 과정에서 동일한 사용자 이름과 암호를 사용했는지 확인하세요.
ERROR 1045 (28000): Access denied for user 'dvwa'@'localhost' (using password: YES)다음과 같은 내용을 보게 되면 사용자 자격 증명은 올바르지만 사용자가 데이터베이스에 액세스할 수 없습니다. 다시 설정 단계를 반복하고 사용 중인 데이터베이스 이름을 확인하세요.
ERROR 1044 (42000): Access denied for user 'dvwa'@'localhost' to database 'dvwa'마지막으로 다음과 같은 오류를 볼 수 있습니다.
ERROR 2002 (HY000): 로컬 MySQL 서버에 소켓 '/var/run/mysqld/mysqld.sock'을(를) 통해 연결할 수 없습니다 (2)이것은 인증 문제가 아니라 데이터베이스 서버가 실행되지 않았음을 나타냅니다. 다음 명령으로 시작하세요.
sudo service mysql start연결 거부
다음과 유사한 오류가 발생하는 경우:
Fatal error: Uncaught mysqli_sql_exception: Connection refused in /var/sites/dvwa/non-secure/htdocs/dvwa/includes/dvwaPage.inc.php:535데이터베이스 서버가 실행되지 않거나 구성 파일에 잘못된 IP 주소가 있는 것을 의미합니다.
구성 파일에서 데이터베이스 서버가 예상되는 위치를 확인하려면 이 줄을 확인하십시오:
$_DVWA[ 'db_server' ] = '127.0.0.1';그런 다음이 서버로 이동하여 실행 중인지 확인하십시오. Linux에서는 다음과 같이 수행할 수 있습니다:
systemctl status mariadb.service다음과 같은 내용을 찾으시면 됩니다. 중요한 부분은 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실행 중이 아니라면 다음과 같이 시작할 수 있습니다:
sudo systemctl stop mariadb.servicesudo에 유의하고 요청 시 Linux 사용자 암호를 입력하십시오.
Windows에서는 XAMPP 콘솔에서 상태를 확인하십시오.
알려지지 않은 인증 방법
가장 최신 버전의 MySQL에서 PHP는 기본 구성으로 데이터베이스와 통신할 수 없게 되었습니다. 설정 스크립트를 실행하려고 하고 다음 메시지가 표시되는 경우 구성이 잘못되었음을 의미합니다.
Database Error #2054: The server requested authentication method unknown to the client.두 가지 옵션이 있습니다. 가장 쉬운 방법은 MySQL을 제거하고 MariaDB를 설치하는 것입니다. 다음은 MariaDB 프로젝트의 공식 가이드입니다:
https://mariadb.com/resources/blog/how-to-migrate-from-mysql-to-mariadb-on-linux-in-five-steps/
또는 다음 단계를 따르세요:
루트로 다음 파일을 편집하십시오:
/etc/mysql/mysql.conf.d/mysqld.cnf[mysqld]아래에 다음을 추가하십시오:default-authentication-plugin=mysql_native_password데이터베이스를 다시 시작하십시오:
sudo service mysql restart데이터베이스 사용자의 인증 방법을 확인하십시오:
sqlmysql> 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)caching_sha2_password를 보게 될 것입니다. 그렇다면 다음 명령을 실행하십시오:sqlmysql> ALTER USER dvwa@localhost IDENTIFIED WITH mysql_native_password BY 'p@ssw0rd';다시 확인을 실행하면 이제
mysql_native_password를 볼 수 있어야 합니다.sqlmysql> 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)
이 모든 과정을 거친 후 설정 프로세스가 정상적으로 작동해야 합니다.
더 많은 정보가 필요하면 다음 페이지를 참조하십시오: https://www.php.net/manual/en/mysqli.requirements.php.
데이터베이스 오류 #2002: 해당 파일 또는 디렉터리가 없습니다.
데이터베이스 서버가 실행되지 않습니다. Debian 기반 배포판에서는 다음 명령을 사용하여 실행할 수 있습니다:
sudo service mysql start"MySQL 서버가 종료되었습니다" 및 "패킷 순서가 잘못되었습니다" 오류
이러한 오류가 발생하는 몇 가지 이유가 있지만, 가장 가능성이 높은 이유는 실행 중인 데이터베이스 서버 버전이 PHP 버전과 호환되지 않기 때문입니다.
이는 MySQL의 최신 버전을 실행 중일 때 가장 흔하게 발생하는 현상입니다. PHP와 MySQL이 잘 동작하지 않습니다. 가장 좋은 조언은 MySQL을 버리고 MariaDB를 설치하는 것입니다. 이는 우리가 지원할 수 없는 문제입니다.
더 많은 정보는 다음을 참조하십시오:
https://www.ryadel.com/en/fix-mysql-server-gone-away-packets-order-similar-mysql-related-errors/
명령 삽입이 작동하지 않습니다
Apache가 웹 서버에서 명령을 실행할 충분한 권한을 갖고 있지 않을 수 있습니다. Linux에서 DVWA를 실행 중인 경우 root로 로그인했는지 확인하십시오. Windows에서는 관리자로 로그인하십시오.
CentOS에서 데이터베이스가 연결되지 않는 이유는 무엇입니까?
SELinux와 관련된 문제로 인해 문제가 발생할 수 있습니다. SELinux를 비활성화하거나 다음 명령을 실행하여 웹 서버가 데이터베이스와 통신할 수 있도록 합니다:
setsebool -P httpd_can_network_connect_db 1그 외 문제
최신 문제 해결 정보를 위해 git 저장소의 열린 및 닫힌 티켓을 모두 읽어보십시오:
https://github.com/digininja/DVWA/issues
티켓을 제출하기 전에 저장소에서 최신 코드를 실행 중인지 확인하십시오. 이것은 최신 릴리스가 아니라 master 브랜치의 최신 코드입니다.
티켓을 제출할 때 다음 정보를 적어도 제출하십시오:
- 운영 체제
- 오류가 발생한 직후 웹 서버 오류 로그의 마지막 5줄
- 데이터베이스 인증 문제인 경우 위의 단계를 따라서 각 단계의 스크린샷을 찍어 제출하십시오. 이것들을 데이터베이스 사용자 및 암호가 표시된 구성 파일 섹션의 스크린샷과 함께 제출하십시오.
- 문제가 발생한 상황에 대한 완전한 설명, 기대하는 동작 및 문제를 해결하기 위해 시도한 내용에 대한 설명입니다. "로그인이 고장나 있음"만으로는 문제를 이해하고 해결하는 데 충분하지 않습니다.
튜토리얼
일부 취약점을 식별하고 그것을 감지하고 그것을 악용하는 방법을 보여주는 튜토리얼 비디오를 만들어 보겠습니다. 지금까지 제작한 튜토리얼은 다음과 같습니다:
SQLite3 SQL Injection
SQL Injection과 Blind SQL Injection은 기본적으로 사이트에서 사용하는 MariaDB/MySQL 서버에 대해 수행됩니다. 그러나 SQLite3에 대한 SQL Injection 테스트를 수행할 수도 있습니다.
SQLite3를 PHP와 함께 작동시키는 방법에 대해 다루지 않겠지만, php-sqlite3 패키지를 설치하고 활성화하는 것으로 간단히 설정할 수 있습니다.
전환하기 위해 구성 파일을 수정하고 다음 라인을 추가하거나 편집하십시오:
$_DVWA["SQLI_DB"] = "sqlite";
$_DVWA["SQLITE_DB"] = "sqli.db";기본적으로 database/sqli.db 파일을 사용하며, 문제가 발생하면 단순히 database/sqli.db.dist 파일을 덮어쓰면 됩니다.
도전 과제는 MySQL과 정확히 동일하며, SQLite3에서 실행됩니다.
👨💻 기여자
모든 기여하신 분들께 감사드립니다. :heart:
아이디어, 개선 사항 또는 단순히 협력하고자 하시면 언제든지 기여하고 프로젝트에 참여할 수 있습니다. PR을 보내 주시기 바랍니다.
취약점 보고
간단히 말해서, 부디 그러지 마십시오!
매년 누군가가 앱에서 발견한 취약점을 보고하는 경우가 있습니다. 어떤 것은 잘 쓰여진 보고서이며 유료 펜 테스트 보고서보다 나을 때도 있습니다. 어떤 것은 그저 "헤더가 누락되었습니다, 제게 돈을 주세요"입니다.
2023년에는 누군가가 CVE 요청을 통해 하나의 취약점에 대한 CVE를 받았습니다. 그들에게 CVE-2023-39848가 부여되었습니다. 많은 재미있는 일이 일어나고 시간이 소비되었습니다.
앱에는 취약점이 있습니다. 이는 고의입니다. 대부분은 교훈으로 작동하는 잘 알려진 것들이며, 다른 것들은 "숨겨진" 것들입니다. 당신의 기술로 숨겨진 추가 기능을 찾아내고 싶다면, 블로그 포스트를 작성하거나 비디오를 만들어 찾은 방법 및 이들을 알아보는 사람들이 있을 수 있습니다. 우리에게 링크를 보내주시면 참조 목록에 포함할 수도 있습니다.
링크
프로젝트 홈: https://github.com/digininja/DVWA
DVWA 팀 제작