OSEC-2026-20 (CVE-2026-89087)

Vulnerability from osv_ocaml – Published: 2026-09-10 10:00 – Updated: 2026-09-10 20:20 – Source website
VLAI
Summary
Cstruct indexing bugs can corrupt filtered output and reverse parsing results
Details

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 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

{
  "affected": [
    {
      "ecosystem_specific": {
        "affected_bindings": [
          "Cstruct.filter_map",
          "Cstruct.tail",
          "Cstruct.cuts",
          "Cstruct.find",
          "Cstruct.find_rev"
        ],
        "opam_constraint": "cstruct {\u003c \"6.3.0\"}"
      },
      "package": {
        "ecosystem": "opam",
        "name": "cstruct",
        "purl": "pkg:opam/cstruct"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "6.3.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "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"
      ]
    },
    {
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "936f1010d3e9914da9c5c8a4739e9278a37e1c3e"
            }
          ],
          "repo": "https://github.com/mirage/ocaml-cstruct",
          "type": "GIT"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-89087"
  ],
  "credits": [
    {
      "name": "Anil Madhavapeddy",
      "type": "REPORTER"
    },
    {
      "name": "Thomas Gazagnaire",
      "type": "REMEDIATION_REVIEWER"
    },
    {
      "name": "Anil Madhavapeddy",
      "type": "REMEDIATION_DEVELOPER"
    }
  ],
  "database_specific": {
    "cwe": [
      "CWE-682"
    ],
    "human_link": "https://github.com/ocaml/security-advisories/tree/main/advisories/2026/OSEC-2026-20.md",
    "osv": "https://github.com/ocaml/security-advisories/tree/generated-osv/2026/OSEC-2026-20.json"
  },
  "details": "Several functions in cstruct may use wrong data, leading to unexpected exceptions and return corrupted data.\n\n## Impact\n\n- `Cstruct.filter_map` writes retained bytes at their original input positions, producing corrupted output when earlier bytes are dropped.\n- `Cstruct.tail ~rev:true` removes two bytes instead of one and raises an exception for single-byte views.\n- `Cstruct.cuts ~rev:true` may compare input against the wrong data, split at incorrect positions, and construct results using offsets outside the requested view.\n- `Cstruct.find` and `Cstruct.find_sub ~rev:true` may return slices from the wrong location when operating on non-zero-offset views.\n\nThese 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.\n\nIn security-sensitive parsers, this could cause validation bypasses, denial of service, or unintended disclosure of adjacent buffer contents.\n\n## Workarounds\n\nUsers unable to upgrade cstruct should backport the corresponding source changes. There is no configuration-based mitigation since these are buggy library calls.\n\n## References\n\nDiscovered via [Scrutineer](https://github.com/alpha-omega-security/scrutineer) and Deepseek GLM-5.3 Flash running locally.\n\n## Timeline\n\n- 2026-09-04: reported via GitHub to ocaml/security-advisories repository\n- 2026-09-05: reported via email to security@ocaml.org\n- 2026-09-05: patch proposed and reviewed\n- 2026-09-05: release cstruct 6.3.0\n- 2026-09-10: published advisory",
  "id": "OSEC-2026-20",
  "modified": "2026-09-10T20:20:00Z",
  "published": "2026-09-10T10:00:00Z",
  "references": [
    {
      "type": "FIX",
      "url": "https://github.com/mirage/ocaml-cstruct/pull/324"
    }
  ],
  "schema_version": "1.7.4",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Cstruct indexing bugs can corrupt filtered output and reverse parsing results"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.