Skip to content
Heist/ feed
Back to feed
Medium

Integer Underflow → Heap Out-of-Bounds Read in `bson_new_from_buffer()

Type: advisorySources: OSV

A missing lower-bound validation in the bson_new_from_buffer() function of libbson allows an integer underflow when processing BSON data with a zero-length prefix. The function reads a 32-bit document length from the input buffer but does not verify that the value is at least 5 (the minimum valid BSON document size) before using it in an array index calculation. When the length field is zero, the expression used to check the document's null terminator wraps to UINT32_MAX, causing a heap out-of-bounds read that crashes the process. An unauthorized party who can supply crafted BSON input to an application using this API can cause a denial of service.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-93395
Confirmed fixed CVEs
Not specified
Updated in this feed
7 Nov 2026, 18:14 UTC · Revision 1

Source evidence

Integer Underflow → Heap Out-of-Bounds Read in `bson_new_from_buffer()

core-osv · Original source

Published 17 Sept 2026, 20:34 UTC

A missing lower-bound validation in the bson_new_from_buffer() function of libbson allows an integer underflow when processing BSON data with a zero-length prefix. The function reads a 32-bit document length from the input buffer but does not verify that the value is at least 5 (the minimum valid BSON document size) before using it in an array index calculation. When the length field is zero, the expression used to check the document's null terminator wraps to UINT32_MAX, causing a heap out-of-bounds read that crashes the process. An unauthorized party who can supply crafted BSON input to an application using this API can cause a denial of service.

osv:CVE-2026-93395
Complete source record
{
  "id": "a80c8a6c3cd1e7460bc86e0897b0c61d8b808077c8edd7161e0f4fac2ba7e5c7",
  "url": "https://osv.dev/vulnerability/CVE-2026-93395",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Integer Underflow → Heap Out-of-Bounds Read in `bson_new_from_buffer()",
    "summary": "A missing lower-bound validation in the bson_new_from_buffer() function of libbson allows an integer underflow when processing BSON data with a zero-length prefix. The function reads a 32-bit document length from the input buffer but does not verify that the value is at least 5 (the minimum valid BSON document size) before using it in an array index calculation. When the length field is zero, the expression used to check the document's null terminator wraps to UINT32_MAX, causing a heap out-of-bounds read that crashes the process. An unauthorized party who can supply crafted BSON input to an application using this API can cause a denial of service.",
    "evidence": "osv:CVE-2026-93395",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2026-93395",
      "aliases": [
        "CVE-2026-93395"
      ],
      "metrics": [
        {
          "type": "CVSS_V4",
          "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/mongodb/mongo-c-driver",
              "type": "GIT",
              "events": [
                {
                  "introduced": "67817df0a9ed11b07e457477e6db1384da9421c4"
                },
                {
                  "fixed": "e44471f5dbc74e4c2ac9090a633e55491dfc1fa4"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:mongodb:c_driver:*:*:*:*:*:mongodb:*:*",
                    "range": [
                      {
                        "introduced": "2.0.0"
                      },
                      {
                        "fixed": "2.3.1"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            }
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-93395.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:51.405377252Z",
      "provider": "osv",
      "references": [
        "https://jira.mongodb.org/browse/CDRIVER-6343",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/93xxx/CVE-2026-93395.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-93395"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-191"
        ],
        "cna_assigner": "mongodb",
        "unresolved_ranges": [
          {
            "extracted_events": [
              {
                "range": [
                  {
                    "introduced": "2.0.0"
                  },
                  {
                    "fixed": "2.3.1"
                  }
                ],
                "source": "AFFECTED_FIELD",
                "strategy": "StandardRange"
              }
            ]
          }
        ],
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/93xxx/CVE-2026-93395.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-93395",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 520067,
  "published_at": "2026-09-17T20:34:57.703+00:00"
}