CVE-2022-41952: Matrix synapse Remote Code Execution Vulnerability

MODERATE
Advisory Identifier: GHSA-4822-jvwx-w47h
CVSS 5.3
CWE-400 CWE-772
Published
Advisory Summary

CVE-2022-41952 is a MODERATE (CVSS 5.3) remote code execution vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Matrix synapse libraries in the PyPI ecosystem. The issue involves uncontrolled resource consumption in matrix synapse. Remediation is available by upgrading affected packages to version 1.53.0.

CVE-2022-41952 at a Glance

CVE Identifier CVE-2022-41952
GHSA Identifier GHSA-4822-jvwx-w47h
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Matrix synapse
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.3

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

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

How to Fix CVE-2022-41952

To remediate this vulnerability, upgrade all affected Matrix synapse 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-synapse fixed: 1.53.0
pip install matrix-synapse>=1.53.0
Verify Direct and Transitive Dependencies

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

pip show matrix-synapse

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2022-41952, inspect your installed packages using pip:

pip show matrix-synapse

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

Note: The pip show matrix-synapse command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Matrix synapse, 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 Synapse before 1.52.0 with URL preview functionality enabled will attempt to generate URL previews for media stream URLs without properly limiting connection time. Connections will only be terminated after `max_spider_size` (default: 10M) bytes have been downloaded, which can in some cases lead to long-lived connections towards the streaming media server (for instance, Icecast). This can cause excessive traffic and connections toward such servers if their stream URL is, for example, posted to a large room with many Synapse instances with URL preview enabled. ### Patches 1.52.0 implements a timeout mechanism which will terminate URL preview connections after 30 seconds. Since generating URL previews for media streams is not supported and always fails, 1.53.0 additionally implements an allow list for content types for which Synapse will even attempt to generate a URL preview. We recommend upgrading to 1.53.0 to fully resolve the issue. ### Workarounds Turn off URL preview functionality by setting `url_preview_enabled: false` in the Synapse configuration file. ### References - Patch (timeout): https://github.com/matrix-org/synapse/pull/11784 - Patch (content type allow list): https://github.com/matrix-org/synapse/pull/11936 ### For more information If you have any questions or comments about this advisory, e-mail us at security@matrix.org.

CVE-2022-41952 Affected Matrix synapse Versions

1 component(s)
Fixed Versions:
1.53.0
Product / Package Ecosystem Affected Versions Fixed Version
matrix-synapse
PyPI
< 1.53.0
1.53.0

References

Frequently Asked Questions

What is CVE-2022-41952?
CVE-2022-41952 is a security vulnerability in Matrix synapse involving Uncontrolled Resource Consumption in Matrix Synapse under CWE-400: Uncontrolled Resource Consumption.
Which Matrix synapse versions are affected?
Affected versions include releases prior to 1.53.0 across affected packages: matrix-synapse.
What version fixes CVE-2022-41952?
Upgrading to 1.53.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is matrix-synapse affected?
Yes, matrix-synapse is affected in releases prior to 1.53.0. Upgrade your dependency to 1.53.0 or later.
What is the CVSS score of CVE-2022-41952?
CVE-2022-41952 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2022-41952?
CVE-2022-41952 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check PyPI dependencies for CVE-2022-41952?
Run the dependency tree command: 'pip show matrix-synapse'. 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-4822-jvwx-w47h",
  "modified" : "2022-11-28T16:18:30Z",
  "published" : "2022-04-01T18:16:42Z",
  "aliases" : [ "CVE-2022-41952" ],
  "summary" : "Uncontrolled Resource Consumption in Matrix Synapse",
  "details" : "### Impact\n\nSynapse before 1.52.0 with URL preview functionality enabled will attempt to generate URL previews for media stream URLs without properly limiting connection time. Connections will only be terminated after `max_spider_size` (default: 10M) bytes have been downloaded, which can in some cases lead to long-lived connections towards the streaming media server (for instance, Icecast).\n\nThis can cause excessive traffic and connections toward such servers if their stream URL is, for example, posted to a large room with many Synapse instances with URL preview enabled.\n\n### Patches\n1.52.0 implements a timeout mechanism which will terminate URL preview connections after 30 seconds. Since generating URL previews for media streams is not supported and always fails, 1.53.0 additionally implements an allow list for content types for which Synapse will even attempt to generate a URL preview.\n\nWe recommend upgrading to 1.53.0 to fully resolve the issue.\n\n### Workarounds\nTurn off URL preview functionality by setting `url_preview_enabled: false` in the Synapse configuration file.\n\n### References\n- Patch (timeout): https://github.com/matrix-org/synapse/pull/11784\n- Patch (content type allow list): https://github.com/matrix-org/synapse/pull/11936\n\n### For more information\nIf you have any questions or comments about this advisory, e-mail us at security@matrix.org.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "matrix-synapse"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.53.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/synapse/security/advisories/GHSA-4822-jvwx-w47h"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-41952"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/synapse/pull/11784"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/synapse/pull/11936"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/matrix-org/synapse"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/synapse/releases/tag/v1.52.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/synapse/releases/tag/v1.53.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-772" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-04-01T18:16:42Z",
    "nvd_published_at" : "2022-11-22T16:15:00Z"
  }
}