---
id: CVE-2024-5629
aliases:
  - GHSA-m87m-mmvp-v9qm
  - PYSEC-2026-1826
title: 'PyMongo Out-of-bounds Read in the bson module '
summary: 'PyMongo Out-of-bounds Read in the bson module '
severity: medium
cvss: 4.7
cvssVector: 'CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:N/A:L'
vendor: pymongo
product: pymongo
ecosystem: pip
affected:
  - pymongo < 4.6.3
patched:
  - pymongo 4.6.3
published: '2024-06-05'
updated: '2026-09-10'
sourceUpdated: '2026-09-10T03:50:15.663234621Z'
source: OSV
sourceUrl: 'https://osv.dev/vulnerability/GHSA-m87m-mmvp-v9qm'
references:
  - url: 'https://nvd.nist.gov/vuln/detail/CVE-2024-5629'
  - url: >-
      https://github.com/mongodb/mongo-python-driver/commit/56b6b6dbc267d365d97c037082369dabf37405d2
  - url: 'https://gist.github.com/keltecc/62a7c2bf74a997d0a7b48a0ff3853a03'
  - url: 'https://github.com/mongodb/mongo-python-driver'
  - url: 'https://jira.mongodb.org/browse/PYTHON-4305'
  - url: 'https://lists.debian.org/debian-lts-announce/2024/06/msg00007.html'
  - url: 'https://security.snyk.io/vuln/SNYK-PYTHON-PYMONGO-6370597'
tags:
  - osv
  - pip
epss: 0.00663
epssPercentile: 0.50309
ingestedAt: '2026-07-08T18:25:51.184Z'
---

## Overview

Versions of the package pymongo before 4.6.3 are vulnerable to Out-of-bounds Read in the bson module. Using the crafted payload the attacker could force the parser to deserialize unmanaged memory. The parser tries to interpret bytes next to buffer and throws an exception with string. If the following bytes are not printable UTF-8 the parser throws an exception with a single byte.

## Affected packages

- `pymongo < 4.6.3`

## Remediation

Upgrade to a patched release:

- `pymongo 4.6.3`
