Skip to content

Path traversal in FilesDownloadHandler

High
driusan published GHSA-47jj-7xfg-8759 Apr 8, 2026

Package

No package listed

Affected versions

LORIS >= 24.0.0 && <= 27.0.2, 28.0.0

Patched versions

>=27.0.3, >= 28.0.1

Description

Impact

An incorrect order of operations in the FilesDownloadHandler could result in an attacker escaping the intended download directories.

Patches

This problem is fixed in LORIS 27.0.3 and 28.0.1.

diff --git a/modules/document_repository/php/files.class.inc b/modules/document_repository/php/files.class.inc
index 522ea112f..f298098a6 100644
--- a/modules/document_repository/php/files.class.inc
+++ b/modules/document_repository/php/files.class.inc
@@ -87,7 +87,7 @@ class Files extends \NDB_Page
 
             $filename = explode(
                 'Files',
-                urldecode($request->getUri()->getPath())
+                $request->getUri()->getPath()
             )[1];
 
             $downloader = new \LORIS\FilesDownloadHandler(
diff --git a/modules/electrophysiology_uploader/php/upload.class.inc b/modules/electrophysiology_uploader/php/upload.class.inc
index 28dad3ec6..bfce104d2 100644
--- a/modules/electrophysiology_uploader/php/upload.class.inc
+++ b/modules/electrophysiology_uploader/php/upload.class.inc
@@ -88,20 +88,15 @@ class Upload extends \NDB_Page
             );
         }
 
-        $filename      = urldecode(basename($file));
-        $pos           = strrpos($file, '/');
-        $file_rel_path = $pos === false ? '' : substr($file, 0, $pos);
-        $config        = \NDB_Config::singleton();
-        $upload_dir    = new \SplFileInfo(
-            $config->getSetting('EEGUploadIncomingPath')
-        );
+        $config     = \NDB_Config::singleton();
+        $upload_dir = $config->getSetting('EEGUploadIncomingPath');
 
         $downloader = new \LORIS\FilesDownloadHandler(
-            new \SPLFileInfo($upload_dir . '/' . $file_rel_path)
+            new \SPLFileInfo($upload_dir)
         );
 
         return $downloader->handle(
-            $request->withAttribute('filename', $filename)
+            $request->withAttribute('filename', $file)
         );
     }
 
diff --git a/php/libraries/FilesDownloadHandler.php b/php/libraries/FilesDownloadHandler.php
index fdae9605a..a9ec50d4a 100644
--- a/php/libraries/FilesDownloadHandler.php
+++ b/php/libraries/FilesDownloadHandler.php
@@ -76,7 +76,7 @@ class FilesDownloadHandler implements RequestHandlerInterface
         }
 
         assert(is_string($filename) || $filename instanceof \Stringable);
-        $filename = urldecode(\Utility::resolvePath(strval($filename)));
+        $filename = \Utility::resolvePath(urldecode(strval($filename)));
 
         $targetPath = \Utility::appendForwardSlash(
             $this->downloadDirectory->getPathname()

LORIS Modules Affected

  • data_release
  • document_repository
  • electrophysiology_browser
  • electrophysiology_uploader
  • genomic_browser
  • media
  • mri_violations
  • publication

Workarounds

LORIS projects should upgrade to a patch version but if they can not can either apply the advisory's patch or disable all modules affected.

Credits

This vulnerability was discovered and reported by the the Ministère de la Cybersécurité et du Numérique.

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N

CVE ID

CVE-2026-35446

Weaknesses

Files or Directories Accessible to External Parties

The product makes files or directories accessible to unauthorized actors, even though they should not be. Learn more on MITRE.

Credits