Path traversal in Cohttp.Path.resolve_local_file
Description
The issue is that the function normalizes the URI path before percent decoding it: ```OCaml let resolve_local_file ~docroot ~uri = let path = Uri.(pct_decode (path (resolve "http" (of_string "/") uri))) in ... ``` Because `%2f` is decoded after Uri.resolve, encoded separators survive dot-segment normalization. For example, a request path like: ``` /static/..%2f..%2f..%2fetc/passwd ``` is normalized as a single encoded segment, then decoded into: ``` /static/../../../etc/passwd ``` afterwards. ## Timeline - Aug 11th 2026: report to [email protected] - Aug 14th 2026: PR published on <https://github.com/mirage/ocaml-cohttp/pull/1145> - Aug 20th 2026: fix released in v6.3.0 <https://github.com/ocaml/opam-repository/pull/30528>
CVSS v4.0
Affected software
pkg:opam/cohttpRun on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability arises because the function resolves and normalizes the URI path before decoding percent-encoded characters. Encoded separators such as %2f remain encoded during normalization, allowing them to survive dot-segment removal. After normalization, the path is percent-decoded, which can transform a normalized path into one containing directory traversal sequences (e.g., /static/..%2f..%2f..%2fetc/passwd becomes /static/../../../etc/passwd). This flaw enables attackers to access arbitrary files on the server by bypassing path normalization controls. The issue was reported on August 11, 2026, and fixed in Cohttp version 6.3.0.
Potential Impact
An attacker can exploit this vulnerability to perform path traversal attacks, potentially accessing sensitive files outside the intended document root. This can lead to unauthorized disclosure of sensitive information. The vulnerability does not require authentication and can be exploited remotely without user interaction.
Mitigation Recommendations
A fix is available in Cohttp version 6.3.0. Users should upgrade to version 6.3.0 or later to remediate this vulnerability. No additional mitigation steps are indicated by the vendor advisory.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- OSEC-2026-16
- Osv Schema Version
- 1.7.4
- Ecosystems
- ["opam"]
- Cvss Version
- 4.0
Threat ID: 6a89a6c8acd9273b49150b05
Added to database: 08/22/2026, 13:40:24 UTC
Last enriched: 08/22/2026, 13:41:32 UTC
Last updated: 10/03/2026, 00:10:38 UTC
Views: 61
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.