# GHSA-2XQV-J3JP-FG52: Memory leak on duplicate fields in key vault documents in libmongocrypt

- Database: GitHub
- Severity: CVSS 4.3 (Medium)
- Published: 2026-11-25
- Modified: 2026-11-25

## Tracked as

- [CVE-2026-135223](https://cve.now/CVE-2026-135223.md): MongoDB Libmongocrypt Driver memory leak in key vault document parsing

## Description

libmongocrypt parses encryption key documents from the key vault collection, which can be written by any user authorized to manage client-side encryption keys. When a key vault document repeats a field, libmongocrypt parses the earlier occurrence and then overwrites it with the later one without releasing the earlier value.

### Affected versions

- `>= 1.0.0, < 1.21.2`

### Impact

An improper handling of repeated fields in encryption key documents in the MongoDB encryption support library may allow memory to be retained without release. A party able to write to the key storage collection, or a database endpoint returning such a document, may cause the memory use of the calling application process to grow for each document parsed, which may reduce performance of that process.

A key vault document that repeats the `_id`, `keyMaterial`, or `keyAltNames` field retains the earlier value for the lifetime of the process.

### Patches

- [1.21.2](https://github.com/mongodb/libmongocrypt/releases/tag/1.21.2)

libmongocrypt now rejects key vault documents that repeat a known field instead of parsing and overwriting the earlier occurrence.

### Workarounds

Restrict write access to the key vault collection to trusted parties. Applications that cannot upgrade should validate key vault documents before use and reject any document that repeats a field.

### References

- https://jira.mongodb.org/browse/MONGOCRYPT-990

## References

- https://github.com/mongodb/libmongocrypt/security/advisories/GHSA-2xqv-j3jp-fg52

Page: https://cve.now/GHSA-2XQV-J3JP-FG52

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
