CVE-2022-35942 loopback-connector-postgresql Vulnerable to Improper Sanitization of `contains` Filter
Attackers can inject arbitrary SQL via the contains filter in loopback-connector-postgresql, compromising database confidentiality and integrity.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2022-35942?
CVE-2022-35942 is a critical SQL injection vulnerability in loopbackio loopback-connector-postgresql, published on 12 Aug 2022. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
Improper input validation on the `contains` LoopBack filter may allow for arbitrary SQL injection. When 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. A patch was released in version 5.5.1. This affects users who does any of the following: - Connect to the database via the DataSource with `allowExtendedProperties: true` setting OR - Uses the connector's CRUD methods directly OR - Uses the connector's other methods to interpret the LoopBack filter. Users who are unable to upgrade should do the following if applicable: - Remove `allowExtendedProperties: true` DataSource setting - Add `allowExtendedProperties: false` DataSource setting - When passing directly to the connector functions, manually sanitize the user input for the `contains` LoopBack filter beforehand.
Weakness: CWE-89
Which versions are affected by CVE-2022-35942?
2 open source packages ship an affected version, including loopback-connector-postgresql. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
loopback-connector-postgresql npm | All versions | 5.5.1 |
loopback-connector-postgresql npm | All versions | 5.5.1 |
Products include Linuxfoundation Loopback-Connector-Postgresql.
How do I fix CVE-2022-35942?
Upgrade loopback-connector-postgresql to 5.5.1 or later.
Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.
Is CVE-2022-35942 being exploited?
There is no known exploitation of CVE-2022-35942 in the wild and no public exploit code.
Sources
Also known as GHSA-j259-6c58-9m58.