{"id":"OSEC-2026-16","aliases":["OSEC-2026-16"],"related":[],"kind":"vulnerability","state":"published","title":"Path traversal in Cohttp.Path.resolve_local_file","summary":"The issue is that the function normalizes the URI path before percent\ndecoding it:\n\n```OCaml\nlet resolve_local_file ~docroot ~uri =\n\n  let path = Uri.(pct_decode (path (resolve \"http\" (of_string \"/\") uri))) in\n\n  ...\n```\n\nBecause `%2f` is decoded after Uri.resolve, encoded separators survive\ndot-segment normalization. For example, a request path like:\n\n```\n/static/..%2f..%2f..%2fetc/passwd\n```\n\nis normalized as a single encoded segment, then decoded into:\n\n```\n/static/../../../etc/passwd\n```\n\nafterwards.\n\n## Timeline\n\n- Aug 11th 2026: report to security@ocaml.org\n- Aug 14th 2026: PR published on <https://github.com/mirage/ocaml-cohttp/pull/1145>\n- Aug 20th 2026: fix released in v6.3.0 <https://github.com/ocaml/opam-repository/pull/30528>","summaryFormat":"markdown","summarySource":"osec","descriptions":[{"lang":"en","text":"The issue is that the function normalizes the URI path before percent\ndecoding it:\n\n```OCaml\nlet resolve_local_file ~docroot ~uri =\n\n  let path = Uri.(pct_decode (path (resolve \"http\" (of_string \"/\") uri))) in\n\n  ...\n```\n\nBecause `%2f` is decoded after Uri.resolve, encoded separators survive\ndot-segment normalization. For example, a request path like:\n\n```\n/static/..%2f..%2f..%2fetc/passwd\n```\n\nis normalized as a single encoded segment, then decoded into:\n\n```\n/static/../../../etc/passwd\n```\n\nafterwards.\n\n## Timeline\n\n- Aug 11th 2026: report to security@ocaml.org\n- Aug 14th 2026: PR published on <https://github.com/mirage/ocaml-cohttp/pull/1145>\n- Aug 20th 2026: fix released in v6.3.0 <https://github.com/ocaml/opam-repository/pull/30528>","format":"markdown","source":"osec"}],"published":"2026-08-20T18:15:00.000Z","modified":"2026-11-06T13:45:03.048Z","severities":[{"scorer":"OCaml Security Advisories","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/S:N/AU:Y/R:A/V:D/RE:M"}],"cwes":[],"affected":[{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"6.3.0"}],"ecosystem":"opam","package":"cohttp","purl":"pkg:opam/cohttp","source":"osec"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"5f5a65ec3289c1cd8072bdf0ef22c181b4f11356"}],"repo":"https://github.com/mirage/ocaml-cohttp.git","source":"osec"}],"references":[],"credits":["Sapphire Livingstone","Anil Madhavapeddy","Michael Dales","Edwin Torok","Patrick Ferris","Hannes Mehnert"],"sources":[{"source":"osec","name":"OCaml Security Advisories","id":"OSEC-2026-16","url":"https://osv.dev/vulnerability/OSEC-2026-16","licence":"CC0-1.0","modified":"2026-11-06T13:45:03.048Z"}],"updatedAt":"2026-11-25T22:56:18.361Z"}