# CVE-2022-3971: Matrix-appservice-irc SQL injection via roomIds argument

Source: https://junglewise.ai/threats/cve-2022-3971-matrix-appservice-irc-sql-injection-via-roomids-argument  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2022-11-13. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2022-3971 · Severity: low · CVSS 3.1 · Published 2022-11-13

Matrix-appservice-irc is a bridge component that allows Matrix chat users to communicate with IRC networks. A SQL injection vulnerability in the roomIds parameter could allow an attacker with control over room mappings to manipulate database queries, potentially exposing or corrupting chat data stored in the PostgreSQL backend.

Technologies: [matrix-appservice-irc (npm)](https://junglewise.ai/threats/technologies/matrix-appservice-irc). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is CVE-2022-3971 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2022-3971 being exploited in the wild.

**How severe is CVE-2022-3971?** Low severity, with a CVSS score of 3.1, published 13 November 2022.

**Which products and versions are affected?** matrix-appservice-irc (npm) SEMVER:introduced=0,fixed=0.36.0.

**Is there a fix for CVE-2022-3971?** Yes. matrix-appservice-irc (npm): upgrade to 0.36.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2022-3971 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2022-3971?** Check whether you run matrix-appservice-irc (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- matrix-appservice-irc (npm): upgrade to 0.36.0 or later

  ```sh
  npm install matrix-appservice-irc@0.36.0
  ```


## Technical details

The vulnerability is a SQL injection flaw (CWE-89) in src/datastore/postgres/PgDataStore.ts affecting how the roomIds argument is processed when checking room visibility. An attacker who can set malicious Matrix IDs in room mappings can inject SQL commands into database queries. The attack requires administrative control over room configuration; it is not remotely exploitable by unauthenticated users. Successful exploitation could lead to unauthorized data disclosure or modification of the database. The issue was fixed in version 0.36.0 via patch 179313a37f06b298150edba3e2b0e5a73c1415e7.

## Affected products

- Matrix.org matrix-appservice-irc prior to 0.36.0

## Identifiers

- CVE-2022-3971
- GHSA-ffwf-47x2-jpr8

## Timeline

- 2022-11-13: disclosed
- 2022-11-15: patched: Patch merged in PR #1619; fixed in version 0.36.0

## References

- [https://github.com/matrix-org/matrix-appservice-irc/pull/1619](https://github.com/matrix-org/matrix-appservice-irc/pull/1619)

## Related threats

- [Matrix IRC Bridge command injection in puppeted user](https://junglewise.ai/threats/cve-2025-27146-matrix-irc-bridge-command-injection-in-puppeted-user)
- [Matrix AppService IRC message content leak via timestamp spoofing](https://junglewise.ai/threats/cve-2024-39691-matrix-appservice-irc-message-content-leak-via-timestamp-spoofing)
- [Matrix IRC Bridge message content information disclosure](https://junglewise.ai/threats/cve-2024-32000-matrix-irc-bridge-message-content-information-disclosure)
- [Matrix matrix-appservice-irc IRC command injection via newlines](https://junglewise.ai/threats/cve-2023-38690-matrix-matrix-appservice-irc-irc-command-injection-via-newlines)
- [Matrix AppService IRC information disclosure in event handling](https://junglewise.ai/threats/cve-2023-38700-matrix-appservice-irc-information-disclosure-in-event-handling)
