Every CVE Search/ Get API key

CVE-2018-9838

The caml_ba_deserialize function in byterun/bigarray.c in the standard library in OCaml 4.06.0...

9.8 CriticalFix available

The caml_ba_deserialize function in byterun/bigarray.c in the standard library in OCaml 4.06.0 has an integer overflow which, in situations where marshalled data is accepted from an untrusted source, allows remote attackers to cause a denial of service (memory corruption) or possibly execute arbitrary code via a crafted object.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
High
Integrity
High
Availability
High

Exploit likelihood

4.17%Up 2.8 points since Apr 14, 2021
90%50%10%1%

What each source reports

NVD Score used 9.8

The caml_ba_deserialize function in byterun/bigarray.c in the standard library in OCaml 4.06.0 has an integer overflow which, in situations where marshalled data is accepted from an untrusted source, allows remote attackers to cause a denial of service (memory corruption) or possibly execute arbitrary code via a crafted object.

Record
CVE-2018-9838
CVSS 3.0
9.8 CriticalCVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS 2.0
7.5 HighAV:N/AC:L/Au:N/C:P/I:P/A:P
Weakness
CWE-190
Updated
2026-11-02
CVE List No score

The caml_ba_deserialize function in byterun/bigarray.c in the standard library in OCaml 4.06.0 has an integer overflow which, in situations where marshalled data is accepted from an untrusted source, allows remote attackers to cause a denial of service (memory corruption) or possibly execute arbitrary code via a crafted object.

Record
CVE-2018-9838
Updated
2026-11-02
EUVDEUVD-2018-21432 No score

The caml_ba_deserialize function in byterun/bigarray.c in the standard library in OCaml 4.06.0 has an integer overflow which, in situations where marshalled data is accepted from an untrusted source, allows remote attackers to cause a denial of service (memory corruption) or possibly execute arbitrary code via a crafted object.

Record
EUVD-2018-21432
Updated
2026-11-03
GitHub AdvisoriesGHSA-wc7m-73fq-26mj 9.8

The caml_ba_deserialize function in byterun/bigarray.c in the standard library in OCaml 4.06.0...

The caml_ba_deserialize function in byterun/bigarray.c in the standard library in OCaml 4.06.0 has an integer overflow which, in situations where marshalled data is accepted from an untrusted source, allows remote attackers to cause a denial of service (memory corruption) or possibly execute arbitrary code via a crafted object.

Record
GHSA-wc7m-73fq-26mj
CVSS 3.0
9.8 CriticalCVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-190
Updated
2026-11-02
OSV 9.8

The caml_ba_deserialize function in byterun/bigarray.c in the standard library in OCaml 4.06.0 has an integer overflow which, in situations where marshalled data is accepted from an untrusted source, allows remote attackers to cause a denial of service (memory corruption) or possibly execute arbitrary code via a crafted object.

Record
CVE-2018-9838
CVSS 3.0
9.8 CriticalCVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVDEBIAN-CVE-2018-9838 9.8

The caml_ba_deserialize function in byterun/bigarray.c in the standard library in OCaml 4.06.0 has an integer overflow which, in situations where marshalled data is accepted from an untrusted source, allows remote attackers to cause a denial of service (memory corruption) or possibly execute arbitrary code via a crafted object.

Record
DEBIAN-CVE-2018-9838
CVSS 3.0
9.8 CriticalCVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
Show 9 moreShow less
OSVOSEC-2018-01 9.8

An integer overflow in the `bigarray` serialization module leads to arbitrary code execution

Bug description

The bigarray module in all recent ocaml versions is capable of reading in serialized (marshalled) objects from a external source which is often used for network operations and interprocess communication.

byterun/bigarray.c

Line 458 in ea60609

 b->data = malloc(elt_size * num_elts);

A integer overflow vulnerability allows under certain circumstances an remote attacker to input a corrupt object and edit arbitrary addresses in the processes memory which leads over common techniques (in this take libc one gadget but any rop gadget or got table vector would work) to arbitrary memory access (!) and in the course also arbitrary code execution

Please check the writeup.pdf for more details !!

In variations of this the exploit is usable in all ocaml versions we tested no matter if compiled to binary or intepreted (!)

Steps to reproduce

Check out the attached archive and run the makefile (or use the precompile executable) the exploit can be run by executing exploit.py (python2.7 and pwntools are required) The last step of code execution is using a one-gadget attack technique and is specific to the glibc version in use (e.g. tested is debian glibc 2.24-11+deb9u1) but can with minimal amount of work be ported to any libc version on any patch level to our knowledge

Of course you can also use the exploit.py to write your own version of exploit

Additional information

This Vulnerability in ocaml was discovered by me ([email protected]) and the exploit collaboratly developed with ([email protected]) For illustration purposes it was packaged as security challenge to demonstrate the impact of the issue (see writeup.pdf)

Record
OSEC-2018-01
CVSS 3.0
9.8 CriticalCVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVUBUNTU-CVE-2018-9838 9.8

The caml_ba_deserialize function in byterun/bigarray.c in the standard library in OCaml 4.06.0 has an integer overflow which, in situations where marshalled data is accepted from an untrusted source, allows remote attackers to cause a denial of service (memory corruption) or possibly execute arbitrary code via a crafted object.

Record
UBUNTU-CVE-2018-9838
CVSS 3.0
9.8 CriticalCVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVMGASA-2019-0124 No score

Updated ocaml packages fix security vulnerability

