CVE-2022-31152: Matrix synapse Denial of Service Vulnerability
HIGHCVE-2022-31152 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-703: Improper Check or Handling of Exceptional Conditions) affecting Matrix synapse libraries in the PyPI ecosystem. The issue involves denial of service due to incorrect application of event authorization rules. Remediation is available by upgrading affected packages to version 1.62.0rc1.
CVE-2022-31152 at a Glance
Security Impact
CVSS: 7.5
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:H).
How to Fix CVE-2022-31152
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.62.0rc1
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-31152, 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.62.0rc1), 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-703: Improper Check or Handling of Exceptional Conditions, where the product does not properly anticipate or handle exceptional conditions that rarely occur during normal operation of the product. 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-31152 Affected Matrix synapse Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
matrix-synapse
|
PyPI |
< 1.62.0rc1
|
1.62.0rc1
|
References
Frequently Asked Questions
What is CVE-2022-31152?
Which Matrix synapse versions are affected?
What version fixes CVE-2022-31152?
Is matrix-synapse affected?
What is the CVSS score of CVE-2022-31152?
What CWE is associated with CVE-2022-31152?
How can I check PyPI dependencies for CVE-2022-31152?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-jhjh-776m-4765",
"modified" : "2024-09-30T20:26:48Z",
"published" : "2022-08-31T21:25:37Z",
"aliases" : [ "CVE-2022-31152" ],
"summary" : "Denial of service due to incorrect application of event authorization rules",
"details" : "### Impact\n\nThe Matrix specification specifies a list of [event authorization rules](https://spec.matrix.org/v1.3/rooms/v10/#authorization-rules) which must be checked when determining if an event should be accepted into a room.\n\nIn versions of Synapse up to and including v1.61, some of these rules are not correctly applied. An attacker could craft events which would be accepted by Synapse but not a spec-conformant server, potentially causing divergence in the room state between servers.\n\n### Patches\n\nAdministrators of homeservers with federation enabled are advised to upgrade to v1.62.0 or higher.\n\n### Workarounds\n\n * Federation can be disabled by setting [`federation_domain_whitelist`](https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#federation_domain_whitelist) to an empty list (`[]`).\n\n### References\n\n * https://github.com/matrix-org/synapse/pull/13087\n * https://github.com/matrix-org/synapse/pull/13088\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:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/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.62.0rc1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/matrix-org/synapse/security/advisories/GHSA-jhjh-776m-4765"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31152"
}, {
"type" : "WEB",
"url" : "https://github.com/matrix-org/synapse/pull/13087"
}, {
"type" : "WEB",
"url" : "https://github.com/matrix-org/synapse/pull/13088"
}, {
"type" : "WEB",
"url" : "https://github.com/matrix-org/synapse/commit/d4b1c0d800eaa83c4d56a9cf17881ad362b9194b"
}, {
"type" : "WEB",
"url" : "https://github.com/matrix-org/synapse/commit/e16ea87d0f8c4c30cad36f85488eb1f647e640b0"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/matrix-org/synapse"
}, {
"type" : "WEB",
"url" : "https://github.com/matrix-org/synapse/releases/tag/v1.62.0"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/matrix-synapse/PYSEC-2022-262.yaml"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-703", "CWE-755" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-08-31T21:25:37Z",
"nvd_published_at" : "2022-09-02T20:15:00Z"
}
}