{"id":"CVE-2026-42334","aliases":["CVE-2026-42334","GHSA-wpg9-53fq-2r8h","BIT-MONGOOSE-2026-42334"],"related":[],"kind":"vulnerability","state":"published","title":"Mongoose: Improper Sanitization of $nor in sanitizeFilter May Allow NoSQL Injection","summary":"Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Prior to 6.13.9, 7.8.9, 8.22.1, and 9.1.6, a vulnerability allows bypassing Mongoose’s sanitizeFilter query sanitization mechanism via the $nor operator. When sanitizeFilter is enabled, Mongoose wraps query operators in $eq to neutralize them. However, prior to the fix, $nor was not included in the set of logical operators that are recursively sanitized. Because $nor accepts an array (like $and and $or), and arrays do not trigger hasDollarKeys(), malicious operators such as $ne, $gt, or $regex could be injected inside a $nor clause without being sanitized. This vulnerability is fixed in 6.13.9, 7.8.9, 8.22.1, and 9.1.6.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Prior to 6.13.9, 7.8.9, 8.22.1, and 9.1.6, a vulnerability allows bypassing Mongoose’s sanitizeFilter query sanitization mechanism via the $nor operator. When sanitizeFilter is enabled, Mongoose wraps query operators in $eq to neutralize them. However, prior to the fix, $nor was not included in the set of logical operators that are recursively sanitized. Because $nor accepts an array (like $and and $or), and arrays do not trigger hasDollarKeys(), malicious operators such as $ne, $gt, or $regex could be injected inside a $nor clause without being sanitized. This vulnerability is fixed in 6.13.9, 7.8.9, 8.22.1, and 9.1.6.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nThis vulnerability allows bypassing Mongoose’s sanitizeFilter query sanitization mechanism via the `$nor` operator.\n\nWhen sanitizeFilter is enabled, Mongoose wraps query operators in `$eq` to neutralize them. However, prior to the fix, `$nor` was not included in the set of logical operators that are recursively sanitized. Because `$nor` accepts an array (like `$and` and `$or`), and arrays do not trigger `hasDollarKeys()`, malicious operators such as `$ne`, `$gt`, or `$regex` could be injected inside a `$nor` clause without being sanitized.\n\nThis may lead to:\n\n- Authentication bypass\n- Unauthorized data access\n- Data exfiltration\n\n**Affected users:**\n\nApplications that:\n\n- Explicitly enable sanitizeFilter\n- Pass unsanitized user-controlled input directly into query methods (e.g., `Model.findOne(req.body)`) and rely on `sanitizeFilter` to strip out query selectors\n\nApplications that validate input schemas, whitelist fields, or avoid passing raw request bodies into queries are not affected. For example, `Model.findOne({ user: req.body.user, pwd: req.body.pwd })` is not affected.\n\n### Patches\n\nPatches have been released for all supported Mongoose release lines:\n\n- `^6.13.9`\n- `^7.8.9`\n- `^8.22.1`\n- `^9.1.6`   \n\n### Workarounds\n\nDelete `$nor` keys, use an additional schema validation library, or write middleware to strip out `$nor` from query filters.\n\n### Resources\n\nsanitizeFilter documentation: https://mongoosejs.com/docs/api/mongoose.html#Mongoose.prototype.sanitizeFilter()\n\nOriginal blog post on sanitizeFilter: https://thecodebarbarian.com/whats-new-in-mongoose-6-sanitizefilter.html","format":"markdown","source":"ghsa"},{"lang":"es","text":"Mongoose es una herramienta de modelado de objetos de MongoDB diseñada para funcionar en un entorno asíncrono. Antes de las versiones 6.13.9, 7.8.9, 8.22.1 y 9.1.6, una vulnerabilidad permite eludir el mecanismo de saneamiento de consultas sanitizeFilter de Mongoose a través del operador $nor. Cuando sanitizeFilter está habilitado, Mongoose envuelve los operadores de consulta en $eq para neutralizarlos. Sin embargo, antes de la corrección, $nor no estaba incluido en el conjunto de operadores lógicos que son saneados recursivamente. Debido a que $nor acepta un array (como $and y $or), y los arrays no activan hasDollarKeys(), operadores maliciosos como $ne, $gt o $regex podrían ser inyectados dentro de una cláusula $nor sin ser saneados. Esta vulnerabilidad está corregida en las versiones 6.13.9, 7.8.9, 8.22.1 y 9.1.6.","source":"nvd"}],"published":"2026-05-05T21:48:06.000Z","modified":"2026-10-26T14:10:00.130Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"Bitnami Vulnerability Database","scheme":"rating","rating":"HIGH"}],"cwes":["CWE-74"],"affected":[{"ranges":[{"version":"< 6.13.9","status":"affected"},{"version":">= 7.0.0, <= 7.8.8","status":"affected"},{"version":">= 8.0.0, <= 8.22.0","status":"affected"},{"version":">= 9.0.0, <= 9.1.5","status":"affected"}],"vendor":"Automattic","product":"mongoose","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"6.13.9"}],"ecosystem":"npm","package":"mongoose","purl":"pkg:npm/mongoose","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"7.0.0","status":"affected","fixed":"7.8.9"}],"ecosystem":"npm","package":"mongoose","purl":"pkg:npm/mongoose","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"8.0.0","status":"affected","fixed":"8.22.1"}],"ecosystem":"npm","package":"mongoose","purl":"pkg:npm/mongoose","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"9.0.0","status":"affected","fixed":"9.1.6"}],"ecosystem":"npm","package":"mongoose","purl":"pkg:npm/mongoose","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"6.13.9"},{"status":"affected","introduced":"7.0.0","fixed":"7.8.9"},{"status":"affected","introduced":"8.0.0","fixed":"8.22.1"},{"status":"affected","introduced":"9.0.0","fixed":"9.1.6"}],"vendor":"mongoosejs","product":"mongoose","cpe":"cpe:2.3:a:mongoosejs:mongoose:*:*:*:*:*:node.js:*:*","source":"nvd"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"6.13.9"},{"type":"semver","introduced":"7.0.0","status":"affected","fixed":"7.8.9"},{"type":"semver","introduced":"8.0.0","status":"affected","fixed":"8.22.1"},{"type":"semver","introduced":"9.0.0","status":"affected","fixed":"9.1.6"}],"ecosystem":"Bitnami","package":"mongoose","purl":"pkg:bitnami/mongoose","source":"bitnami"}],"references":[{"url":"https://github.com/Automattic/mongoose/security/advisories/GHSA-wpg9-53fq-2r8h","tags":["advisory","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42334","tags":["advisory","web"],"sources":["ghsa","bitnami"]},{"url":"https://github.com/Automattic/mongoose","tags":["package"],"sources":["ghsa"]},{"url":"https://mongoosejs.com/docs/api/mongoose.html#Mongoose.prototype.sanitizeFilter()","tags":["web"],"sources":["ghsa"]},{"url":"https://thecodebarbarian.com/whats-new-in-mongoose-6-sanitizefilter.html","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-05-14T18:17:58.426Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-42334","url":"https://www.cve.org/CVERecord?id=CVE-2026-42334","licence":"CVE Terms of Use","modified":"2026-05-14T18:18:06.935Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-wpg9-53fq-2r8h","url":"https://github.com/advisories/GHSA-wpg9-53fq-2r8h","licence":"CC-BY-4.0","modified":"2026-05-18T08:11:23.589Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-42334","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42334","licence":"Public domain","modified":"2026-10-26T14:10:00.130Z"},{"source":"bitnami","name":"Bitnami Vulnerability Database","id":"BIT-MONGOOSE-2026-42334","url":"https://osv.dev/vulnerability/BIT-MONGOOSE-2026-42334","licence":"Apache-2.0","modified":"2026-09-08T08:48:14.522Z"}],"updatedAt":"2026-11-25T22:59:21.735Z","epss":{"score":0.00465,"percentile":0.32331,"date":"2026-11-30T12:00:22.000Z"}}