7.3high
Cstruct indexing bugs can corrupt filtered output and reverse parsing results
- Severity
- 7.3high CVSS:3.1 by mitre
- Exploit likelihood
- 0.32% (higher than 17% of CVEs)
- Published
- Last changed
- Assigned by
- mitre
- Also known as
- OSEC-2026-20
Description
The cstruct package before 6.3.0 for OCaml mishandles indexes.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| OCaml cstruct | before 6.3.0 | CVE List |
| cstruct (opam) | before 6.3.0 | OCaml Security Advisories |
| https://github.com/mirage/ocaml-cstruct | before 936f1010d3e9914da9c5c8a4739e9278a37e1c3e | OCaml Security Advisories |
All scores
| mitre | 7.3high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L |
| OCaml Security Advisories | 7.3high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L |
Classification
SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.
What each source says
CVE List
The cstruct package before 6.3.0 for OCaml mishandles indexes.
OCaml Security Advisories
Several functions in cstruct may use wrong data, leading to unexpected exceptions and return corrupted data.
Impact
Cstruct.filter_mapwrites retained bytes at their original input positions, producing corrupted output when earlier bytes are dropped.Cstruct.tail ~rev:trueremoves two bytes instead of one and raises an exception for single-byte views.Cstruct.cuts ~rev:truemay compare input against the wrong data, split at incorrect positions, and construct results using offsets outside the requested view.Cstruct.findandCstruct.find_sub ~rev:truemay 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 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
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-89087 changed 2026-09-14 | CVE Terms of Use |
| OCaml Security Advisories | OSEC-2026-20 changed 2026-11-06 | CC0-1.0 |
| NVD | CVE-2026-89087 changed 2026-09-22 | Public domain |