Skip to main content
VulnerabilityPublished 09/10/2026

Cstruct indexing bugs can corrupt filtered output and reverse parsing results (CVE-2026-89087)

Affects cstructSource GCVE Database

0

Mentioned vulnerabilities

CVSS 7.3 High · fixed in 6.3.0 : patch cstruct soon.

Data as of 09/10/2026, 22:03:59 UTC

CVSS 3.1 base score
7.3High
How severe the flaw is on the 0–10 CVSS scale.
Patch
Available – fixed in 6.3.0, 936f1010d3e9914da9c5c8a4739e9278a37e1c3e
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L

What to do

Affected software

ProductAffectedFixed in
opamcstructpkg:opam/cstructOther threatsAffected
  • <6.3.0
  • <936f1010d3e9914da9c5c8a4739e9278a37e1c3e
  • =0.4.0
  • =0.4.1
  • =0.5.0
  • =0.5.1
  • =0.5.2
  • =0.5.3
  • =0.6.0
  • =0.6.1
  • =0.6.2
  • =0.7.0
  • =0.7.1
  • =0.8.0
  • =0.8.1
  • =1.0.0
  • =1.0.1
  • =1.1.0
  • =1.2.0
  • =1.3.0
  • =1.3.1
  • =1.4.0
  • =1.5.0
  • =1.6.0
  • =1.7.0
  • =1.7.1
  • =1.8.0
  • =1.9.0
  • =2.0.0
  • =2.1.0
  • =2.2.0
  • =2.3.0
  • =2.3.1
  • =2.3.2
  • =2.4.1
  • =3.0.0
  • =3.0.1
  • =3.0.2
  • =3.1.0
  • =3.1.1
  • =3.2.0
  • =3.2.1
  • =3.3.0
  • =3.4.0
  • =3.5.0
  • =3.6.0
  • =3.7.0
  • =4.0.0
  • =5.0.0
  • =5.1.1
  • =5.2.0
  • =6.0.0
  • =6.0.1
  • =6.1.0
  • =6.1.1
  • =6.2.0
Fixed in
  • 6.3.0
  • 936f1010d3e9914da9c5c8a4739e9278a37e1c3e

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

A patch fixing these issues is available in cstruct version 6.3.0. Users should upgrade to this version to remediate the vulnerabilities. For those unable to upgrade, backporting the source changes from the patch is recommended. There are no configuration-based mitigations since the issues stem from buggy library calls.

Description

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

Impact

Affected functions may return corrupted data, raise unexpected exceptions, split input incorrectly, or return bytes outside the requested view but still within the backing buffer. In security-sensitive parsing contexts, this can lead to validation bypasses, denial of service, or unintended disclosure of adjacent buffer contents. There are no direct memory safety violations, but the logical errors undermine data integrity and reliability.

References

Community reviews

Loading reviews…