Skip to content

Commit

Permalink
Fixed issue [security] #16018: Path Traversal Vulnerability (Matthew …
Browse files Browse the repository at this point in the history
…Aberegg, Michael Burkey)
  • Loading branch information
olleharstedt committed Mar 24, 2020
1 parent c0b93c3 commit daf50eb
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions application/controllers/admin/LimeSurveyFileManager.php
Expand Up @@ -380,11 +380,7 @@ public function downloadFiles() {
$checkFileCreate = $archive->create($arrayOfFiles, PCLZIP_OPT_REMOVE_ALL_PATH);
$urlFormat = Yii::app()->getUrlManager()->getUrlFormat();
$getFileLink = Yii::app()->createUrl('admin/filemanager/sa/getZipFile');
if($urlFormat == 'path') {
$getFileLink .= '?path='.$zipfile;
} else {
$getFileLink .= '&path='.$zipfile;
}
$_SESSION['__path'] = $zipfile;

$this->_printJsonResponse(
[
Expand All @@ -395,15 +391,16 @@ public function downloadFiles() {
);
}

public function getZipFile($path) {
/**
* @return void
*/
public function getZipFile()
{
$path = $_SESSION['__path'];
unset($_SESSION['__path']);
$filename = basename($path);

// echo "<pre>";
// echo $path."\n";
// echo $filename."\n";
// echo "isFile => ".is_file($path) ? 'isFile' : 'isNoFile'."\n";
// echo "</pre>";
if (is_file($path) || true) {
if (is_file($path)) {
// Send the file for download!
header("Expires: 0");
header("Cache-Control: must-revalidate");
Expand Down

0 comments on commit daf50eb

Please sign in to comment.