npm
CVE-2026-142608
Mongoose: Plain objects with a forged _bsontype bypass ObjectId and String casting, leaking and replaying data from other command
- Severity
- Low
- Published
- 3 Dec 2026
- Last changed
- 3 Dec 2026
- Added to UpHeron
- 3 Dec 2026
- Fixed in
- 6.13.13
- Weakness
- CWE-843
- Attack
- Over the network · No login needed · No user action needed
- CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N- Also known as
- GHSA-rxm2-55pg-68q6
- Sources
- OSV.dev and GitHub
Description
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.
lib/helpers/isBsonType.js returned true for any object whose _bsontype matched. This led to three problems:
- 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.
Affected software
| Software | Affected versions |
|---|---|
mongoosenpm · osv:npm:mongoose |
|
About mongoose
- Weekly downloads (npm)
- 8,359,311npm, 1 Dec 2026
Vulnerabilities in mongoose
- In our list
- 8
- Published in the last 12 months
- 8
- Critical, last 12 months
- 1
- High, last 12 months
- 3
- Known exploited
- 0
- CVE-2026-142595Mongoose: `sanitizeFilter` bypass via MongoDB internal top-level query operators such as `$_internalSchemaXor`Medium 6.5 4 Dec 2026
- CVE-2026-142596Mongoose: sanitizeProjection can be bypassed to include fields deselected with `select: false`High 7.5 4 Dec 2026
- CVE-2026-125116Mongoose: Discriminator key values matching inherited properties (e.g. __t: 'constructor') bypass schema casting and can poison collectionsMedium 4.8 10 Nov 2026
- CVE-2026-125117Mongoose walks into inherited properties when hydrating, setting, and merging, allowing overwrites of built-in functions (denial of service) and shared schema stateHigh 8.2 10 Nov 2026
- CVE-2026-125118Mongoose: Prototype pollution via Schema.prototype.virtual()Medium 6.5 10 Nov 2026
- CVE-2026-125119Mongoose: Connection-level sanitizeFilter not appliedHigh 7.5 10 Nov 2026
References
- CVE.org https://www.cve.org/CVERecord?id=CVE-2026-142608
- GitHub Advisory Database https://github.com/advisories/GHSA-rxm2-55pg-68q6