MongoDBGHSA-7x6v-xx33-q7wq
Heap buffer overflow via 32-bit string-length truncation in MongoDB PHP Driver
Fix: upgrade to 1.21.11 or later (3 fixed versions below)
Impact
The BSON encoder in the MongoDB PHP Driver converts a string length to a 32-bit value without validation. When an affected application encodes a string near 4 GiB, the allocation size can wrap while the copy operation uses the original length. The resulting heap buffer overflow can corrupt process memory or terminate the PHP process. Reaching this issue requires a non-default runtime configuration that permits multi-gigabyte values. No MongoDB server interaction is required.
Patches
Fixed in 1.21.11, 2.1.11, and 2.5.4.
Workarounds
Avoid runtime configurations that permit multi-gigabyte string values.
References
https://www.cve.org/CVERecord?id=CVE-2026-106432
https://jira.mongodb.org/browse/PHPC-2741
Affected versions
| Package | Affected | Fixed in |
|---|---|---|
| mongodb Product | >= 1.16.0, < 1.21.11 | 1.21.11 |
| >= 2.0.0, < 2.1.11 | 2.1.11 | |
| >= 2.2.0, < 2.5.4 | 2.5.4 | |
| mongodb/mongodb-extension Product | >= 1.16.0, < 1.21.11 | 1.21.11 |
| >= 2.0.0, < 2.1.11 | 2.1.11 | |
| >= 2.2.0, < 2.5.4 | 2.5.4 |
Details and references
- CVSS 4.0
- CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N
- Severity from
- GitHub (reviewed advisory)
- Weakness
- CWE-681