Skip to content

Possible path manipulation vulnerability #1760

Closed
@enferas

Description

@enferas

Hello,

I would like to report for path manipulation vulnerability.

The path of the vulnerability.

In file https://github.com/LibreTime/libretime/blob/master/legacy/application/modules/rest/controllers/ShowImageController.php

line 319

private function getShowId()
    {
        if (!($id = $this->_getParam('id', false))) {
            //...
        }
        return $id;
    }

line 52

public function postAction()
{
        $showId = $this->getShowId();

        //...

        try {
            $path = $this->processUploadedImage($showId, $_FILES['file']['tmp_name']);
        } catch (Exception $e) {
            // ...
        }
}

line 163

private function processUploadedImage($showId, $tempFilePath)
{
        //...
        $importedStorageDirectory = $storDir->getDirectory() . 'imported/' . $ownerId . '/show-images/' . $showId;

        try {
            $importedStorageDirectory = $this->copyFileToStor($tempFilePath, $importedStorageDirectory, $fileExtension);
        } catch (Exception $e) {
            // ...
        }
}

In file https://github.com/LibreTime/libretime/blob/master/legacy/application/common/OsPath.php

line 56

public static function join()
{
    $args = func_get_args();
    $paths = [];

    foreach ($args as $arg) {
        $paths = array_merge($paths, (array) $arg);
    }

    foreach ($paths as &$path) {
        $path = trim($path, DIRECTORY_SEPARATOR);
    }

    if (substr($args[0], 0, 1) == DIRECTORY_SEPARATOR) {
        $paths[0] = DIRECTORY_SEPARATOR . $paths[0];
    }

    return implode(DIRECTORY_SEPARATOR, $paths);
}

In file https://github.com/LibreTime/libretime/blob/master/legacy/application/modules/rest/controllers/ShowImageController.php

line 256

$image_stor = Application_Common_OsPath::join($importedStorageDirectory, $newFileName);

line 260

// path manipulation in rename function
if (@rename($image_file, $image_stor) === false) {
            //...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions