/

CVE-2026-90774

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-22) in Rustypaste Upload Handler

CVE-2026-90774

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Write

Severity:

HIGH RISK

(7.5)

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

A path traversal vulnerability in rustypaste allows a custom filename supplied through an HTTP header to escape the configured upload directory. An attacker who can submit uploads may write files to arbitrary filesystem locations when the application validates the destination before incorporating the custom filename.

Affected context

The vulnerability occurs in rustypaste deployments that support an optional custom filename HTTP header and validate the upload destination before applying that filename. When path components from the header are not revalidated against the configured directory, a crafted upload request may resolve outside the intended storage location.

Exploit preconditions

  • Attack surface: HTTP upload functionality
  • Required access: Ability to submit an upload request and provide the custom filename header
  • Trigger point: Construction of the final destination path during upload handling
  • Why exploitation is possible: Directory-boundary validation is performed before the attacker-controlled filename is incorporated, allowing the final path to escape the configured upload directory

Why this happens

The underlying bug is an order-of-validation error combined with insufficient path canonicalization. The application checks a destination path before incorporating attacker-controlled filename data, so the security decision does not cover the final path that will be used for file creation. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, in which untrusted path components can influence filesystem access outside an intended directory.

Potential impact

  • Attackers may write files outside the configured upload directory
  • Sensitive files may be overwritten or corrupted
  • Application configuration or executable files could be modified
  • The service may experience denial of service
  • Arbitrary file writes could contribute to code execution, depending on filesystem permissions and file locations

General mitigation guidance

Mitigation generally focuses on treating filenames as untrusted data and validating the complete destination path after all user-controlled components have been incorporated.

Common defensive patterns include:

  • Resolve and canonicalize the final path before performing filesystem operations
  • Enforce that the resolved path remains within a dedicated upload directory
  • Prefer generated server-side filenames over client-supplied names
  • Reject path separators, traversal components, and unexpected encoding forms where custom names are supported
  • Store uploads under a separate, minimally privileged account or service identity
  • Apply restrictive filesystem permissions and avoid placing uploads in executable locations
  • Use isolated storage with quotas and controlled overwrite behavior

How teams detect issues like this

Organizations can identify similar issues through:

  • Static analysis rules for unsafe path joins involving request headers or form fields
  • Code review checks confirming validation occurs after complete path construction
  • Tests using normalized, encoded, absolute, and platform-specific path components
  • Runtime monitoring for writes outside approved upload directories
  • Filesystem policy enforcement that limits the service to a dedicated storage area
  • Automated security review tools that flag user-controlled input reaching file APIs without containment checks

Sources

SourceLink
github.comgithub.com/orhun/rustypaste
github.comgithub.com/orhun/rustypaste/blob/v0.18.0/src/paste.rs
github.comgithub.com/orhun/rustypaste/commit/ac05d552596af4a8429d80f30d11f67117ce02c8
github.comgithub.com/orhun/rustypaste/issues/622
vulncheck.comvulncheck.com/advisories/rustypaste-before-0.18.1-path-traversal-via-filename-header

Frequently asked

questions

Yes, when the affected upload endpoint is reachable and permits an attacker to provide the custom filename header.

The attacker generally needs only the ability to submit an upload request. The resulting impact depends on the service account's filesystem permissions.

Construct the complete destination path first, canonicalize it, and verify that it remains within a dedicated upload directory before creating or overwriting a file.

Use server-generated filenames, minimize filesystem privileges, isolate uploaded content, and test every file-writing path with adversarial path inputs.

Find out what's already
exploitable in your codebase.