NoSQL Injection in loopback-connector-mongodb
Versions of loopback-connector-mongodb before 3.6.0 are vulnerable to NoSQL injection.
MongoDB Connector for LoopBack fails to properly sanitize a filter passed to query the database by allowing the dangerous $where property to be passed to the MongoDB Driver. The Driver allows the special $where property in a filter to execute JavaScript (client can pass in a malicious script) on the database Driver. This is an intended feature of MongoDB unless disabled (instructions here).
A proof of concept malicious query:
GET /POST filter={"where": {"$where": "function(){sleep(5000); return this.title.contains('Hello');}"}}
The above makes the database sleep for 5 seconds and then returns all “Posts” with the title containing the word Hello.
Recommendation
Update to version 3.6.0 or later.
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| npm package | loopback-connector-mongodb | < 3.6.0 | 3.6.0 |
References
- https://github.com/strongloop/loopback-connector-mongodb/issues/403
- https://github.com/strongloop/loopback-connector-mongodb/pull/452
- https://github.com/strongloop/loopback-connector-mongodb/commit/ee24cd08b8ccc32711264831c71b1da628df357b
- https://loopback.io/doc/en/lb3/Security-advisory-08-15-2018.html
- https://www.npmjs.com/advisories/696
- Weakness (CWE)
CWE-89- Platform
- npm
- Package
loopback-connector-mongodb- Disclosed
- 04.06.2019
- Updated
- 11.10.2026 10:22
Sources and licenses
OSV / GitHub Advisory Database - GHSA-m734-r4g6-34f9 - CC BY 4.0
Vulnerability history: loopback-connector-mongodb
All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.
- Total entries
- 2
- First → latest
- 06.2019 09.2020
- Without a fix
- 0
- Exploited in attacks
- 0
Severity breakdown
- High 2
Disclosures per year
- 2019: 1
- 2020: 1
- 2021: 0
- 2022: 0
- 2023: 0
- 2024: 0
- 2025: 0
- 2026: 0
-
NoSQL Injection in loopback-connector-mongodb this entry
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.