{"id":"CVE-2026-125119","aliases":["CVE-2026-125119","GHSA-gg4r-jv3p-qx3c","BIT-MONGOOSE-2026-125119"],"related":[],"kind":"vulnerability","state":"published","title":"Mongoose: Connection-level sanitizeFilter not applied","summary":"Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. From 6.0.0 until 6.13.12, 7.8.13, 8.24.7, and 9.11.4, Mongoose stores the connection-level sanitizeFilter option in Connection.config, but Query.prototype._castConditions() and query casting check other option locations and do not read that configuration. An application that enables sanitizeFilter through mongoose.connect() or createConnection() and passes an attacker-controlled object into a query filter therefore receives a connection that reports the defense as enabled while query selector objects remain unsanitized. A crafted password value using a query operator can match an account record without the expected literal password, while global configuration through mongoose.set('sanitizeFilter') and per-query Model.find().sanitizeFilter() remain unaffected. This issue is fixed in versions 6.13.12, 7.8.13, 8.24.7, and 9.11.4.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. From 6.0.0 until 6.13.12, 7.8.13, 8.24.7, and 9.11.4, Mongoose stores the connection-level sanitizeFilter option in Connection.config, but Query.prototype._castConditions() and query casting check other option locations and do not read that configuration. An application that enables sanitizeFilter through mongoose.connect() or createConnection() and passes an attacker-controlled object into a query filter therefore receives a connection that reports the defense as enabled while query selector objects remain unsanitized. A crafted password value using a query operator can match an account record without the expected literal password, while global configuration through mongoose.set('sanitizeFilter') and per-query Model.find().sanitizeFilter() remain unaffected. This issue is fixed in versions 6.13.12, 7.8.13, 8.24.7, and 9.11.4.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nsanitizeFilter exists to stop query selector injection: it wraps operator objects such as `{ $ne: null }` in filter values in `$eq`, so they are matched literally. Set on a connection with `mongoose.connect()` or `createConnection(uri, { sanitizeFilter: true })`, the connection reports it as enabled but queries never apply it. An application that relies on the connection-level option and passes an attacker-controlled object into a filter therefore remains open to selector injection, and a password value of `{ $ne: null }` returns the account record without the password.\n\n### Details\n\n`NativeConnection#createClient()` at `lib/drivers/node-mongodb-native/connection.js:270-272` moves `options.sanitizeFilter` into `Connection.config` and deletes the original option. `Query#_castConditions()` at `lib/query.js:2413-2423` checks `Connection.options`, the global `options`, and the per-query options, but never `Connection.config`. The defense therefore does not run even though `Connection#get('sanitizeFilter')` returns true. This storage was introduced in Mongoose 6.0.0 and the same mismatch is present in 9.11.2.\n\n### Proof of concept\n\n```javascript\nimport mongoose from 'mongoose'\n\nconst conn = await mongoose.createConnection('<MONGODB_URI>', { sanitizeFilter: true }).asPromise()\nconst User = conn.model('User', new mongoose.Schema({\n  username: String,\n  password: String,\n  marker: String\n}))\n\nawait User.create({\n  username: 'victim',\n  password: 'correct-password',\n  marker: 'PROTECTED_RECORD'\n})\n\nconst filter = { username: 'victim', password: { $ne: null } }\nconsole.log(conn.get('sanitizeFilter'))\nconsole.log((await User.findOne(filter).lean()).marker)\n```\n\nA control query with a literal wrong password returned no document in the same run, confirming the filter is otherwise enforced.\n\n### Impact\n\nConnection-level `sanitizeFilter` option is not respected. Any user that relies on connection-level config and `sanitizeFilter` to defend against query selector injection is affected. Users that set `sanitizeFilter` globally using `mongoose.set('sanitizeFilter')` or on specific queries using `Model.find().sanitizeFilter()` are not affected.","format":"markdown","source":"ghsa"}],"published":"2026-11-09T22:32:49.132Z","modified":"2026-11-27T06:55:58.082Z","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-943"],"affected":[{"ranges":[{"version":">= 6.0.0, < 6.13.12","status":"affected"},{"version":">= 7.0.0, < 7.8.13","status":"affected"},{"version":">= 8.0.0, < 8.24.7","status":"affected"},{"version":">= 9.0.0, < 9.11.4","status":"affected"}],"vendor":"Automattic","product":"mongoose","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"6.0.0","status":"affected","fixed":"6.13.12"}],"ecosystem":"npm","package":"mongoose","purl":"pkg:npm/mongoose","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"7.0.0","status":"affected","fixed":"7.8.13"}],"ecosystem":"npm","package":"mongoose","purl":"pkg:npm/mongoose","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"8.0.0","status":"affected","fixed":"8.24.7"}],"ecosystem":"npm","package":"mongoose","purl":"pkg:npm/mongoose","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"9.0.0","status":"affected","fixed":"9.11.4"}],"ecosystem":"npm","package":"mongoose","purl":"pkg:npm/mongoose","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"6.0.0","status":"affected","fixed":"6.13.12"},{"type":"semver","introduced":"7.0.0","status":"affected","fixed":"7.8.13"},{"type":"semver","introduced":"8.0.0","status":"affected","fixed":"8.24.7"},{"type":"semver","introduced":"9.0.0","status":"affected","fixed":"9.11.4"}],"ecosystem":"Bitnami","package":"mongoose","purl":"pkg:bitnami/mongoose","source":"bitnami"}],"references":[{"url":"https://github.com/Automattic/mongoose/security/advisories/GHSA-gg4r-jv3p-qx3c","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://github.com/Automattic/mongoose/commit/4bb659478be2f30655a7bdd78bc251bdf111cd29","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://github.com/Automattic/mongoose/commit/4f4f9a79f860786a54133bee2c9af967ec691491","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://github.com/Automattic/mongoose/commit/83eda6af1489e9ef60bb8eee8cf9ee005771b9d5","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://github.com/Automattic/mongoose/commit/b8970c25998c23fbccd17f76c0398b902ff4911d","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://github.com/Automattic/mongoose/releases/tag/6.13.12","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://github.com/Automattic/mongoose/releases/tag/7.8.13","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://github.com/Automattic/mongoose/releases/tag/8.24.7","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://github.com/Automattic/mongoose/releases/tag/9.11.4","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-125119","tags":["advisory","web"],"sources":["ghsa","bitnami"]},{"url":"https://github.com/Automattic/mongoose","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-11-12T16:37:36.614Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-125119","url":"https://www.cve.org/CVERecord?id=CVE-2026-125119","licence":"CVE Terms of Use","modified":"2026-11-12T18:04:30.712Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-gg4r-jv3p-qx3c","url":"https://github.com/advisories/GHSA-gg4r-jv3p-qx3c","licence":"CC-BY-4.0","modified":"2026-11-27T06:55:58.082Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-125119","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-125119","licence":"Public domain","modified":"2026-11-12T19:18:09.510Z"},{"source":"bitnami","name":"Bitnami Vulnerability Database","id":"BIT-MONGOOSE-2026-125119","url":"https://osv.dev/vulnerability/BIT-MONGOOSE-2026-125119","licence":"Apache-2.0","modified":"2026-11-27T06:55:58.082Z"}],"updatedAt":"2026-11-27T07:07:28.517Z","epss":{"score":0.00709,"percentile":0.54706,"date":"2026-12-01T12:00:22.000Z"}}