# CVE-2019-17426: Improper Input Validation in Automattic Mongoose


- **Severity:** Critical 9.1 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Fix available:** Yes
- **Published:** 10 Oct 2019
- **Updated:** 5 Aug 2024
- **Also known as:** GHSA-8687-vv9j-hgph

## What is CVE-2019-17426?

CVE-2019-17426 is a critical vulnerability in n/a, published on 10 Oct 2019. 

### Official description

Automattic Mongoose through 5.7.4 allows attackers to bypass access control (in some applications) because any query object with a _bsontype attribute is ignored. For example, adding "_bsontype":"a" can sometimes interfere with a query filter. NOTE: this CVE is about Mongoose's failure to work around this _bsontype special case that exists in older versions of the bson parser (aka the mongodb/js-bson project).

## Which versions are affected by CVE-2019-17426?

4 open source packages ship an affected version, including mongoose. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `mongoose` | npm | All versions | 4.13.21 |
| `mongoose` | npm | All versions | 4.13.21 |
| `mongoose` | npm | From 5.0.0 | 5.7.5 |
| `mongoose` | npm | From 5.0.0 | 5.7.5 |

Products: Mongoosejs Mongoose.

## How do I fix CVE-2019-17426?

Upgrade mongoose to a fixed version for your release line: 4.13.21 or 5.7.5.

## Is CVE-2019-17426 being exploited?

There is no known exploitation of CVE-2019-17426 in the wild and no public exploit code.

## Other vulnerabilities in n/a

- [CVE-2023-3696](https://insights.sbomify.com/CVE-2023-3696/): Prototype Pollution in automattic/mongoose (critical 10.0)
- [CVE-2024-53900](https://insights.sbomify.com/CVE-2024-53900/): Mongoose search injection vulnerability (critical 9.1)
- [CVE-2025-23061](https://insights.sbomify.com/CVE-2025-23061/): Mongoose search injection vulnerability (critical 9.0)
- [CVE-2026-42334](https://insights.sbomify.com/CVE-2026-42334/): Mongoose: Improper Sanitization of $nor in sanitizeFilter May Allow NoSQL Injection (high 7.5)
- [CVE-2022-2564](https://insights.sbomify.com/CVE-2022-2564/): Prototype Pollution in automattic/mongoose (high 7.0)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2019-17426 and fix it if it is affected.

What it is: CVE-2019-17426 is a critical vulnerability in n/a, published on 10 Oct 2019. 
Exploitation: There is no known exploitation of CVE-2019-17426 in the wild and no public exploit code.

Affected packages and fixed versions:
- mongoose (npm): affected all versions; fixed in 4.13.21
- mongoose (npm): affected all versions; fixed in 4.13.21
- mongoose (npm): affected from 5.0.0; fixed in 5.7.5
- mongoose (npm): affected from 5.0.0; fixed in 5.7.5

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2019-17426/ (Markdown: https://insights.sbomify.com/CVE-2019-17426/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2019-17426
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2019-17426
- OSV: https://osv.dev/vulnerability/CVE-2019-17426

---
From sbomify Insights: https://insights.sbomify.com/CVE-2019-17426/
Summaries are generated and may contain mistakes; the official description above is the record.
