Get a Demo

Let's Patch It!

Book a short call with one our specialists, we'll walk you through how Endor Patches work, and ask you a few questions about your environment (like your primary programming languages and repository management). We'll also send you an email right after you fill out the form, feel free to reply with any questions you have in advance!

CVE

OSEC-2023-01

Time of check time of use issue in opam's cache
Back to all
CVE

OSEC-2023-01

Time of check time of use issue in opam's cache

Bug description

Opam uses since version 2.0.0 a download cache: if a source artifact is needed, first its hash is looked up in the local cache (~/.opam/download-cache/<hash-algorihm>/<hash>). Opam supports multiple hash algorithms, a cache lookup tries all hash algorithms present in the opam file. Before opam 2.1.5, the hash of a cache entry as encoded in its file name was trusted and not checked against its content.

If a package specifies only a single (non-weak) hash algorithm, this lead to the source artifact taken as is, any error while writing the artifact into the cache, or reading it from the cache, was not detected. Also, in certain setups, if the download cache is shared (writable) across containers (for example in some CI systems), this leads to the possibility of cache poisoning.

Thanks to Raja and Kate, the issue was fixed in PR 5538

Timeline

The timeline of this issue is as follows:

  • Feb 23rd 2023 conducted black-box security audit of opam
  • Feb 24th 2023 reported to the opam team
  • Feb 27th 2023 video meeting with the opam team, explaining the issue further
  • Mar 27th 2023 initial review meeting of the patches developed by the opam team
  • May 9th 2023 public PR fixing the issue discovered
  • May 25th 2023 release of opam 2.1.5

Package Versions Affected

Package Version
patch Availability
No items found.

Automatically patch vulnerabilities without upgrading

Fix Without Upgrading
Detect compatible fix
Apply safe remediation
Fix with a single pull request

CVSS Version

Severity
Base Score
CVSS Version
Score Vector
C
H
U
-
C
H
U
0
-
3.1
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
C
H
U
-

Related Resources

No items found.

References

https://github.com/ocaml/opam/pull/5538, https://opam.ocaml.org/blog/opam-2-1-5-local-cache/

Severity

7.1

CVSS Score
0
10

Basic Information

Ecosystem
Base CVSS
7.1
EPSS Probability
0%
EPSS Percentile
0%
Introduced Version
2,cfa4e77b49d0bccaf5c91b2e6f36089aab5e0540
Fix Available
2.1.5,7a538fd0bf3b3956d84bb25d0f6b1126fa177595

Fix Critical Vulnerabilities Instantly

Secure your app without upgrading.
Fix Without Upgrading