/

CVE-2026-42315

Severity:

HIGH RISK

(8.1)

Path Traversal / Arbitrary File System Access

CVE-2026-42315

Analyzed

Vulnerability type

Category:

Path Traversal / Arbitrary File System Access

CWE:

CWE-22, CWE-36

Impact:

Arbitrary File Write to Attacker-Chosen Directories

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

pyLoad's set_package_data() API failed to sanitize the _folder field, allowing users with modification permissions to specify arbitrary filesystem paths as download targets.

Under these conditions, a malicious or compromised user account can direct downloads into sensitive or unintended directories, potentially overwriting or planting files in security-critical locations.

Affected context

This vulnerability appears in pyLoad deployments that:

  • Expose or integrate the set_package_data() API, and
  • Allow users with Perms.MODIFY to control or update package metadata, including _folder.

The issue is relevant when the download server runs with access to directories beyond a confined, application-specific data area. It is most impactful when the pyLoad process has permissions to write into system directories, shared storage, or other applications' data locations.

Exploit preconditions

  • Attack surface: Application API layer (programmatic access to set_package_data()).
  • Required access: An authenticated account or API token with at least Perms.MODIFY.
  • Trigger point: Passing a crafted value in the _folder key within the data object to set_package_data(), causing pyLoad to use that path as the download destination.
  • Why exploitation is possible: The _folder parameter is used directly as a filesystem path without normalization, restriction to an allowed base directory, or checks against path traversal and absolute paths, enabling writes outside intended download areas.

Why this happens

The underlying bug stems from unvalidated, user-controlled filesystem paths being used to construct download destinations.

In the set_package_data() API, the _folder key is treated as a trusted directory path and passed to the filesystem layer without:

  • Normalizing or canonicalizing the path,
  • Enforcing a fixed base directory,
  • Rejecting absolute paths or .. segments.

This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') and is closely related to CWE-36: Absolute Path Traversal, because an attacker can specify arbitrary absolute or traversal-based locations.

Potential impact

  • File downloads may be written into arbitrary directories accessible by the pyLoad process.
  • Attackers can plant or overwrite files in configuration directories, logs, or shared application data.
  • System integrity may be degraded if critical files (e.g., scripts, service configs) are overwritten where permissions allow.
  • Other applications or services may be influenced by tampered files (e.g., altered configuration leading to unsafe behavior).
  • Privacy and data segregation guarantees can be undermined by writing into other users' or tenants' directories.

General mitigation guidance

Effective mitigation focuses on constraining and validating download paths:

  • Treat all user-controlled path components (including _folder) as untrusted data and never use them directly as absolute paths.
  • Enforce a strict, application-controlled base directory for all downloads, and resolve paths relative to this sandbox only.
  • Normalize and canonicalize paths before use, and reject any that escape the allowed root via .. or symlink-based traversal.
  • Block absolute paths and paths containing prohibited characters or patterns, according to the deployment platform.
  • Apply least-privilege principles to the pyLoad process so it can write only to designated data directories, not to system or application code locations.
  • Design APIs such that clients select from predefined storage locations or IDs rather than supplying raw filesystem paths.

How teams detect issues like this

To detect this class of issue and its potential abuse:

  • Use static analysis or code scanning tools to flag direct use of user-controlled values in filesystem APIs (e.g., open, mkdir, os.path.join) without path canonicalization and boundary checks.
  • During code review, look for:
  • API parameters that represent directories or filenames,
  • Lack of validation or normalization on those parameters,
  • Absence of enforced base-directory constraints.
  • Implement server-side logging of requested download directories and periodically review for suspicious paths (absolute references, /etc, /var, ../, or other atypical locations).
  • Introduce defensive runtime checks or assertions around path resolution to prevent future regressions, and monitor test suites for coverage of path edge cases.

Sources

SourceLink
github.comgithub.com/pyload/pyload/security/advisories/GHSA-838g-gr43-qqg9

Frequently asked

questions

Yes, if the set_package_data() API is accessible over the network and an attacker can obtain or compromise an account or token with Perms.MODIFY. The attack does not require local shell access, only the ability to invoke the API.

Exploitation requires at least Perms.MODIFY within pyLoad. Anonymous or read-only users cannot abuse this behavior directly, but any compromised or malicious user with modification rights can attempt to write downloads into arbitrary directories.

The most robust fix is to strictly constrain all download destinations to a predefined base directory, normalize requested paths, and reject any that resolve outside this boundary. In addition, avoid accepting raw absolute paths from clients and instead map logical identifiers to server-side directory locations.

Adopt a consistent design where filesystem access is mediated through a small, well-reviewed abstraction that:

  • Normalizes and canonicalizes all paths,
  • Enforces a root directory constraint,
  • Rejects dangerous constructs (absolute paths, .., unexpected symlinks),
  • Is covered by automated tests for edge cases.

Combine this with least-privilege deployment of services so that even if a path validation mistake occurs, the process cannot affect sensitive parts of the filesystem.

Find out what's already
exploitable in your codebase.