CVE-2026-41082: opam install sandbox escape
Summary
.install files do not validate whether they are inside the package area, and so can bypass sandboxing.
Exploit
In a package.install file, this installs a file as ~/.bashrc: bin: [ "payload.sh" {"../../../.bashrc"} ]
Timeline
- 2026-04-11: Anil forwarded the issue from Andrew Nesbitt to the OCaml security team - 2026-04-11: Kate developed a fix - 2026-04-15: opam 2.5.1 was released with the fix
Other sources
In OCaml opam before 2.5.1, a .install field containing a destination filepath can use ../ to reach a parent directory.
— Red Hat
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
opam/opam-develto a version that resolves this vulnerability.Fixed in 2.5.1 - Upgrade
Upgrade
opamto a version that resolves this vulnerability.Fixed in 2.5.1
Event History
Frequently Asked Questions
What is the severity of CVE-2026-41082?
CVE-2026-41082 is considered a moderate severity vulnerability affecting OCaml opam versions prior to 2.5.1.
How do I fix CVE-2026-41082?
To fix CVE-2026-41082, upgrade OCaml opam to version 2.5.1 or later.
What type of vulnerability is CVE-2026-41082?
CVE-2026-41082 is a directory traversal vulnerability that allows the manipulation of file paths.
Which versions of OCaml opam are affected by CVE-2026-41082?
CVE-2026-41082 affects all versions of OCaml opam prior to 2.5.1.
How can CVE-2026-41082 impact my system?
CVE-2026-41082 can potentially allow an attacker to write files to unintended directories, compromising system integrity.