digininja / DVWA

Damn Vulnerable Web Application (DVWA)
GNU General Public License v3.0
10.34k stars 3.63k forks source link

file inclusion error #635

Closed cmq104 closed 6 months ago

cmq104 commented 6 months ago

Questions here may or may not be answered depending on the state of the question, to increase your chance, read this before asking Asking For Technical Help.

Basically, the more details you give, the more chance of getting an answer. We need at least:

I write a python script to detect path travelsal vulnerabilities ,and it report Array to string conversion error.

my setup is in following picture image

Support will only be given for users running the latest pull of code from GitHub. Not a tagged release, not a pre-installed app, not a ZIP you got from a mate.

digininja commented 6 months ago

It looks like you aren't running the latest version of DVWA

This is line 77 along with context and that line is not going to throw the error you are seeing.

 70 
 71     session_set_cookie_params([
 72         'lifetime' => $maxlifetime,
 73         'path' => '/',
 74         'domain' => $domain,
 75         'secure' => $secure,
 76         'httponly' => $httponly,
 77         'samesite' => $samesite
 78     ]);
 79 
 80     session_start();
 81 

Get the latest version of the app from this repo and try again.

cmq104 commented 6 months ago

I tried two ways to download latest version , one for downloading code zip , one for git clone , the following picture shows how i git clone image and then i copy it into apache2 and restart apache2 image but it shows the same error image the following picture shows /var/www/html/DVWA/dvwa/includes/dvwaPage.inc.php image

btw, i don't understand why it can report this error either :( it seems there is no array to string in line 77

digininja commented 6 months ago

Let's just check that you are looking at the right file. Edit /var/www/html/DVWA/dvwa/includes/dvwaPage.inc.php and insert three lines of empty comments at the top of the file. If the report is coming from this file, then the error should move to line 80, if it stays at 77 then something else is going wrong.

cmq104 commented 6 months ago

i insert four blank at the top 6f73f8b00c8643c82ed5f4c8846e8db and it shows in line 81 now 36e8567a80c16b4482b10e7a12b04eb

digininja commented 6 months ago

Got it, I think you might be running a version of PHP earlier than 7.3, can you check.

The definition of session_set_cookie_params changed from taking individual parameters to being able to take an array with named parameters from 7.3:

https://www.php.net/session_set_cookie_params

Version 7.2 reached end of life in 2020 so I'll count this as an unsupported version and ask you to upgrade to a newer version of php.

cmq104 commented 6 months ago

I see. My linux is ubuntu18.04 and apt-get only supply php7.2 i'll upgrade my system to 20.04 and try again anyway ,thank you very much for your answering

digininja commented 6 months ago

Problem solved.