Vulnerability DatabaseCVE-2026-142608

CVE-2026-142608: 
JavaScript vulnerability analysis and mitigation

Overview

CVE-2026-142608 is a type confusion vulnerability in Mongoose, the MongoDB object modeling library for Node.js, where plain JavaScript objects with a forged _bsontype own property bypass ObjectId and String casting. Affected versions span from 6.3.5 through 6.13.12 (inclusive); the issue is fixed in version 6.13.13. The vulnerability was published by researcher vkarpov15 on November 23, 2026, and added to the GitHub Advisory Database on December 3, 2026. The assigned CVSS v3.1 base score is 0.0 (Low) per the official advisory, though Feedly's category estimate rates the real-world impact as HIGH due to the authorization bypass potential (Github Advisory, Mongoose Advisory).

Technical details

The root cause is a type confusion flaw (CWE-843) in lib/helpers/isBsonType.js, which determined whether a value was a BSON type solely by checking if its _bsontype property matched a target typename — without distinguishing between own properties and prototype-inherited ones. Since legitimate BSON objects (from the bson 4.x library) define _bsontype on the prototype, a plain object like {"_bsontype":"ObjectID","id":""} — easily crafted from JSON request bodies, cookies, or Express 4 query strings — would pass the ObjectId cast. When bson 4.x serializes such a forged ObjectID, it writes no id bytes but still advances 12 bytes in its internal buffer, causing the serialized value to contain whatever bytes the previous MongoDB command left at that offset. Three distinct attack primitives result: (1) ID replay — findById(forged) queries using the _id from the preceding command; (2) buffer disclosure — writes via create() or $set store 12 bytes of prior command data (e.g., emails, reset codes, API keys) in the document; (3) regex bypass — a forged BSONRegExp object passes String-path filtering and executes as a regex even when sanitizeFilter is enabled (Github Advisory, Patch Commit).

Impact

Successful exploitation allows unauthenticated remote attackers to read, modify, or delete MongoDB documents belonging to other concurrent requests when a compatible buffer layout exists, effectively enabling cross-request data access without authentication. Sensitive command-buffer fragments — including password reset codes, API keys, email addresses, and other field values — can be stored in documents and later retrieved by any user with read access, even in default configurations. Additionally, attackers can force unintended regular-expression matches against String fields, bypassing sanitizeFilter, express-mongo-sanitize, and mongo-sanitize protections entirely (Github Advisory, Mongoose Advisory).

Exploitability

No public proof-of-concept exploit code has been published, and there is no evidence of in-the-wild exploitation at this time (Github Advisory). The EPSS score is 0.0, and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog. However, exploitation requires only the ability to send crafted HTTP requests (e.g., JSON bodies with a _bsontype key) to an application that passes request-derived values into Mongoose ObjectId or String queries — a low-complexity, unauthenticated attack vector. The bypass works even when common sanitization libraries are in use, lowering the effective barrier for exploitation.

Exploitation steps

  1. Reconnaissance: Identify Node.js/Express applications using Mongoose 6.3.5–6.13.12 that accept user-supplied values in MongoDB query or write operations (e.g., login endpoints, document lookup APIs, comment creation forms).
  2. Craft forged ObjectID payload: Construct a JSON object with an own _bsontype property: {"_bsontype":"ObjectID","id":""}. This can be submitted via a JSON request body, cookie, or Express 4 query string parameter.
  3. ID replay attack: Send a request to an endpoint that calls findById(), findByIdAndDelete(), or findByIdAndUpdate() with the forged object as the ID parameter. Mongoose passes it through the ObjectId cast, and bson 4.x serializes it using 12 bytes from the previous command's buffer — effectively querying or modifying the document accessed by the preceding request.
  4. Buffer disclosure via stored ObjectId: Submit the forged ObjectID in a write operation (e.g., create() or $set on an ObjectId path). The stored field will contain 12 bytes of the previous command's buffer (e.g., fragments of filter values, reset codes, or API keys). Retrieve the document to read the leaked bytes.
  5. Regex bypass on String paths: Craft a forged BSONRegExp payload: {"_bsontype":"BSONRegExp","pattern":"^S3","options":""}. Submit it as the value for a String-typed query field. Mongoose passes it through String casting and sends it as a regex to MongoDB, bypassing sanitizeFilter and enabling pattern-based data enumeration (Github Advisory, Mongoose Advisory).

Indicators of compromise

  • Network: HTTP requests containing JSON bodies or query parameters with a _bsontype key (e.g., {"_bsontype":"ObjectID","id":""} or {"_bsontype":"BSONRegExp","pattern":"...","options":""}); unexpected cross-user document access patterns in application logs.
  • Logs: Application or web server access logs showing requests with JSON payloads containing _bsontype in fields expected to be primitive strings or ObjectId hex strings; MongoDB query logs showing regex queries on String fields from unexpected sources.
  • File System / Database: Documents in MongoDB collections where ObjectId fields contain unexpected binary data (non-standard 12-byte values) that decode to fragments of other commands (e.g., partial email addresses, reset codes); documents with ObjectId fields that do not correspond to any valid application-generated identifier.
  • Application Behavior: Queries returning documents belonging to other users or sessions; password reset codes or API keys appearing in unexpected document fields when read back from the database (Github Advisory).

Mitigation and workarounds

Upgrade Mongoose to version 6.13.13 or later, which fixes isBsonType() to reject objects where _bsontype is an own property (using Object.prototype.hasOwnProperty.call(obj, '_bsontype')), ensuring only legitimate BSON prototype-based values pass the cast (Patch Commit). As an interim workaround, validate that all request-derived values passed to ObjectId or String query/write fields are primitive types (string or number); use mongoose.isValidObjectId() (not mongoose.isObjectIdOrHexString(), which is also affected) to validate ObjectId inputs before passing them to Mongoose. Do not rely on sanitizeFilter, express-mongo-sanitize, or mongo-sanitize as mitigations, as the advisory explicitly states these do not block this attack (Github Advisory).

Community reactions

The vulnerability was discovered and reported by researcher Michael-JRead and fixed by Mongoose maintainer vkarpov15, who published the security advisory on November 23, 2026. The official CVSS score of 0.0 (Low) has drawn attention given the described impact — cross-request document access and sensitive data disclosure — which Feedly's threat intelligence categorizes as HIGH severity, reflecting a discrepancy between the formal score and practical risk. No significant broader media coverage or notable public social media discussion has been identified at this time (Github Advisory).

Additional resources


Source: This report was generated using AI

Related JavaScript vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-j7r2-xppq-m353HIGH7.5
  • JavaScript logoJavaScript
  • websocket-driver
NoYesDec 03, 2026
GHSA-hr8p-3p6h-9fw3MEDIUM6.1
  • JavaScript logoJavaScript
  • tinymce
NoYesDec 03, 2026
GHSA-4pv6-c8h9-q8v6MEDIUM4.7
  • JavaScript logoJavaScript
  • tinymce
NoYesDec 03, 2026
GHSA-4fq4-f4jg-3vmxMEDIUM4.7
  • JavaScript logoJavaScript
  • tinymce
NoYesDec 03, 2026
CVE-2026-142608NONEN/A
  • JavaScript logoJavaScript
  • mongoose
NoYesDec 02, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management