---
id: "GHSA-86gh-39m5-hhg6"
kind: "vulnerability"
aliases: ["GHSA-86gh-39m5-hhg6"]
title: "Duplicate Advisory: PYTHON-6110 Out-of-bounds read in BSON decoding via a malformed Regex element"
severity: "medium"
cvss: 5.1
epss: null
exploited: false
status: "withdrawn"
category: "package"
products: [{"name": "pymongo", "fixed": [], "affected": ">= 3.9.0, <= 4.18.2", "ecosystem": "pypi"}]
ecosystems: ["pypi"]
tags: ["cwe-125", "mongodb", "package", "pymongo", "python"]
not_affected_if: ["no-untrusted-bson", "wire-protocol-only"]
published_at: "2026-10-08T21:33:28+00:00"
first_seen_at: "2026-10-27T15:39:16+00:00"
updated_at: "2026-10-27T15:39:47+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-86gh-39m5-hhg6", "first_seen_at": "2026-10-27T15:39:16+00:00"}]
---

# Duplicate Advisory: PYTHON-6110 Out-of-bounds read in BSON decoding via a malformed Regex element

PyMongo's C BSON decoder reads past the end of a buffer when decoding a truncated regex element that lacks a trailing NUL byte. An attacker who can supply BSON to the decode or decode_all API can crash the application process; this advisory is withdrawn as a duplicate of GHSA-98qm-wvgf-w4cf.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- pypi:pymongo affected >= 3.9.0, <= 4.18.2 fixed ?

## How to check

- Run `pip show pymongo` and compare the version to `4.18.2` or earlier.
- Search the codebase for calls to `bson.decode` or `bson.decode_all` on data from untrusted sources.

## Fix

- Upgrade `pymongo` past `4.18.2`, the affected range given by the sources; the fixed version is unknown from this advisory, so check GHSA-98qm-wvgf-w4cf for it.

## Timeline

- 2026-10-27T15:39:16+00:00 ghsa https://github.com/advisories/GHSA-86gh-39m5-hhg6

## From the sources

## Duplicate Advisory

This advisory has been withdrawn because it is a duplicate of GHSA-98qm-wvgf-w4cf. This link is maintained to preserve external references.

## Original Description
The MongoDB Python Driver's binary accelerator can read outside a buffer when an application decodes malformed BSON containing a truncated regular-expression element without a trailing NUL byte. An actor who can supply BSON to the documented decode or decode_all API can cause the application process to terminate when the C extension is loaded. The driver's normal database wire-protocol path does not reach this code.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
