Unrestricted Upload of File with Dangerous Type in dmpop/mejiro


Reported on

Sep 14th 2021


Uploaded files represent a significant risk to applications. The first step in many attacks is to get some code to the system to be attacked. Then the attack only needs to find a way to get the code executed. Using a file upload helps the attacker accomplish this.

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

Proof of Concept

Resource: upload.php Variable: $_FILES Snippet:

    if (isset($_POST['submit'])) {
        // count total files
        $countfiles = count($_FILES['file']['name']);
        // looping all files
        for ($i = 0; $i < $countfiles; $i++) {
            $filename = $_FILES['file']['name'][$i];
            // upload file
            move_uploaded_file($_FILES['file']['tmp_name'][$i], $upload_dir . DIRECTORY_SEPARATOR . $filename);


  1. Create a file called info.php with the following content:
  1. Go to http://localhost/mejiro-main/upload.php select info.php
  2. Clic upload
  3. Go to http://localhost/mejiro-main/photos/info.php and observe phpinfo is executed.


The consequences of unrestricted file upload can vary, including complete system takeover, an overloaded file system or database, forwarding attacks to back-end systems, client-side attacks, or simple defacement. It depends on what the application does with the uploaded file and especially where it is stored.

We created a GitHub Issue asking the maintainers to create a SECURITY.md 2 years ago
We have contacted a member of the dmpop/mejiro team and are waiting to hear back a year ago
Dmitri Popov validated this vulnerability a year ago
hitisec has been awarded the disclosure bounty
The fix bounty is now up for grabs
Dmitri Popov marked this as fixed with commit 23429b a year ago
Dmitri Popov has been awarded the fix bounty
This vulnerability will not receive a CVE
to join this conversation