CVE-2022-3971 matrix-appservice-irc PgDataStore.ts sql injection

Medium 4.6 Published Updated

Attackers can execute arbitrary SQL commands via the roomIds argument in the Matrix IRC bridge, potentially reading or modifying database contents.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2022-3971?

CVE-2022-3971 is a medium-severity SQL injection vulnerability in unspecified matrix-appservice-irc, published on 13 Nov 2022. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

A vulnerability was found in matrix-appservice-irc up to 0.35.1. It has been declared as critical. This vulnerability affects unknown code of the file src/datastore/postgres/PgDataStore.ts. The manipulation of the argument roomIds leads to sql injection. Upgrading to version 0.36.0 is able to address this issue. The name of the patch is 179313a37f06b298150edba3e2b0e5a73c1415e7. It is recommended to upgrade the affected component. VDB-213550 is the identifier assigned to this vulnerability.

Weakness: CWE-707

Which versions are affected by CVE-2022-3971?

2 open source packages ship an affected version, including matrix-appservice-irc. It affects 1 product.

PackageAffectedFixed in
matrix-appservice-irc npmAll versions0.36.0
matrix-appservice-irc npmAll versions0.36.0

Products include Matrix Matrix Irc Bridge.

How do I fix CVE-2022-3971?

Upgrade matrix-appservice-irc to 0.36.0 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-3971 being exploited?

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

Sources

Also known as GHSA-ffwf-47x2-jpr8.

Is CVE-2022-3971 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free