/

CVE-2026-28807

Severity:

HIGH RISK

(7.5)

Path Traversal in gleam-wisp wisp.serve_static

CVE-2026-28807

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Read

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

gleam-wisp's wisp.serve_static function contains a path traversal flaw where sanitization is applied before percent-decoding, allowing encoded .. sequences to slip through checks.

An unauthenticated attacker can issue a single crafted HTTP request with a percent-encoded traversal path to read arbitrary files accessible to the application process, including source code, configuration, and secret files.

Affected context

The vulnerability occurs in applications using gleam-wisp's wisp.serve_static helper to serve static files directly from the filesystem.

It manifests when file paths derived from HTTP request URLs are sanitized with string operations before being percent-decoded and then passed to the operating system for file access.

Any deployment where the web process has read permissions to sensitive files (application code, configuration, secrets, or system files) is exposed, even if authentication is implemented elsewhere.

Exploit preconditions

  • Attack surface: HTTP endpoint(s) that serve static content via wisp.serve_static.
  • Required access: None; exploitation can be performed by an unauthenticated remote client.
  • Trigger point: A single HTTP request containing a specially crafted percent-encoded path that decodes to a traversal sequence (e.g., .. segments).
  • Why exploitation is possible: Path sanitization is applied to the raw, still-encoded URL path. Encoded .. segments (%2e%2e) bypass the string-based replacement/sanitization and are only converted to .. during percent-decoding afterward, enabling the OS to resolve them as directory traversal when opening files.

Why this happens

This issue is a classic CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

The core mistake is performing path sanitization on the URL-encoded string, then applying percent-decoding afterward, which changes the meaning of the path after validation.

Because the encoded form of .. is not recognized by the sanitization logic, it is allowed to pass through, and later decoding turns it into a valid directory traversal segment.

Conceptually, this is a validation-order bug: security checks run on a different representation of the input than the one actually used for filesystem access.

Potential impact

  • An attacker may read arbitrary files that the application process can access, including application source code.
  • Configuration files containing database credentials, API keys, or other secrets could be exposed.
  • Environment-specific secret files (e.g., cloud metadata, runtime tokens) could be disclosed.
  • System files readable by the service account (such as logs or OS configuration) can potentially be accessed and used for further reconnaissance.
  • Information disclosure from these files can enable additional attacks such as lateral movement, privilege escalation, or targeted data exfiltration.

General mitigation guidance

Effective mitigation focuses on proper path normalization and defensive filesystem access patterns:

  • Normalize and percent-decode the input path first, then apply all security checks on the fully decoded representation.
  • Enforce strict confinement to a designated document root by resolving paths to absolute form and verifying they remain within the allowed base directory.
  • Use path-joining and canonicalization utilities rather than manual string concatenation or replacement when constructing filesystem paths.
  • Reject or strictly filter any path containing traversal-related components (e.g., .., absolute prefixes, drive letters) after normalization.
  • Run the web application under a dedicated, least-privileged OS account with minimal read access, limiting the blast radius if traversal occurs.
  • Prefer frameworks or helper functions that implement secure static-file serving by default instead of custom ad hoc file handling logic.

How teams detect issues like this

Detection can combine code-centric and behavior-centric approaches:

  • Static analysis: Flag code paths where request URLs or query parameters are concatenated with filesystem paths, especially when normalization or decoding happens in multiple stages.
  • Pattern-based checks: Look for manual string operations (e.g., replace, ++ "/" ++, or similar) used to sanitize paths before decoding or canonicalization.
  • Code review signals: Pay close attention to custom static file serving utilities and verify that decoding, normalization, and directory confinement are performed in the correct order.
  • Runtime monitoring: Analyze access logs for suspicious patterns such as repeated encoded traversal sequences (%2e%2e, %2f, %5c) or requests accessing unexpected file types/locations.
  • Automated review tools or SAST platforms can be configured with rules specific to path normalization and traversal patterns to surface these issues earlier in development.

Sources

SourceLink
cna.erlef.orgcna.erlef.org/cves/CVE-2026-28807.html
github.comgithub.com/gleam-wisp/wisp/commit/161118c431047f7ef1ff7cabfcc38981877fdd93
github.comgithub.com/gleam-wisp/wisp/security/advisories/GHSA-h7cj-j2vv-qw8r
osv.devosv.dev/vulnerability/EEF-CVE-2026-28807

Frequently asked

questions

Yes. Any exposed endpoint that uses wisp.serve_static and is reachable from the network can be targeted remotely without prior authentication.

No authentication is required. The critical requirement is network access to the vulnerable static file-serving endpoint; the attack payload is entirely contained in the request path.

Decode and normalize the request path first, then validate and confine it to a designated document root using canonical paths. Reject any paths that attempt to escape this root or that contain disallowed components such as .. after normalization.

Adopt a standard, well-reviewed static file serving component or library; enforce consistent path-handling patterns across the codebase; integrate static checks for filesystem access from user-controlled input; and run services with least-privilege filesystem permissions to limit potential impact.

Find out what's already
exploitable in your codebase.