CVE-2023-38690: Matrix appservice irc Matrix-appservice-irc IRC Command Injection Vulnerability

MODERATE
Advisory Identifier: GHSA-3pmj-jqqp-2mj3
CVSS 5.0
CWE-20
Published
Advisory Summary

CVE-2023-38690 is a MODERATE (CVSS 5.0) matrix-appservice-irc irc command injection vulnerability (CWE-20: Improper Input Validation) affecting Matrix appservice irc libraries in the npm ecosystem. The issue involves matrix-appservice-irc irc command injection via admin commands containing newlines. Remediation is available by upgrading affected packages to version 1.0.1.

CVE-2023-38690 at a Glance

CVE Identifier CVE-2023-38690
GHSA Identifier GHSA-3pmj-jqqp-2mj3
Severity MODERATE
CVSS v3.1 Base Score 5.0
CWE Classification CWE-20: Improper Input Validation
Affected Product Matrix appservice irc
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.0

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2023-38690

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: 1.0.1
npm install matrix-appservice-irc@1.0.1
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-2023-38690, 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 1.0.1), 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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. 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 It is possible to craft a command with newlines which would not be properly parsed. This would mean you could pass a string of commands as a channel name, which would then be run by the IRC bridge bot. ### Patches Versions 1.0.1 and above are patched. ### Workarounds There are no robust workarounds to the bug. You can disable dynamic channels in the config to disable the most common execution method but others may exist. It is highly recommended to upgrade the bridge. ### 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-2023-38690 Affected Matrix appservice irc Versions

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

References

Frequently Asked Questions

What is CVE-2023-38690?
CVE-2023-38690 is a security vulnerability in Matrix appservice irc involving matrix-appservice-irc IRC command injection via admin commands containing newlines under CWE-20: Improper Input Validation.
Which Matrix appservice irc versions are affected?
Affected versions include releases prior to 1.0.1 across affected packages: matrix-appservice-irc.
What version fixes CVE-2023-38690?
Upgrading to 1.0.1 (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 1.0.1. Upgrade your dependency to 1.0.1 or later.
What is the CVSS score of CVE-2023-38690?
CVE-2023-38690 has a CVSS v3.1 base score of 5.0 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:L/A:N.
What CWE is associated with CVE-2023-38690?
CVE-2023-38690 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check npm dependencies for CVE-2023-38690?
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-3pmj-jqqp-2mj3",
  "modified" : "2024-06-20T14:53:30Z",
  "published" : "2023-08-04T17:26:45Z",
  "aliases" : [ "CVE-2023-38690" ],
  "summary" : "matrix-appservice-irc IRC command injection via admin commands containing newlines ",
  "details" : "### Impact\n\nIt is possible to craft a command with newlines which would not be properly parsed. This would mean you could pass a string of commands as a channel name, which would then be run by the IRC bridge bot. \n\n### Patches\n\nVersions 1.0.1 and above are patched.\n\n### Workarounds\n\nThere are no robust workarounds to the bug. You can disable dynamic channels in the config to disable the most common execution method but others may exist. It is highly recommended to upgrade the bridge.\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:L/UI:N/S:C/C:N/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "matrix-appservice-irc"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.0.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-appservice-irc/security/advisories/GHSA-3pmj-jqqp-2mj3"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-38690"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-appservice-irc/commit/0afb064635d37e039067b5b3d6423448b93026d3"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/matrix-org/matrix-appservice-irc"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-appservice-irc/releases/tag/1.0.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-08-04T17:26:45Z",
    "nvd_published_at" : "2023-08-04T17:15:10Z"
  }
}