CVE-2015-8869: Buffer overflow and information leak in OCaml < 4.03.0
Bug description
OCaml versions 4.02.3 and earlier have a runtime bug that, on 64-bit platforms, causes sizes arguments to an internal memmove call to be sign-extended from 32 to 64-bits before being passed to the memmove function.
This leads arguments between 2GiB and 4GiB to be interpreted as larger than they are (specifically, a bit below 2^64), causing a buffer overflow.
Arguments between 4GiB and 6GiB are interpreted as 4GiB smaller than they should be, causing a possible information leak.
This commit fixes the bug: https://github.com/ocaml/ocaml/commit/659615c7b100a89eafe6253e7a5b9d84d0e8df74#diff-a97df53e3ebc59bb457191b496c90762 The function camlbitstring is called indirectly from such functions as String.copy. String.copy for instance is supposed to be a "safe" function for which OCaml's memory safety guarantees apply.
Other sources
OCaml before 4.03.0 does not properly handle sign extensions, which allows remote attackers to conduct buffer overflow attacks or obtain sensitive information as demonstrated by a long string to the String.copy function.
— MITRE
OCaml versions 4.02.3 and earlier have a runtime bug that, on 64-bit platforms, causes sizes arguments to an internal memmove call to be sign-extended from 32 to 64-bits before being passed to the memmove function.
This leads arguments between 2GiB and 4GiB to be interpreted as larger than they are (specifically, a bit below 2^64), causing a buffer overflow.
Arguments between 4GiB and 6GiB are interpreted as 4GiB smaller than they should be, causing a possible information leak.
References:
http://seclists.org/oss-sec/2016/q2/165
Upstream fix:
https://github.com/ocaml/ocaml/commit/659615c7b100a89eafe6253e7a5b9d84d0e8df74#diff-a97df53e3ebc59bb457191b496c90762
— Red Hat
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
redhat/ocamlto a version that resolves this vulnerability.Fixed in 4.03.0 - Upgrade
Upgrade
opam/ocamlto a version that resolves this vulnerability.Fixed in 4.03.0 - Upgrade
Upgrade
OCamlto a version that resolves this vulnerability.Fixed in 4.03.0
Event History
Frequently Asked Questions
What is the severity of CVE-2015-8869?
CVE-2015-8869 has been classified as a critical vulnerability due to its potential for remote exploitation and buffer overflow attacks.
How do I fix CVE-2015-8869?
To mitigate CVE-2015-8869, upgrade OCaml to version 4.03.0 or later.
Which versions of OCaml are affected by CVE-2015-8869?
OCaml versions 4.02.3 and earlier are affected by CVE-2015-8869.
What type of attack can CVE-2015-8869 facilitate?
CVE-2015-8869 can facilitate buffer overflow attacks which may lead to remote code execution or information disclosure.
On which platforms is CVE-2015-8869 a concern?
CVE-2015-8869 is particularly a concern on 64-bit platforms running affected OCaml versions.