CVE-2026-142608
### Summary From 6.3.5-6.13.12, Mongoose 6 decides whether a value is a BSON type by checking only its _bsontype property. A plain object such as {"_bsontype":"ObjectID","id":""} therefore passes the ObjectId cast. bson 4.x then writes no id bytes but still advances 12 bytes in its serialization buffer, so the value sent to MongoDB is whatever the previous command left at that offset. Request bodies, cookies and Express 4 query strings can all produce such an object. sanitizeFilter doesn’t catch it because it has no $ keys. ### Details `lib/helpers/isBsonType.js` returned true for any object whose `_bsontype` matched. This led to three problems: 1. Queries by id replay another request’s id. findById(forged) sends the `_id` from the last command with the same layout, such as another request’s `findById` on the same collection. Likewise, `findByIdAndDelete(forged)` and `findByIdAndUpdate(forged)` act on the document another request just modified with `findOneAndUpdate`. This works with `sanitizeFilter` on. 2. Stored ObjectIds leak command bytes. `create()`, `$set` and other writes store 12 bytes of earlier commands, such as filter values and updated fields. Anyone who can read the document can read those bytes. This happens in the default configuration. 3. Forged regexes on String paths. `{"_bsontype":"BSONRegExp","pattern":"^a","options":""}` passes the String query cast and is sent as a regular expression, bypassing sanitizeFilter. `mongoose.isObjectIdOrHexString()` also returns true for the forged object. The fix makes `isBsonType()` ignore `_bsontype` when it is an own property. bson defines `_bsontype` on the prototype (except for the `Timestamp` class, which Mongoose does not check), so real bson values still pass. ### Proof of concept ```javascript mongoose.set('sanitizeFilter', true); const User = mongoose.model('User', new mongoose.Schema({ email: String, password: String })); const Comment = mongoose.model('Comment', new mongoose.Schema({ post: mongo
Properties
- Severity
- low
- Summary
- Mongoose: Plain objects with a forged _bsontype bypass ObjectId and String casting, leaking and replaying data from other command
- Nvd fetched at
- 2026-12-04T15:00:48.841578+00:00
- Epss score
- 0.00703
- Cvss severity
- NONE
- Retrieved at
- 2026-12-04T15:02:58+00:00
- Ghsa published
- 2026-12-03T00:29:57Z
- Source url
- https://github.com/advisories/GHSA-rxm2-55pg-68q6
- Ghsa updated
- 2026-12-03T00:29:57Z
- Ghsa id
- GHSA-rxm2-55pg-68q6
- Last source
- FIRST EPSS
- Cvss version
- 3.1
- Cve id
- CVE-2026-142608
- Cvss vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N
- First seen by Signal
- 2026-12-03T02:46:42+00:00
- Name
- CVE-2026-142608
- Is ghsa only
- false
- Vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N
- Published at
- 2026-12-02T23:18:40.517
- Last modified
- 2026-12-03T15:17:11.603
Related Entities (3)
AFFECTS (1)
HAS_WEAKNESS (1)
VULNERABLE_TO (1)
Related research
Explore deeper with Ninja Signal's threat intelligence graph