Skip to content

Commit

Permalink
AssetController: directory traversal vulnerability issue
Browse files Browse the repository at this point in the history
git-svn-id: http://www.pimcore.org/svn/pimcore/private/core/trunk@6458 1f8fe7d8-47f0-464c-8d0a-336f4953ab05
  • Loading branch information
memleak committed Apr 20, 2015
1 parent 64f8b90 commit 4f2a95f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pimcore/modules/admin/controllers/AssetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ protected function addAsset()
$parent = Asset::getById($this->getParam("parentId"));
$newPath = $parent->getFullPath() . "/" . trim($this->getParam("dir"), "/ ");

// check if the path is outside of the asset directory
$newRealPath = PIMCORE_ASSET_DIRECTORY . $newPath;
$newRealPath= realpath($newRealPath);
if (strpos($newRealPath, PIMCORE_ASSET_DIRECTORY) !== 0) {
throw new Exception("not allowed");
}

$maxRetries = 5;
for ($retries=0; $retries<$maxRetries; $retries++) {
try {
Expand Down

0 comments on commit 4f2a95f

Please sign in to comment.