CVE-2022-31052: Matrix synapse URL Previews Of Unusual Or Vulnerability
HIGHCVE-2022-31052 is a HIGH (CVSS 6.5) url previews of unusual or vulnerability (CWE-674: Uncontrolled Recursion) affecting Matrix synapse libraries in the PyPI ecosystem. The issue involves url previews of unusual or maliciously-crafted pages can crash synapse media repositories or synapse monoliths. Remediation is available by upgrading affected packages to version 1.61.1.
CVE-2022-31052 at a Glance
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:N/I:N/A:H).
How to Fix CVE-2022-31052
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.
pip install matrix-synapse>=1.61.1
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-31052, 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.61.1), 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-674: Uncontrolled Recursion, where the product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack. 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
CVE-2022-31052 Affected Matrix synapse Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
matrix-synapse
|
PyPI |
< 1.61.1
|
1.61.1
|
References
Frequently Asked Questions
What is CVE-2022-31052?
Which Matrix synapse versions are affected?
What version fixes CVE-2022-31052?
Is matrix-synapse affected?
What is the CVSS score of CVE-2022-31052?
What CWE is associated with CVE-2022-31052?
How can I check PyPI dependencies for CVE-2022-31052?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-22p3-qrh9-cx32",
"modified" : "2024-09-30T20:29:11Z",
"published" : "2022-06-29T21:51:23Z",
"aliases" : [ "CVE-2022-31052" ],
"summary" : "URL previews of unusual or maliciously-crafted pages can crash Synapse media repositories or Synapse monoliths",
"details" : "### Impact\n\nURL previews of some web pages can exhaust the available stack space for the Synapse process due to unbounded recursion.\nThis is sometimes recoverable and leads to an error for the request causing the problem, but in other cases the Synapse process may crash altogether.\n\nIt is possible to exploit this maliciously, either by malicious users on the homeserver, or by remote users sending URLs that a local user's client may automatically request a URL preview for.\nRemote users are not able to exploit this directly, because [the URL preview endpoint is authenticated](https://spec.matrix.org/v1.2/client-server-api/#get_matrixmediav3preview_url).\n\n### Am I affected?\n\n* deployments with `url_preview_enabled: false` set in configuration are not affected.\n* deployments with `url_preview_enabled: true` set in configuration **are** affected.\n* deployments with no configuration value set for `url_preview_enabled` are not affected, because the default is `false`.\n\n### Patches\n\nAdministrators of homeservers with URL previews enabled are advised to upgrade to v1.61.1 or higher.\n\n### Workarounds\n\n* URL previews can be disabled in the configuration file by setting `url_preview_enabled: false`.\n* Deployments using workers can choose to offload URL previews to one or more dedicated worker(s), ensuring that a process crash does not disrupt other functionality of Synapse.\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).\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "matrix-synapse"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.61.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/matrix-org/synapse/security/advisories/GHSA-22p3-qrh9-cx32"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31052"
}, {
"type" : "WEB",
"url" : "https://github.com/matrix-org/synapse/commit/fa1308061802ac7b7d20e954ba7372c5ac292333"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/matrix-org/synapse"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/matrix-synapse/PYSEC-2022-224.yaml"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/7EARKKJZ2W7WUITFDT4EG4NVATFYJQHF"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QGSDQ4YAITCUACAB7SXQZDJIU3IQ4CJD"
}, {
"type" : "WEB",
"url" : "https://spec.matrix.org/v1.2/client-server-api/#get_matrixmediav3preview_url"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-674" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-06-29T21:51:23Z",
"nvd_published_at" : "2022-06-28T17:15:00Z"
}
}