CVE-2022-36009: Github.com/matrix org/dendrite Gomatrixserverlib And Dendrite Vulnerable To Vulnerability

MODERATE
Advisory Identifier: GHSA-grvv-h2f9-7v9c
CVSS 5.0
CWE-863
Published
Advisory Summary

CVE-2022-36009 is a MODERATE (CVSS 5.0) gomatrixserverlib and dendrite vulnerable to vulnerability (CWE-863: Incorrect Authorization) affecting Github.com/matrix org/dendrite libraries in the Go ecosystem. The issue involves gomatrixserverlib and dendrite vulnerable to incorrect parsing of the event default power level in event auth. Remediation is available by upgrading affected packages to version 0.9.3, 0.0.0-20220815091947-723fd495dde8.

CVE-2022-36009 at a Glance

CVE Identifier CVE-2022-36009
GHSA Identifier GHSA-grvv-h2f9-7v9c
Severity MODERATE
CVSS v3.1 Base Score 5.0
CWE Classification CWE-863: Incorrect Authorization
Affected Product Github.com/matrix org/dendrite
Package Ecosystem Go
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:H/PR:L/UI:N/S:U/C:L/I:L/A:L).

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

How to Fix CVE-2022-36009

To remediate this vulnerability, upgrade all affected Github.com/matrix org/dendrite dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/matrix-org/dendrite fixed: 0.9.3
Upgrade github.com/matrix-org/dendrite to 0.9.3
github.com/matrix-org/gomatrixserverlib fixed: 0.0.0-20220815091947-723fd495dde8
Upgrade github.com/matrix-org/gomatrixserverlib to 0.0.0-20220815091947-723fd495dde8
Verify Direct and Transitive Dependencies

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

inspect dependencies for github.com/matrix-org/dendrite

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-36009, inspect your project dependencies for Github.com/matrix org/dendrite:

inspect dependencies for github.com/matrix-org/dendrite

Analyze the terminal output to locate any version of Github.com/matrix org/dendrite in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.9.3), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-863: Incorrect Authorization, where the product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. In Github.com/matrix org/dendrite, 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 The power level parsing within gomatrixserverlib was failing to parse the `"events_default"` key of the `m.room.power_levels` event, defaulting the event default power level to zero in all cases. In rooms where the `"events_default"` power level had been changed, this could result in events either being incorrectly authorised or rejected by Dendrite servers. ### Patches gomatrixserverlib contains a fix as of commit `723fd49` and Dendrite 0.9.3 has been updated accordingly. ### Workarounds Matrix rooms where the `"events_default"` power level has not been changed from the default of zero are not vulnerable. ### For more information If you have any questions or comments about this advisory, e-mail us at [security@matrix.org](mailto:security@matrix.org).

CVE-2022-36009 Affected Github.com/matrix org/dendrite Versions

2 component(s)
Fixed Versions:
0.9.30.0.0-20220815091947-723fd495dde8
Product / Package Ecosystem Affected Versions Fixed Version
github.com/matrix-org/dendrite
Go
< 0.9.3
0.9.3
github.com/matrix-org/gomatrixserverlib
Go
< 0.0.0-20220815091947-723fd495dde8
0.0.0-20220815091947-723fd495dde8

References

Frequently Asked Questions

What is CVE-2022-36009?
CVE-2022-36009 is a security vulnerability in Github.com/matrix org/dendrite involving gomatrixserverlib and Dendrite vulnerable to incorrect parsing of the event default power level in event auth under CWE-863: Incorrect Authorization.
Which Github.com/matrix org/dendrite versions are affected?
Affected versions include releases prior to 0.9.3, 0.0.0-20220815091947-723fd495dde8 across affected packages: github.com/matrix-org/dendrite, github.com/matrix-org/gomatrixserverlib.
What version fixes CVE-2022-36009?
Upgrading to 0.9.3, 0.0.0-20220815091947-723fd495dde8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/matrix-org/dendrite affected?
Yes, github.com/matrix-org/dendrite is affected in releases prior to 0.9.3. Upgrade your dependency to 0.9.3 or later.
Is github.com/matrix-org/gomatrixserverlib affected?
Yes, github.com/matrix-org/gomatrixserverlib is affected in releases prior to 0.0.0-20220815091947-723fd495dde8. Upgrade your dependency to 0.0.0-20220815091947-723fd495dde8 or later.
What is the CVSS score of CVE-2022-36009?
CVE-2022-36009 has a CVSS v3.1 base score of 5.0 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2022-36009?
CVE-2022-36009 is classified under CWE-863: Incorrect Authorization (The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check.).
How can I check Go dependencies for CVE-2022-36009?
Run the dependency tree command: 'inspect dependencies for github.com/matrix-org/dendrite'. 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-grvv-h2f9-7v9c",
  "modified" : "2022-08-30T19:54:34Z",
  "published" : "2022-08-30T19:54:34Z",
  "aliases" : [ "CVE-2022-36009" ],
  "summary" : "gomatrixserverlib and Dendrite vulnerable to incorrect parsing of the event default power level in event auth",
  "details" : "### Impact\n\nThe power level parsing within gomatrixserverlib was failing to parse the `\"events_default\"` key of the `m.room.power_levels` event, defaulting the event default power level to zero in all cases.\n\nIn rooms where the `\"events_default\"` power level had been changed, this could result in events either being incorrectly authorised or rejected by Dendrite servers.\n\n### Patches\n\ngomatrixserverlib contains a fix as of commit `723fd49` and Dendrite 0.9.3 has been updated accordingly.\n\n### Workarounds\n\nMatrix rooms where the `\"events_default\"` power level has not been changed from the default of zero are not vulnerable.\n\n### For more information\n\nIf you have any questions or comments about this advisory, e-mail us at [security@matrix.org](mailto:security@matrix.org).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/matrix-org/dendrite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.9.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/matrix-org/gomatrixserverlib"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20220815091947-723fd495dde8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/gomatrixserverlib/security/advisories/GHSA-grvv-h2f9-7v9c"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-36009"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/gomatrixserverlib/commit/723fd495dde835d078b9f2074b6b62c06dea4575"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/matrix-org/gomatrixserverlib"
  }, {
    "type" : "WEB",
    "url" : "https://matrix.org/docs/guides/moderation/#power-levels"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2022-0952"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-863" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-08-30T19:54:34Z",
    "nvd_published_at" : "2022-08-19T21:15:00Z"
  }
}