GHSA-22p3-qrh9-cx32 CVE-2022-31052 PYSEC-2022-224
URL previews of unusual or maliciously-crafted pages can crash Synapse media repositories or Synapse monoliths
- Severity
- 0.0 / 10
- Medium · CVSS 4.0
- Exploit chance (EPSS)
- 1.66%
- Chance of exploitation in the next 30 days. Higher than 76.66% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-674 Uncontrolled Recursion
- Fix
1.61.1- Upgrade matrix-synapse to this version or later
Description
Impact
URL previews of some web pages can exhaust the available stack space for the Synapse process due to unbounded recursion. This is sometimes recoverable and leads to an error for the request causing the problem, but in other cases the Synapse process may crash altogether.
It 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. Remote users are not able to exploit this directly, because the URL preview endpoint is authenticated.
Am I affected?
- deployments with
url_preview_enabled: falseset in configuration are not affected. - deployments with
url_preview_enabled: trueset in configuration are affected. - deployments with no configuration value set for
url_preview_enabledare not affected, because the default isfalse.
Patches
Administrators of homeservers with URL previews enabled are advised to upgrade to v1.61.1 or higher.
Workarounds
- URL previews can be disabled in the configuration file by setting
url_preview_enabled: false. - 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.
For more information
If you have any questions or comments about this advisory, e-mail us at security@matrix.org.
Affected versions
PyPI
| Package | Vulnerable | Fixed in |
|---|---|---|
| matrix-synapse | < 1.61.1 |
1.61.1 |
| matrix-synapse | < 1.61.1 |
1.61.1 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
matrix-synapse PyPI → 1.61.1
- pip
pip install --upgrade "matrix-synapse>=1.61.1"- poetry
poetry add "matrix-synapse>=1.61.1"- uv
uv add "matrix-synapse>=1.61.1"
Severity breakdown
CVSS 4.0 0.0
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
- Attack vector
- Network
- Attack complexity
- Low
- Attack requirements
- None
- Privileges required
- Low
- User interaction
- None
- Confidentiality (vulnerable system)
- None
- Integrity (vulnerable system)
- None
- Availability (vulnerable system)
- High
- Confidentiality (subsequent systems)
- None
- Integrity (subsequent systems)
- None
- Availability (subsequent systems)
- None
CVSS 3.1 6.5
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- Low
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- None
- Integrity
- None
- Availability
- High
Weakness
CWE-674: Uncontrolled Recursion
The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack.
How to prevent it
- Implementation: Ensure that an end condition will be reached under all logic conditions. The end condition may include checking against the depth of recursion and exiting with an error if the recursion goes too deep. The complexity of the end condition contributes to the effectiveness of this action.
- Implementation: Increase the stack size.
References
Advisories
Packages
Other links
- github.com/matrix-org/synapse/security/advisories/GHSA-22p3-qrh9-cx32
- github.com/matrix-org/synapse/commit/fa1308061802ac7b7d20e954ba7372c5ac292333
- github.com/pypa/advisory-database/tree/main/vulns/matrix-synapse/PYSEC-2022-224…
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/7EARK…
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QGSDQ…
- spec.matrix.org/v1.2/client-server-api
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QGSDQ…
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/7EARK…
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-6qf2-7x63-mm6v Synapse pagination Denial of Service | Low | Also affects matrix-synapse |
| GHSA-8q93-326v-3m7g Synapse CPU starvation (Denial of Service) | Medium | Also affects matrix-synapse |
| GHSA-fh66-fcv5-jjfr Synapse's invalid device keys degrade federation functionality | Medium | Also affects matrix-synapse |
| GHSA-v56r-hwv5-mxg6 Synapse vulnerable to federation denial of service via malformed events | High | Also affects matrix-synapse |
| GHSA-56w4-5538-8v8h Synapse Matrix has a partial room state leak via Sliding Sync | Medium | Also affects matrix-synapse |
| GHSA-vp6v-whfm-rv3g Synapse can be forced to thumbnail unexpected file formats, invoking external, potentially untrustworthy decoders | Critical | Also affects matrix-synapse |
| GHSA-f3r3-h2mq-hx2h Synapse allows a a malformed invite to break the invitee's `/sync` | Medium | Also affects matrix-synapse |
| GHSA-rfq8-j7rh-8hf2 Synapse allows unsupported content types to lead to memory exhaustion | High | Also affects matrix-synapse |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor