[security:CVE-2022-26960] fix a path traversal issue

Fixed a paste traversal vulnerability. The problem was getting out of
the configured directory and allowing the hosting server's file system
to read and write "arbitrary" files.

Special thanks to Gaetan Ferry (Synacktiv) for reporting this issue.
This commit is contained in:
nao-pon
2022-03-08 22:03:38 +09:00
parent 93da3059fb
commit 3b75849553
2 changed files with 15 additions and 3 deletions
@@ -485,6 +485,7 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver
if ($path === DIRECTORY_SEPARATOR) {
return $this->root;
} else {
$path = $this->_normpath($path);
if (strpos($path, $this->systemRoot) === 0) {
return $path;
} else if (DIRECTORY_SEPARATOR !== '/' && preg_match('/^[a-zA-Z]:' . preg_quote(DIRECTORY_SEPARATOR, '/') . '/', $path)) {