CVE-2021-32659: Matrix appservice bridge Automatic Room Upgrade Handling Can Vulnerability

MODERATE
Advisory Identifier: GHSA-35g4-qx3c-vjhx
CVSS 6.5
CWE-306
Published
Advisory Summary

CVE-2021-32659 is a MODERATE (CVSS 6.5) automatic room upgrade handling can vulnerability (CWE-306: Missing Authentication for Critical Function) affecting Matrix appservice bridge libraries in the npm ecosystem. The issue involves automatic room upgrade handling can be used maliciously to bridge a room non-consentually. Remediation is available by upgrading affected packages to version 2.6.1.

CVE-2021-32659 at a Glance

CVE Identifier CVE-2021-32659
GHSA Identifier GHSA-35g4-qx3c-vjhx
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-306: Missing Authentication for Critical Function
Affected Product Matrix appservice bridge
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.5

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:U/C:H/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 Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2021-32659

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: 2.6.1
npm install matrix-appservice-bridge@2.6.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-2021-32659, 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 2.6.1), 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-306: Missing Authentication for Critical Function, where the product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources. 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 If a bridge has room upgrade handling turned on in the configuration (the `roomUpgradeOpts` key when instantiating a new `Bridge` instance.), any `m.room.tombstone` event it encounters will be used to unbridge the current room and bridge into the target room. However, the target room `m.room.create` event is not checked to verify if the `predecessor` field contains the previous room. This means that any mailcious admin of a bridged room can repoint the traffic to a different room without the new room being aware. ### Patches Versions 2.6.1 and greater are patched. ### Workarounds Disabling the automatic room upgrade handling can be done by removing the `roomUpgradeOpts` key from the `Bridge` class options. ### References The issue is patched by https://github.com/matrix-org/matrix-appservice-bridge/pull/330 ### For more information] If you have any questions or comments about this advisory, email us at security@matrix.org.

CVE-2021-32659 Affected Matrix appservice bridge Versions

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

References

Frequently Asked Questions

What is CVE-2021-32659?
CVE-2021-32659 is a security vulnerability in Matrix appservice bridge involving Automatic room upgrade handling can be used maliciously to bridge a room non-consentually under CWE-306: Missing Authentication for Critical Function.
Which Matrix appservice bridge versions are affected?
Affected versions include releases prior to 2.6.1 across affected packages: matrix-appservice-bridge.
What version fixes CVE-2021-32659?
Upgrading to 2.6.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 2.6.1. Upgrade your dependency to 2.6.1 or later.
What is the CVSS score of CVE-2021-32659?
CVE-2021-32659 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2021-32659?
CVE-2021-32659 is classified under CWE-306: Missing Authentication for Critical Function (The product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources.).
How can I check npm dependencies for CVE-2021-32659?
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-35g4-qx3c-vjhx",
  "modified" : "2021-06-16T20:08:37Z",
  "published" : "2021-06-21T17:09:22Z",
  "aliases" : [ "CVE-2021-32659" ],
  "summary" : "Automatic room upgrade handling can be used maliciously to bridge a room non-consentually ",
  "details" : "### Impact\n\nIf a bridge has room upgrade handling turned on in the configuration (the `roomUpgradeOpts` key when instantiating a new `Bridge` instance.), any `m.room.tombstone` event it encounters will be used to unbridge the current room and bridge into the target room. However, the target room `m.room.create` event is not checked to verify if the `predecessor` field contains the previous room. This means that any mailcious admin of a bridged room can repoint the traffic to a different room without the new room being aware.\n\n\n### Patches\n\nVersions 2.6.1 and greater are patched.\n\n### Workarounds\n\nDisabling the automatic room upgrade handling can be done by removing the `roomUpgradeOpts` key from the `Bridge` class options. \n\n### References\n\nThe issue is patched by https://github.com/matrix-org/matrix-appservice-bridge/pull/330\n\n### For more information]\n\nIf you have any questions or comments about this advisory, email us at security@matrix.org.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "matrix-appservice-bridge"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.6.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-appservice-bridge/security/advisories/GHSA-35g4-qx3c-vjhx"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-32659"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-appservice-bridge/pull/330"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-appservice-bridge/commit/b69e745584a34fcfd858df33e4631e420da07b9f"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-appservice-bridge/releases/tag/2.6.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-306" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-06-16T20:08:37Z",
    "nvd_published_at" : "2021-06-16T19:15:00Z"
  }
}