CVE-2026-105314 in Papermergeinfo

Summary

by MITRE • 10/05/2026

Papermerge 3.5.3 allows remote code execution by a standard user via directory traversal in a /api/documents/upload call. A Python .pth file can be written to site-packages, and its code is executed upon the next start of the Python interpreter.

If you want to get the best quality for vulnerability data then you always have to consider VulDB.

Analysis

by VulDB Data Team • 10/05/2026

The vulnerability identified in Papermerge version 3.5.3 represents a critical remote code execution flaw stemming from inadequate input validation within the document upload API endpoint. Specifically, the /api/documents/upload route fails to properly sanitize file paths provided by the client during the upload process. This deficiency allows an authenticated standard user to manipulate the destination directory through directory traversal techniques using sequences such as dot-dot-slash. By carefully crafting a filename or path parameter that includes these traversal characters, an attacker can redirect the write operation from the intended temporary or document storage directories to arbitrary locations on the server's file system.

The severity of this vulnerability is significantly amplified by its interaction with Python’s package management mechanisms. The attacker leverages the directory traversal flaw to write a specially crafted .pth (path configuration) file into the site-packages directory, which is part of the global or virtual environment where Python modules are installed. When a Python interpreter starts up, it automatically processes any .pth files found in this directory. These files can contain simple path additions for module discovery but also support executable lines prefixed with import statements or direct code execution commands under certain configurations and versions. By placing malicious code within a .pth file located in site-packages, the attacker ensures that their payload will be executed every time the Papermerge application server restarts or initializes its Python environment.

This attack vector allows for persistent remote code execution without requiring elevated privileges beyond standard user access. Since the exploitation relies on writing to system directories typically protected by operating system permissions, it assumes either a misconfigured file permission structure where the web service process has write access to site-packages, or that the application runs with sufficient privileges to modify these locations. Once executed, the malicious code can perform any action permitted by the user account running the Python interpreter, including reading sensitive documents stored within Papermerge, exfiltrating data to external servers, installing backdoors, or pivoting to other systems on the internal network. The impact is severe as it compromises the confidentiality, integrity, and availability of the entire application infrastructure dependent on that instance.

From a classification perspective, this vulnerability aligns with CWE-20 Improper Input Validation regarding the failure to neutralize special elements in input data, specifically directory traversal sequences. It also maps closely to CWE-94 Improper Control of Generation of Code (Code Injection) because it involves injecting executable code into the application’s runtime environment through file manipulation. In terms of adversary tactics, this technique corresponds to ATT&CK T1505.003 Server Software Component: Web Shell or more broadly T1105 Ingress Tool Transfer if used to deploy additional payloads, and T1496 Resource Hijacking if the code is used for cryptomining or other resource abuse. The persistence mechanism via .pth files falls under ATT&CK T1547.002 Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder equivalent in Python environments, allowing long-term access even after service restarts.

Mitigation strategies must address both the immediate technical flaw and broader security hygiene practices. The primary remediation is to apply the vendor-provided patch that updates Papermerge to a version where input validation for file paths has been strictly enforced. Developers should implement allow-listing of permitted characters in filenames and enforce strict path canonicalization before any file system operations are performed. It is critical to ensure that the web application process runs under a restricted user account with minimal privileges, specifically denying write access to Python’s site-packages directory or other sensitive system directories. Additionally, implementing Content Security Policies and rigorous input sanitization libraries can help prevent similar injection attacks in future development cycles. Regular auditing of file permissions within deployment environments is essential to ensure that runtime processes do not possess unnecessary administrative rights over critical application components.

Responsible

MITRE

Reservation

10/05/2026

Disclosure

10/05/2026

Moderation

accepted

EPSS

0.00000

KEV

no

Activities

very low

Sources

Might our Artificial Intelligence support you?

Check our Alexa App!