CVE-2022-35942: Loopback connector postgresql Loopback-connector-postgresql Vulnerable To Improper Sanitization Vulnerability
CRITICALCVE-2022-35942 is a CRITICAL (CVSS 9.3) loopback-connector-postgresql vulnerable to improper sanitization vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Loopback connector postgresql libraries in the npm ecosystem. The issue involves loopback-connector-postgresql vulnerable to improper sanitization of `contains` filter. Remediation is available by upgrading affected packages to version 5.5.1.
CVE-2022-35942 at a Glance
Security Impact
CVSS: 9.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H).
How to Fix CVE-2022-35942
To remediate this vulnerability, upgrade all affected Loopback connector postgresql dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install loopback-connector-postgresql@5.5.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls loopback-connector-postgresql
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2022-35942, inspect your project dependencies using npm:
npm ls loopback-connector-postgresql
Analyze the terminal output to locate any version of Loopback connector postgresql in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.5.1), your application is affected.
Note: The npm ls loopback-connector-postgresql command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Loopback connector postgresql, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2022-35942 Affected Loopback connector postgresql Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
loopback-connector-postgresql
|
npm |
< 5.5.1
|
5.5.1
|
References
Frequently Asked Questions
What is CVE-2022-35942?
Which Loopback connector postgresql versions are affected?
What version fixes CVE-2022-35942?
Is loopback-connector-postgresql affected?
What is the CVSS score of CVE-2022-35942?
What CWE is associated with CVE-2022-35942?
How can I check npm dependencies for CVE-2022-35942?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-j259-6c58-9m58",
"modified" : "2022-08-11T21:13:43Z",
"published" : "2022-08-11T21:13:43Z",
"aliases" : [ "CVE-2022-35942" ],
"summary" : "loopback-connector-postgresql Vulnerable to Improper Sanitization of `contains` Filter",
"details" : "Improper input validation on the `contains` LoopBack filter may allow for arbitrary SQL injection.\n\n### Impact\n\nWhen the extended filter property `contains` is permitted to be interpreted by the Postgres connector, it is possible to inject arbitrary SQL which may affect the confidentiality and integrity of data stored on the connected database.\n\nThis affects users who does any of the following:\n\n- Connect to the database via the DataSource with `allowExtendedProperties: true` setting OR\n- Uses the connector's CRUD methods directly OR\n- Uses the connector's other methods to interpret the LoopBack filter.\n\n### Patches\n\nPatch release `loopback-connector-postgresql@5.5.1` has been published of which resolves this issue.\n\n### Workarounds\n\nUsers who are unable to upgrade should do the following if applicable:\n\n- Remove `allowExtendedProperties: true` DataSource setting\n- Add `allowExtendedProperties: false` DataSource setting\n- When passing directly to the connector functions, manually sanitize the user input for the `contains` LoopBack filter beforehand.\n\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "loopback-connector-postgresql"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "5.5.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/loopbackio/loopback-connector-postgresql/security/advisories/GHSA-j259-6c58-9m58"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-35942"
}, {
"type" : "WEB",
"url" : "https://github.com/loopbackio/loopback-connector-postgresql/commit/d57406c6737692a3a106b58a35406290cddb23e5"
}, {
"type" : "WEB",
"url" : "https://github.com/loopbackio/loopback-connector-postgresql"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-20", "CWE-89" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2022-08-11T21:13:43Z",
"nvd_published_at" : "2022-08-12T23:15:00Z"
}
}