The caml_ba_deserialize function in byterun/bigarray.c in the standard library in OCaml 4.06.0 has an integer overflow which, in situations where marshalled data is accepted from an untrusted source, allows remote attackers to cause a denial of service (memory corruption) or possibly execute arbitrary code via a crafted object. (CVE-2018-9838)

Record
MGASA-2019-0124
Updated
2026-11-02
OSVopenSUSE-SU-2024:10587-1 No score

ocaml-4.12.1-1.1 on GA media

These are all security issues fixed in the ocaml-4.12.1-1.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2024:10587-1
Updated
2026-11-02
OSVSUSE-SU-2018:0983-1 No score

Security update for ocaml

This update for ocaml fixes the following issues:

  • CVE-2018-9838: Integer overflows when unmarshaling a bigarray data could result in a bigarray with impossibly large dimensions leading to overflow when computing the in-memory size of the bigarray. [bsc#1088591]
Record
SUSE-SU-2018:0983-1
Updated
2026-11-02
OSVSUSE-SU-2018:1075-1 No score

Security update for ocaml

This update for ocaml fixes the following issues:

  • CVE-2018-9838: Integer overflows when unmarshaling a bigarray data could result in a bigarray with impossibly large dimensions leading to overflow when computing the in-memory size of the bigarray. [bsc#1088591]
Record
SUSE-SU-2018:1075-1
Updated
2026-11-02
OSVSUSE-SU-2018:1493-1 No score

Security update for ocaml

This update for ocaml fixes the following issues:

  • CVE-2018-9838: The caml_ba_deserialize function in byterun/bigarray.c in the standard library had an integer overflow which, in situations where marshalled data is accepted from an untrusted source, allows remote attackers to cause a denial of service (memory corruption) or possibly execute arbitrary code via a crafted object. [bsc#1088591]
Record
SUSE-SU-2018:1493-1
Updated
2026-11-02
OSVSUSE-SU-2018:1494-1 No score

Security update for ocaml

This update for ocaml fixes the following issues:

  • CVE-2018-9838: The caml_ba_deserialize function in byterun/bigarray.c in the standard library had an integer overflow which, in situations where marshalled data is accepted from an untrusted source, allows remote attackers to cause a denial of service (memory corruption) or possibly execute arbitrary code via a crafted object. [bsc#1088591]
Record
SUSE-SU-2018:1494-1
Updated
2026-11-02
OSVUSN-4778-1 No score

ocaml vulnerabilities

It was discovered that OCaml mishandled sign extensions. A remote attacker could use this vulnerability to steal sensitive information, cause a denial of service (crash), or possibly execute arbitrary code. This issue only affected Ubuntu 16.04 ESM. (CVE-2015-8869)

It was discovered that OCaml mishandled crafted input. An attacker could use this vulnerability to cause a denial of service or possibly execute arbitrary code. (CVE-2018-9838)

Record
USN-4778-1
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
ocaml
Debian:12
before 4.05.0-11
4.05.0-11
ocaml
Debian:13
before 4.05.0-11
4.05.0-11
ocaml
Debian:14
before 4.05.0-11
4.05.0-11
ocaml
Mageia:6
before 4.02.3-6.1.mga6
4.02.3-6.1.mga6
ocaml
opam
before 4.07.0, plus listed versions
3.073.07+13.07+23.08.03.08.1
Show 34 moreShow less
3.08.23.08.33.08.43.09.03.09.13.09.23.09.33.10.03.10.13.10.23.11.03.11.13.11.23.12.03.12.14.00.04.00.14.01.04.02.04.02.14.02.24.02.34.02.44.03.04.03.14.04.04.04.14.04.24.04.34.05.04.05.14.06.04.06.14.06.2
4.07.0
ocaml
SUSE:Linux Enterprise Software Development Kit 12 SP3
before 4.03.0-8.3.1
4.03.0-8.3.1
ocaml
SUSE:Linux Enterprise Software Development Kit 11 SP4
before 4.02.1-4.3.2
4.02.1-4.3.2
ocaml
SUSE:Linux Enterprise Software Development Kit 12 SP3
before 4.03.0-8.6.8
4.03.0-8.6.8
ocaml
SUSE:Linux Enterprise Software Development Kit 11 SP4
before 4.02.1-4.6.1
4.02.1-4.6.1
ocaml
Ubuntu:Pro:14.04:LTS
before 4.01.0-3ubuntu3.1+esm1, plus listed versions
3.12.1-4ubuntu14.01.0-3ubuntu24.01.0-3ubuntu34.01.0-3ubuntu3.1
4.01.0-3ubuntu3.1+esm1
ocaml
Ubuntu:Pro:16.04:LTS
before 4.02.3-5ubuntu2+esm1, plus listed versions
4.01.0-4ubuntu14.02.3-5ubuntu14.02.3-5ubuntu2
4.02.3-5ubuntu2+esm1
ocaml
Ubuntu:Pro:18.04:LTS
before 4.05.0-10ubuntu1+esm1, plus listed versions
4.04.0-2ubuntu44.05.0-10ubuntu1
4.05.0-10ubuntu1+esm1

History

History
RecordedChangedSources
aliasesEUVD
first indexedCVE List, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2018-9838 is a critical vulnerability (CVSS 9.8) in Ocaml, published April 6, 2018. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 4.17%, the 90th percentile. Fixed in ocaml 4.05.0-11.

References

Show 17 moreShow less
MoveEnter Open