Summary
CVE-2026-82481 is a directory traversal vulnerability in cohttp, a widely used HTTP library for OCaml, affecting all versions prior to 6.3.0. The flaw resides in the Cohttp.Path.resolve_local_file helper function used by cohttp-based static file servers (including cohttp-lwt, cohttp-async, and cohttp-mirage) to map incoming request URIs to local filesystem paths. An unauthenticated remote attacker can exploit this to read files outside the intended document root, and the issue has been rated HIGH severity with a CVSS score of 8.7.
Technical details
- Root cause:
Cohttp.Path.resolve_local_fileremoved.and..path segments before percent-decoding the request URI, rather than decoding first. This allowed percent-encoded traversal sequences (e.g...%2f..%2f) to bypass the directory-escape checks, since the literal..was not visible to the sanitization logic until after it had already been evaluated. Additionally, empty path segments and trailing slashes were not properly normalized, further weakening path validation. - CWE classification: CWE-180 (Incorrect Behavior Order: Validate Before Canonicalize).
- Trigger conditions: Any application built on cohttp that serves static files from a document root using
resolve_local_file(or that relies on similar un-normalized path handling for access-control decisions) is affected. - Attack vector: Network — an attacker sends a crafted HTTP request containing percent-encoded directory traversal sequences to a cohttp-based web server.
- Impact: Disclosure of arbitrary files readable by the server process outside the configured document root (high confidentiality impact); no reported impact to integrity or availability.
Affected software
cohttp(OCaml/opam packagecohttp) — all versions prior to 6.3.0- Downstream libraries built on the same path-resolution logic:
cohttp-lwt,cohttp-async,cohttp-mirage(including its static file server) - Note:
cohttp-eiouses an independent path-resolution implementation and is not affected by this specific issue
Severity
- CVSS Score: 8.7 (High)
- CVSS 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/AU:Y/R:A/V:D/RE:M - Network attack vector, low attack complexity, no privileges or user interaction required, high confidentiality impact.
Mitigation and recommended actions
- Immediate: Upgrade
cohttpand any dependent packages (cohttp-lwt,cohttp-async,cohttp-mirage) to version 6.3.0 or later, which percent-decodes the request path exactly once before removing./..segments and normalizes empty segments and trailing slashes. - For custom access-control logic: Applications that make authorization decisions based on raw request paths should adopt the new
Cohttp.Path.normalisefunction to obtain a properly decoded and normalized path before performing path-segment comparisons (e.g., checking for an"admin"prefix), rather than parsing the raw, potentially encoded URI. - If immediate upgrade is not possible: Restrict or validate incoming request paths at a reverse proxy or WAF layer to reject requests containing percent-encoded traversal sequences (
%2e%2e,..%2f, etc.) destined for cohttp-based backends, and ensure the server process runs with least-privilege filesystem access to limit the blast radius of any file disclosure.

