Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLW03MzQtcjRnNi0zNGY5

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.

Permalink: https://github.com/advisories/GHSA-m734-r4g6-34f9
JSON: https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLW03MzQtcjRnNi0zNGY5
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: over 5 years ago
Updated: almost 2 years ago


Identifiers: GHSA-m734-r4g6-34f9
References: Repository: https://github.com/strongloop/loopback-connector-mongodb
Blast Radius: 0.0

Affected Packages

npm:loopback-connector-mongodb
Dependent packages: 101
Dependent repositories: 2,377
Downloads: 66,835 last month
Affected Version Ranges: < 3.6.0
Fixed in: 3.6.0
All affected versions: 1.0.0, 1.1.0, 1.1.3, 1.1.4, 1.1.5, 1.1.6, 1.1.7, 1.1.8, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.3.0, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.5.0, 1.6.0, 1.7.0, 1.8.0, 1.9.0, 1.9.1, 1.9.2, 1.10.0, 1.10.1, 1.11.0, 1.11.1, 1.11.2, 1.11.3, 1.12.0, 1.13.0, 1.13.1, 1.13.2, 1.13.3, 1.14.0, 1.15.0, 1.15.1, 1.15.2, 1.17.0, 1.18.0, 1.18.1, 3.0.0, 3.0.1, 3.1.0, 3.2.0, 3.2.1, 3.3.0, 3.3.1, 3.4.0, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.5.0
All unaffected versions: 3.6.0, 3.7.0, 3.7.1, 3.8.0, 3.9.0, 3.9.1, 3.9.2, 4.0.0, 4.1.0, 4.2.0, 5.0.0, 5.0.1, 5.1.0, 5.2.0, 5.2.1, 5.2.2, 5.2.3, 5.2.4, 5.3.0, 5.4.0, 5.5.0, 5.6.0, 6.0.0, 6.0.1, 6.1.0, 6.2.0, 6.3.0