Vulnerabilities in pkg:npm/matrix-appservice-bridge

PACKAGE
Advisory Identifier: GHSA-vc7j-h8xg-fv5x
Advisory Summary

CVE-2023-38691 is a MODERATE (CVSS 5.0) matrix-appservice-bridge doesn't verify the sub vulnerability (CWE-287: Improper Authentication) affecting Matrix appservice bridge libraries in the npm ecosystem. The issue involves matrix-appservice-bridge doesn't verify the sub parameter of an openid token exhange, allowing unauthorized access to provisioning apis. Remediation is available by upgrading affected packages to version 8.1.2, 9.0.1.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/matrix-appservice-bridge

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/matrix-appservice-bridge. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-vc7j-h8xg-fv5x CVE-2023-38691 MODERATE matrix-appservice-bridge doesn't verify the sub parameter of an openId token exhange, allowing unauthorized access to provisioning APIs
GHSA-35g4-qx3c-vjhx CVE-2021-32659 MODERATE Automatic room upgrade handling can be used maliciously to bridge a room non-consentually

CVE-2023-38691 at a Glance

CVE Identifier CVE-2023-38691
GHSA Identifier GHSA-vc7j-h8xg-fv5x
Severity MODERATE
CVSS v3.1 Base Score 5.0
CWE Classification CWE-287: Improper Authentication
Affected Product Matrix appservice bridge
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:L/I:N/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 Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2023-38691

To remediate this vulnerability, upgrade all affected Matrix appservice bridge 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-bridge fixed: 8.1.2
npm install matrix-appservice-bridge@8.1.2
matrix-appservice-bridge fixed: 9.0.1
npm install matrix-appservice-bridge@9.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-bridge

How to Check if You Are Affected

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

npm ls matrix-appservice-bridge

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

Note: The npm ls matrix-appservice-bridge 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-287: Improper Authentication, where when an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct. In Matrix appservice bridge, 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 A malicious Matrix server can use a foreign user's MXID in an OpenID exchange, allowing a bad actor to impersonate users when using the provisioning API. ### Details The library does not check that the servername part of the `sub` parameter (containing the user's *claimed* MXID) is the same as the servername we are talking to. A malicious actor could spin up a server on any given domain, respond with a `sub` parameter according to the user they want to act as and use the resulting token to perform provisioning requests. ### Workarounds Disable the provisioning API. If the bridge does not use the provisioning API, you are not vulnerable.

CVE-2023-38691 Affected Matrix appservice bridge Versions

2 component(s)
Fixed Versions:
8.1.29.0.1
Product / Package Ecosystem Affected Versions Fixed Version
matrix-appservice-bridge
npm
≥ 4.0.0
< 8.1.2
8.1.2
matrix-appservice-bridge
npm
≥ 9.0.0
< 9.0.1
All 1 versions
9.0.0
9.0.1

References

Frequently Asked Questions

What is CVE-2023-38691?
CVE-2023-38691 is a security vulnerability in Matrix appservice bridge involving matrix-appservice-bridge doesn't verify the sub parameter of an openId token exhange, allowing unauthorized access to provisioning APIs under CWE-287: Improper Authentication.
Which Matrix appservice bridge versions are affected?
Affected versions include releases prior to 8.1.2, 9.0.1 across affected packages: matrix-appservice-bridge.
What version fixes CVE-2023-38691?
Upgrading to 8.1.2, 9.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is matrix-appservice-bridge affected?
Yes, matrix-appservice-bridge is affected in releases prior to 8.1.2, 9.0.1. Upgrade your dependency to 8.1.2, 9.0.1 or later.
What is the CVSS score of CVE-2023-38691?
CVE-2023-38691 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:L/I:N/A:N.
What CWE is associated with CVE-2023-38691?
CVE-2023-38691 is classified under CWE-287: Improper Authentication (When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.).
How can I check npm dependencies for CVE-2023-38691?
Run the dependency tree command: 'npm ls matrix-appservice-bridge'. 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-vc7j-h8xg-fv5x",
  "modified" : "2023-08-04T17:26:32Z",
  "published" : "2023-08-04T17:26:32Z",
  "aliases" : [ "CVE-2023-38691" ],
  "summary" : "matrix-appservice-bridge doesn't verify the sub parameter of an openId token exhange, allowing unauthorized access to provisioning APIs",
  "details" : "### Impact\n\nA malicious Matrix server can use a foreign user's MXID in an OpenID exchange, allowing a bad actor to impersonate users when using the provisioning API.\n\n### Details\n\nThe library does not check that the servername part of the `sub` parameter (containing the user's *claimed* MXID) is the same as the servername we are talking to. A malicious actor could spin up a server on any given domain, respond with a `sub` parameter according to the user they want to act as and use the resulting token to perform provisioning requests.\n\n### Workarounds\n\nDisable the provisioning API. If the bridge does not use the provisioning API, you are not vulnerable.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "matrix-appservice-bridge"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "8.1.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "matrix-appservice-bridge"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "9.0.0"
      }, {
        "fixed" : "9.0.1"
      } ]
    } ],
    "versions" : [ "9.0.0" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-appservice-bridge/security/advisories/GHSA-vc7j-h8xg-fv5x"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-38691"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-appservice-bridge/commit/4c6723a5e7beda65cdf1ae5dbb882e8beaac8552"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/matrix-org/matrix-appservice-bridge"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-287" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-08-04T17:26:32Z",
    "nvd_published_at" : "2023-08-04T17:15:11Z"
  }
}