View Issue Details

IDProjectCategoryView StatusLast Update
0008884Kali LinuxKali Package Bugpublic2024-09-11 08:49
Reporterbitvijays Assigned Tosbrun  
PrioritynormalSeverityminorReproducibilityhave not tried
Status assignedResolutionopen 
Summary0008884: DVWA Start | Stop Service failure
Description

Dear Kali Linux DVWA Maintainer,

Hope you are doing well. Thank you for your hard work and creating a package to deploy DVWA on Kali. It is much appreciated. Recently, we tried to utilize the package to install DVWA on minimal debian (mainly adding Kali repo and install dvwa). Trying to create a vulnerable machine but without Kali OS and running on base minimal debian.

The installation failed multiple times but mainly because of the below error (Database was already existing)

Aug 22 19:22:43 WKS02-debian systemd[1]: Starting dvwa.service - The Damn Vulnerable Web Application in its own nginx server...
Aug 22 19:22:43 WKS02-debian sudo[22412]:     root : PWD=/ ; USER=root ; COMMAND=/usr/bin/mysql -Bse 'CREATE DATABASE dvwa;'
Aug 22 19:22:43 WKS02-debian sudo[22412]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Aug 22 19:22:43 WKS02-debian create-database-dvwa[22413]: ERROR 1007 (HY000) at line 1: Can't create database 'dvwa'; database exists
Aug 22 19:22:43 WKS02-debian sudo[22412]: pam_unix(sudo:session): session closed for user root
Aug 22 19:22:43 WKS02-debian systemd[1]: dvwa.service: Control process exited, code=exited, status=1/FAILURE
Aug 22 19:22:43 WKS02-debian systemd[1]: dvwa.service: Failed with result 'exit-code'.
Aug 22 19:22:43 WKS02-debian systemd[1]: Failed to start dvwa.service - The Damn Vulnerable Web Application in its own nginx server.

and

Aug 22 19:22:17 WKS02-debian sudo[22394]:     root : PWD=/ ; USER=root ; COMMAND=/usr/bin/mysql -Bse 'CREATE DATABASE dvwa;'
Aug 22 19:22:17 WKS02-debian sudo[22394]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Aug 22 19:22:17 WKS02-debian sudo[22394]: pam_unix(sudo:session): session closed for user root
Aug 22 19:22:17 WKS02-debian sudo[22396]:     root : PWD=/ ; USER=root ; COMMAND=/usr/bin/mysql -Bse 'CREATE USER dvwa@localhost IDENTIFIED BY \'p@ssw0rd\';'
Aug 22 19:22:17 WKS02-debian sudo[22396]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Aug 22 19:22:17 WKS02-debian create-database-dvwa[22397]: ERROR 1396 (HY000) at line 1: Operation CREATE USER failed for 'dvwa'@'localhost'
Aug 22 19:22:17 WKS02-debian sudo[22396]: pam_unix(sudo:session): session closed for user root
Aug 22 19:22:17 WKS02-debian systemd[1]: dvwa.service: Control process exited, code=exited, status=1/FAILURE
Aug 22 19:22:17 WKS02-debian systemd[1]: dvwa.service: Failed with result 'exit-code'.
Aug 22 19:22:17 WKS02-debian systemd[1]: Failed to start dvwa.service - The Damn Vulnerable Web Application in its own nginx server.

Although, we completely understand that it is running absolutely fine in Kali Linux. Would it be possible to change the create-database-dvwa to check for condition (IF NOT EXISTS) if the database and user already exists?

From the current

if ! mysqlshow "dvwa" > /dev/null 2>&1; then
    sudo mysql -Bse "CREATE DATABASE dvwa;"
    sudo mysql -Bse "CREATE USER dvwa@localhost IDENTIFIED BY 'p@ssw0rd';"
    sudo mysql -Bse "GRANT ALL ON dvwa.* TO dvwa@localhost;"
    sudo mysql -Bse "FLUSH PRIVILEGES;"
fi

to

if ! mysqlshow "dvwa" > /dev/null 2>&1; then
    sudo mysql -Bse "CREATE DATABASE IF NOT EXISTS dvwa;"
    sudo mysql -Bse "CREATE USER IF NOT EXISTS dvwa@localhost IDENTIFIED BY 'p@ssw0rd';"
    sudo mysql -Bse "GRANT ALL ON dvwa.* TO dvwa@localhost;"
    sudo mysql -Bse "FLUSH PRIVILEGES;"
fi

Currently, we don't know why the installation failed at first time but we had to manually drop the database and delete the user. We understand that as it's not affecting Kali Linux, it's not a priority. We would really appreciate it if change is doable. It would help us deploy DVWA on non-kali machines.

Update:

It is affecting Kali-Linux too. To recreate the bug run dvwa-start, dvwa-stop and then again dvwa-start.

Kind Regards,
Vijay

Activities

sbrun

sbrun

2024-09-11 08:49

manager   ~0019736

Thanks for the report.

I have uploaded a fixed version 2.2.2-0kali2. It's available in kali-rolling.

Issue History

Date Modified Username Field Change
2024-08-23 11:39 bitvijays New Issue
2024-08-28 19:10 steev Assigned To => sbrun
2024-08-28 19:10 steev Status new => assigned
2024-09-11 08:49 sbrun Note Added: 0019736