A memory safety issue exists in OCaml versions before 4.14.5 involving ephemerons whose keys are closures with the Infix_tag. During garbage collection, the ephemeron's data can be freed while still referenced, leading to a use-after-free condition. This flaw was fixed in OCaml 4.14.5.
Multiple command quoting issues were identified in OCaml on Windows platforms affecting the Filename.quote_command and Unix.create_process* functions. These issues could allow unsafe argument quoting or injection when invoking .bat or .cmd scripts with certain metacharacters. The vulnerability affects various OCaml versions prior to 4.14.5 and between 5.0.0 and 5.5.1, as well as specific 3.x releases. A fix has been merged that improves argument quoting and rejects unsafe arguments by raising an exception.
Multiple issues in the OCaml Marshal module allow corrupted or malicious marshaled data to cause undefined behavior in the runtime system during unmarshaling. These issues include stale obj_counter usage, custom block size wraparound, and acceptance of forged Closure_tag metadata without validation. The vulnerability affects several OCaml versions and can lead to runtime corruption or code execution if untrusted data is unmarshaled. It is recommended to use Marshal only between trusted processes. Fixes have been merged in versions 4.14.5 and 5.5.2.
An integer overflow vulnerability exists in the Unix.map_file function of the OCaml standard library when calculating the product of bigarray dimensions. This overflow can lead to incorrect memory mapping behavior if the dimensions or file size are user-controllable. The issue is fixed by using a safer multiplication function that detects overflow and raises an exception. Versions prior to 4.14.5 and versions from 5 up to but not including 5.5.2, as well as several 3.x versions, are affected.
A type confusion vulnerability exists in the OCaml runtime_events custom events cache, where a corrupt event stream can cause a crash by mixing event types. This issue arises if the runtime events producer and consumer run in separate processes and the producer is tricked into producing malformed data. A fix was merged in version 5.5.2 to validate event types and report corrupt streams on mismatch.
A heap buffer overflow vulnerability exists in the OCaml runtime_events consumer when parsing an oversized custom user event. This occurs due to a corrupt stream containing a valid message with one message type followed by the same event with a different message type, which can cause a crash. The issue is relevant if the runtime events producer and consumer run in separate processes and the producer can be tricked into producing malformed data. A fix has been merged to the OCaml trunk and is available in version 5.5.2.
A vulnerability in OCaml's Str module affects the function Str.string_partial_match, which can record stale capture registers with an invalid state where the beginning index is greater than the end index. This can cause Str.replace_matched to crash due to unsafe memory operations. The issue occurs when a group under a repetition operator is partially matched and then used in a replacement function referencing that group. The flaw was fixed by treating groups with beginning > end as not matched.
The opam package "jose" does not validate any RSA signature. It checks the encoding being PKCS1, but does not verify with the public key.
## Reproduction
With jose 0.10.0, the code below signs two tokens with the same key and glues one's payload onto the other's signature:
```OCaml
let () = Mirage_crypto_rng_unix.use_default ()
let key =
Jose.Jwk.make_priv_rsa (Mirage_crypto_pk.Rsa.generate ~bits:2048 ())
let sign sub =
Jose.Jwt.sign key ~payload:(`Assoc [ ("sub", `String sub) ])
|> Result.get_ok |> Jose.Jwt.to<http://jose.jwt.to/>_string
let seg n token = List.nth (String.split_on_char '.' token) n
let alice = sign "alice" and admin = sign "admin"
(* alice's header and signature, admin's payload *)
let forged = String.concat "." [ seg 0 alice; seg 1 admin; seg 2 alice ]
match
Jose.Jwt.unsafe_of_string forged
|> Result.get_ok
|> Jose.Jwt.validate ~jwk:(Jose.Jwk.pub_of_priv key) ~now:(Ptime_clock.now ())
with
| Ok t ->
print_endline
("accepted, sub = " ^ Option.get (Jose.Jwt.get_string_claim t "sub"))
| Error _ -> print_endline "rejected"
```
The dune file:
```
(executable (name repro)
(libraries jose mirage-crypto-pk mirage-crypto-rng.unix ptime.clock.os))
```
This prints "accepted, sub = admin".
## Workaround
There is no workaround known.
## Timeline
- 2026-08-25: private report via email to the authors of jose
- 2026-08-25: fix published to repository
- 2026-08-31: mail escalated to security@ocaml.org
- 2026-09-04: released jose 0.11.0
- 2026-09-10: published advisory
Several functions in cstruct may use wrong data, leading to unexpected exceptions and return corrupted data.
## Impact
- `Cstruct.filter_map` writes retained bytes at their original input positions, producing corrupted output when earlier bytes are dropped.
- `Cstruct.tail ~rev:true` removes two bytes instead of one and raises an exception for single-byte views.
- `Cstruct.cuts ~rev:true` may compare input against the wrong data, split at incorrect positions, and construct results using offsets outside the requested view.
- `Cstruct.find` and `Cstruct.find_sub ~rev:true` may return slices from the wrong location when operating on non-zero-offset views.
These are a set of logical indexing and bounds-calculation errors (CWE-682), and not direct memory-safety vulnerabilities. However, affected operations may return corrupted data, raise an unexpected exception, split input incorrectly, or return bytes outside the requested Cstruct view but still within its backing buffer.
In security-sensitive parsers, this could cause validation bypasses, denial of service, or unintended disclosure of adjacent buffer contents.
## Workarounds
Users unable to upgrade cstruct should backport the corresponding source changes. There is no configuration-based mitigation since these are buggy library calls.
## References
Discovered via [Scrutineer](https://github.com/alpha-omega-security/scrutineer) and Deepseek GLM-5.3 Flash running locally.
## Timeline
- 2026-09-04: reported via GitHub to ocaml/security-advisories repository
- 2026-09-05: reported via email to security@ocaml.org
- 2026-09-05: patch proposed and reviewed
- 2026-09-05: release cstruct 6.3.0
- 2026-09-10: published advisory
CVE-2026-87736 is a medium severity vulnerability in the mirage-crypto-ec package for OCaml. It involves an out-of-bounds read when processing compressed elliptic curve public keys. This flaw affects versions prior to 2.3.0 and can cause a denial of service due to application crashes but does not impact confidentiality or integrity.
CVE-2026-87735 is a medium severity vulnerability in the mirage-crypto-pk package for OCaml that affects versions before 2.3.0. It involves an undocumented exception for small messages during RSA encryption or decryption, related to improper validation of specified quantity in input. The issue does not impact confidentiality or integrity but may cause availability issues. No known exploits are reported, and no official patch information is provided.
A vulnerability in the mirage-crypto-ec library for OCaml versions before 2.2.0 allows improper certificate validation. The ECDSA functions for P256, P384, and P521 curves accept the encoding of the point at infinity (0x00) as a valid public key. This flaw enables forging signatures without possessing the private key.
CVE-2026-87732 is a vulnerability in the mirage-crypto package for OCaml versions before 2.2.0. The AES.GCM and Chacha20 authenticate_decrypt_into functions decrypt data into a buffer before verifying the cryptographic tag. If the tag is forged, the functions return false but the buffer still contains the decrypted plaintext, potentially exposing sensitive data.
The issue is that the function normalizes the URI path before percent
decoding it:
```OCaml
let resolve_local_file ~docroot ~uri =
let path = Uri.(pct_decode (path (resolve "http" (of_string "/") uri))) in
...
```
Because `%2f` is decoded after Uri.resolve, encoded separators survive
dot-segment normalization. For example, a request path like:
```
/static/..%2f..%2f..%2fetc/passwd
```
is normalized as a single encoded segment, then decoded into:
```
/static/../../../etc/passwd
```
afterwards.
## Timeline
- Aug 11th 2026: report to security@ocaml.org
- Aug 14th 2026: PR published on <https://github.com/mirage/ocaml-cohttp/pull/1145>
- Aug 20th 2026: fix released in v6.3.0 <https://github.com/ocaml/opam-repository/pull/30528>
A timing leak vulnerability exists in the scalar multiplication implementation of the mirage-crypto-ec library for NIST elliptic curves. The issue arises from secret-dependent table lookups that do not scan the entire pre-computed table, potentially leaking information through timing side channels. This flaw was introduced in version 0.11.3 and affects multiple versions up to but not including 2.4.0. The vulnerability was reported on August 12, 2026, and fixed in version 2.4.0 released on August 17, 2026.