/

CVE-2026-39847

Severity:

CRITICAL RISK

(9.1)

Path Traversal in Emmett RSGI Static Handler for Internal

CVE-2026-39847

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Read / Information Disclosure

Severity:

CRITICAL RISK

(9.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

A path traversal vulnerability in Emmett's RSGI static handler for internal assets (/__emmett__ paths) allows attackers to escape the intended assets directory using ../ sequences.

When exploited, this flaw can expose arbitrary files on the server's filesystem that are readable by the Emmett process, significantly increasing the risk of sensitive data disclosure.

Affected context

This issue affects Emmett applications using framework versions from 2.5.0 up to, but not including, 2.8.1 where:

  • The RSGI static handler serves internal assets under the /__emmett__ URL space
  • Requests to these paths are exposed to untrusted clients (e.g., the public internet)
  • The handler relies on user-supplied path components to locate files on disk

The vulnerability is triggered when paths containing traversal sequences like ../ are not normalized and restricted to the static assets directory.

Exploit preconditions

  • Attack surface: HTTP(S) interface of the Emmett application exposing /__emmett__ endpoints
  • Required access: Network access sufficient to send crafted HTTP requests to the application (no authentication necessarily required, depending on deployment)
  • Trigger point: Requesting __emmett__ URLs that include directory traversal patterns such as ../ to escape the assets directory
  • Why exploitation is possible: The static handler resolves filesystem paths directly from user-controlled URL segments without robust canonicalization and enforcement of a fixed root directory boundary

Why this happens

The root cause is an improper neutralization of path traversal sequences when resolving file system paths for static asset requests.

User-controlled URL components under /__emmett__ are treated as relative paths and concatenated to a base directory without correctly normalizing the path and enforcing that the final resolved path remains within the intended assets root.

This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, where lack of strict path canonicalization and boundary checks allows attackers to traverse the directory structure and access files outside the designated directory.

Potential impact

  • Reading arbitrary files accessible to the Emmett process (e.g., configuration files, logs, or source code)
  • Exposure of credentials, API keys, or secrets stored in configuration or environment files
  • Leakage of proprietary application logic, business rules, or internal scripts
  • Facilitating further attacks such as authentication bypass, lateral movement, or targeting other components based on disclosed information

General mitigation guidance

Effective mitigation focuses on robust path handling and strict directory confinement:

  • Normalize and canonicalize all requested paths before file access, resolving . and .. segments
  • Enforce a fixed document root for static assets and verify that the resolved path is a descendant of this root before serving the file
  • Reject or sanitize any request paths containing traversal patterns or unexpected separators
  • Avoid directly concatenating user-supplied path segments with filesystem paths; instead, use vetted path-joining utilities that enforce boundaries
  • Minimize sensitive data stored on the same filesystem paths accessible to the web process, and apply least-privilege file permissions
  • Consider separating internal framework assets from application and configuration files to reduce impact if traversal occurs

How teams detect issues like this

Detection can rely on both code-centric and operational approaches:

  • Static analysis: Scan for handlers that construct filesystem paths from HTTP path parameters or query strings, particularly patterns using direct string concatenation or os.path.join without post-join boundary checks
  • Code review signals: Flag any route that:
  • Serves files based on user-controlled input
  • Lacks explicit normalization and checks that the resolved path stays under a configured root directory
  • Dynamic testing: Use web application scanners or custom test cases to probe for ../ traversal under static or internal asset endpoints
  • Logging and monitoring: Enable detailed access logging for /__emmett__ paths and alert on suspected traversal indicators (e.g., repeated ../ sequences, attempts to access known sensitive filenames)

Automated SAST/DAST tools can help identify these patterns early, especially when combined with security-focused pull request checks.

Sources

SourceLink
github.comgithub.com/emmett-framework/emmett/security/advisories/GHSA-pr46-2v3c-5356

Frequently asked

questions

Yes, if the Emmett application exposes /__emmett__ endpoints to the internet, a remote attacker with network access can attempt to exploit the traversal using crafted URLs.

Not inherently. If /__emmett__ paths are publicly reachable and not behind authentication, the attack can often be performed by any unauthenticated user who can send HTTP requests to the application.

The safest pattern is to treat all path components derived from user input as untrusted, normalize the complete path, and verify that the resolved path remains strictly within a predefined static root directory. Any request that attempts to escape this directory should be rejected.

Adopt a defensive design for file-serving code: always enforce a fixed document root, use canonicalization and boundary checks, prohibit traversal sequences, and include automated tests and static analysis rules specifically targeting user-driven filesystem access. Consistent security review of routing and static file handlers can further reduce recurrence.

Find out what's already
exploitable in your codebase.