CVE-2026-62157
mongo_fdw out-of-bounds read when building an ObjectId from short _id values
5.3
Description
mongo_fdw converts _id values to 12-byte MongoDB ObjectIds with libbson functions that read a fixed number of bytes without checking the input length: 12 bytes for a bytea _id, and 24 characters for name-typed values and $oid fields in JSON. A shorter value causes a read past the end of the input, which can crash the PostgreSQL backend or include adjacent memory in the query sent to MongoDB. Any user who can supply an _id value or predicate on a foreign table can trigger it. The issue is fixed in mongo_fdw 5.6.0. From mongo_fdw 5.6.0, mongo_fdw accepts only valid 24-character hexadecimal ObjectIds and 12-byte bytea values.
Affected products and versions
| Product / package | Ecosystem / vendor | Versions | Fixed in | Source |
|---|---|---|---|---|
| mongodb foreign data wrapper (mongo fdw) | enterprisedb | 0 → <5.6.0 | 5.6.0 | CVE.org |