Summary
LORIS contains a path traversal flaw in its file upload handling that allows an authenticated user with sufficient privileges to write files to arbitrary locations on the server.
When combined with the ability to upload executable content, this can enable remote code execution (RCE), although impact depends on server write permissions and runtime configuration.
Affected context
The vulnerability exists in LORIS deployments where authenticated users with elevated permissions can upload media or other files through the web interface.
It is triggered when the upload mechanism accepts user-controlled paths or filenames that are not correctly normalized and validated, allowing directory traversal out of the intended storage directory.
In environments where the web server or application can execute files from attacker-controlled locations, arbitrary file upload to those paths can escalate to remote code execution.
On servers configured as read-only, attackers may still be able to attempt malicious uploads, but subsequent execution of those files is constrained by the underlying filesystem and runtime configuration.
Exploit preconditions
- Attack surface: LORIS web interface, specifically the media or file upload functionality.
- Required access: Valid authenticated account with sufficient privileges to upload files via the relevant module.
- Trigger point: Submission of a crafted upload request that includes a manipulated file path or filename containing traversal sequences (for example, using
../-style patterns) and potentially executable content. - Why exploitation is possible: The upload handler does not safely canonicalize and constrain the target file path to an allowed directory and does not sufficiently enforce file type or storage location restrictions. This allows a user-controlled path to influence where the file is written on disk, and in some configurations that location can be interpreted or executed by the server.
Why this happens
The root cause combines two common web application weaknesses:
- Path traversal (CWE-22): The application trusts user input to build filesystem paths during file upload, without robust normalization, canonicalization, and enforcement that the resulting path stays within an intended directory. As a result, directory traversal sequences can break out of the upload directory and target arbitrary locations on the server.
- Unrestricted file upload (CWE-434): The upload mechanism does not adequately restrict which file types, content, or destinations are allowed, and does not guarantee that uploaded files are stored in non-executable locations.
Abstractly, this pattern is "user-controlled path plus user-controlled content equals arbitrary file write," which becomes especially dangerous when the web server or application runtime can later interpret or execute the uploaded file.
Potential impact
- Authenticated remote code execution by placing executable files in directories processed by the web server or application runtime.
- Overwriting or planting configuration files, scripts, or other sensitive assets, depending on filesystem permissions.
- Establishment of persistent backdoors or web shells for ongoing access.
- Data integrity compromise through tampering with application resources or stored research data.
- Potential lateral movement within the hosting environment if the compromised process has access to additional systems or services.
General mitigation guidance
Effective mitigation typically focuses on strictly controlling both where files can be written and what can be uploaded:
- Constrain upload destinations to a single, non-executable directory outside of the web root, using server-side path construction that ignores any directory components supplied by the client.
- Normalize and canonicalize file paths, then enforce that the resolved path remains within a predefined upload directory (e.g., by comparing canonical paths or using whitelisted storage backends).
- Enforce strict allowlists for file types and content, avoiding reliance on client-side checks or file extensions alone.
- Configure the web server to never execute uploaded content; treat upload directories as data-only with appropriate MIME and handler settings.
- Apply least-privilege filesystem permissions so that the application user can write only to designated upload directories and cannot modify application code or configuration.
- Where modules (such as media features) are not required, disable or remove them to reduce the exposed attack surface.
How teams detect issues like this
Organizations can use a combination of preventative and detective measures to identify and manage this class of issue:
- Static analysis: Configure rules to flag usage of user-controlled input in filesystem APIs (e.g., open/write/move operations) without canonicalization and directory constraints, and to detect upload handlers that use raw user filenames or directory parameters.
- Code review: During manual reviews, look for upload endpoints that:
- Accept arbitrary filenames or paths from the client.
- Directly concatenate user input into filesystem paths.
- Store uploaded files under web-exposed directories or executable locations.
- Runtime monitoring: Log all file uploads with resolved paths and monitor for suspicious patterns such as traversal sequences, uploads to unexpected directories, or executable file types in upload logs.
- Security testing: Include authenticated file upload workflows in regular penetration tests and automated DAST scans to probe for path traversal and arbitrary file write behaviors.
- Policy enforcement: Use CI/CD checks or automated review tools to enforce secure upload patterns and prohibit direct mapping of user input to filesystem paths.

