CVE-2022-39202: Matrix appservice irc Matrix-appservice-irc Vulnerable To IRC Mode Vulnerability

MODERATE
Advisory Identifier: GHSA-cq7q-5c67-w39w
CVSS 4.3
CWE-269
Published
Advisory Summary

CVE-2022-39202 is a MODERATE (CVSS 4.3) matrix-appservice-irc vulnerable to irc mode vulnerability (CWE-269: Improper Privilege Management) affecting Matrix appservice irc libraries in the npm ecosystem. The issue involves matrix-appservice-irc vulnerable to irc mode parameter confusion. Remediation is available by upgrading affected packages to version 0.35.0.

CVE-2022-39202 at a Glance

CVE Identifier CVE-2022-39202
GHSA Identifier GHSA-cq7q-5c67-w39w
Severity MODERATE
CVSS v3.1 Base Score 4.3
CWE Classification CWE-269: Improper Privilege Management
Affected Product Matrix appservice irc
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 4.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:U/C:L/I:L/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2022-39202

To remediate this vulnerability, upgrade all affected Matrix appservice irc dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

matrix-appservice-irc fixed: 0.35.0
npm install matrix-appservice-irc@0.35.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls matrix-appservice-irc

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2022-39202, inspect your project dependencies using npm:

npm ls matrix-appservice-irc

Analyze the terminal output to locate any version of Matrix appservice irc in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.35.0), your application is affected.

Note: The npm ls matrix-appservice-irc 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-269: Improper Privilege Management, where the product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor. In Matrix appservice irc, 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

### Impact IRC allows you to specify multiple modes in a single mode command. Due to a bug in the underlying matrix-org/node-irc library, affected versions of matrix-appservice-irc perform parsing of such modes incorrectly, potentially resulting in the wrong user being given permissions. Mode commands can only be executed by privileged users, so this can only be abused if an operator is tricked into running the command on behalf of an attacker. ### Patches The vulnerability has been patched in matrix-appservice-irc 0.35.0. ### Workarounds Refrain from entering mode commands suggested by untrusted users. Avoid using multiple modes in a single command. ### References - https://matrix.org/blog/2022/09/13/security-release-of-matrix-appservice-irc-0-35-0-high-severity ### Credits Discovered and reported by [Val Lorentz](https://valentin-lorentz.fr/). ### For more information If you have any questions or comments about this advisory email us at [security@matrix.org](mailto:security@matrix.org).

CVE-2022-39202 Affected Matrix appservice irc Versions

1 component(s)
Fixed Versions:
0.35.0
Product / Package Ecosystem Affected Versions Fixed Version
matrix-appservice-irc
npm
< 0.35.0
0.35.0

References

Frequently Asked Questions

What is CVE-2022-39202?
CVE-2022-39202 is a security vulnerability in Matrix appservice irc involving matrix-appservice-irc vulnerable to IRC mode parameter confusion under CWE-269: Improper Privilege Management.
Which Matrix appservice irc versions are affected?
Affected versions include releases prior to 0.35.0 across affected packages: matrix-appservice-irc.
What version fixes CVE-2022-39202?
Upgrading to 0.35.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is matrix-appservice-irc affected?
Yes, matrix-appservice-irc is affected in releases prior to 0.35.0. Upgrade your dependency to 0.35.0 or later.
What is the CVSS score of CVE-2022-39202?
CVE-2022-39202 has a CVSS v3.1 base score of 4.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2022-39202?
CVE-2022-39202 is classified under CWE-269: Improper Privilege Management (The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor.).
How can I check npm dependencies for CVE-2022-39202?
Run the dependency tree command: 'npm ls matrix-appservice-irc'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-cq7q-5c67-w39w",
  "modified" : "2022-10-07T16:25:42Z",
  "published" : "2022-09-15T03:26:25Z",
  "aliases" : [ "CVE-2022-39202" ],
  "summary" : "matrix-appservice-irc vulnerable to IRC mode parameter confusion",
  "details" : "### Impact\n\nIRC allows you to specify multiple modes in a single mode command. Due to a bug in the underlying matrix-org/node-irc library, affected versions of matrix-appservice-irc perform parsing of such modes incorrectly, potentially resulting in the wrong user being given permissions.\n\nMode commands can only be executed by privileged users, so this can only be abused if an operator is tricked into running the command on behalf of an attacker.\n\n### Patches\n\nThe vulnerability has been patched in matrix-appservice-irc 0.35.0.\n\n### Workarounds\n\nRefrain from entering mode commands suggested by untrusted users. Avoid using multiple modes in a single command.\n\n### References\n\n- https://matrix.org/blog/2022/09/13/security-release-of-matrix-appservice-irc-0-35-0-high-severity\n\n### Credits\n\nDiscovered and reported by [Val Lorentz](https://valentin-lorentz.fr/).\n\n### For more information\n\nIf you have any questions or comments about this advisory email us at [security@matrix.org](mailto:security@matrix.org).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "matrix-appservice-irc"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.35.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-appservice-irc/security/advisories/GHSA-cq7q-5c67-w39w"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-39202"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-appservice-irc/commit/5f87dbed87b4b6dc49b7965ff152ee8535719e67"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/matrix-org/matrix-appservice-irc"
  }, {
    "type" : "WEB",
    "url" : "https://matrix.org/blog/2022/09/13/security-release-of-matrix-appservice-irc-0-35-0-high-severity"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-269" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-09-15T03:26:25Z",
    "nvd_published_at" : "2022-09-13T18:15:00Z"
  }
}