Skip to main content

CVE-2022-31052: CWE-674: Uncontrolled Recursion in matrix-org synapse

Medium
Published: Tue Jun 28 2022 (06/28/2022, 17:10:11 UTC)
Source: CVE
Vendor/Project: matrix-org
Product: synapse

Description

Synapse is an open source home server implementation for the Matrix chat network. In versions prior to 1.61.1 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. Deployments with `url_preview_enabled: false` set in configuration are not affected. Deployments with `url_preview_enabled: true` set in configuration **are** affected. Deployments with no configuration value set for `url_preview_enabled` are not affected, because the default is `false`. Administrators of homeservers with URL previews enabled are advised to upgrade to v1.61.1 or higher. Users unable to upgrade should set `url_preview_enabled` to false.

AI-Powered Analysis

AILast updated: 06/23/2025, 04:05:54 UTC

Technical Analysis

CVE-2022-31052 is a medium-severity vulnerability affecting the Matrix Synapse server, an open-source home server implementation for the Matrix chat network. The issue arises from uncontrolled recursion in the URL preview feature of Synapse versions prior to 1.61.1. Specifically, when URL previews are enabled (via the configuration setting `url_preview_enabled: true`), certain web pages can trigger unbounded recursive calls during the preview generation process. This recursion can exhaust the available stack space of the Synapse process, leading to either an error for the specific request or, in more severe cases, a complete crash of the Synapse server process. The vulnerability is exploitable by malicious users authenticated on the homeserver or by remote users who send URLs that a local user's client automatically requests a preview for. However, remote exploitation is limited because the URL preview endpoint requires authentication, preventing unauthenticated remote attackers from directly triggering the vulnerability. Deployments with the URL preview feature disabled (`url_preview_enabled: false`) or those using the default configuration (which disables URL previews) are not affected. The recommended remediation is to upgrade Synapse to version 1.61.1 or later, where the recursion issue has been addressed. For administrators unable to upgrade promptly, disabling URL previews is advised to mitigate the risk. No known exploits have been reported in the wild, but the vulnerability presents a risk of denial-of-service through server crashes or degraded service availability.

Potential Impact

For European organizations using Matrix Synapse servers with URL previews enabled, this vulnerability poses a risk primarily to service availability. An attacker with access to the homeserver or a user capable of sending URLs that trigger previews can cause the Synapse process to crash, resulting in denial-of-service conditions. This can disrupt internal communications, especially in organizations relying on Matrix for real-time collaboration and messaging. The impact on confidentiality and integrity is minimal, as the vulnerability does not allow unauthorized data access or modification. However, the availability impact can be significant if exploited repeatedly or during critical operational periods. Organizations with large user bases or those integrating Matrix Synapse into critical communication infrastructure may experience operational disruptions. Additionally, since the vulnerability requires authentication for exploitation, insider threats or compromised user accounts increase the risk. The absence of known exploits in the wild reduces immediate risk but does not eliminate the potential for future attacks. The vulnerability's impact is more pronounced in environments where URL previews are enabled by default or widely used, making it important for European organizations to assess their configuration and upgrade status.

Mitigation Recommendations

1. Upgrade Synapse to version 1.61.1 or later as soon as possible to apply the official fix addressing uncontrolled recursion in URL previews. 2. If immediate upgrade is not feasible, disable the URL preview feature by setting `url_preview_enabled: false` in the Synapse configuration to prevent the vulnerable code path from being executed. 3. Restrict access to the Synapse homeserver to trusted users and enforce strong authentication to reduce the risk of malicious authenticated users exploiting the vulnerability. 4. Monitor server logs for repeated errors or crashes related to URL previews, which may indicate attempted exploitation. 5. Implement rate limiting or filtering on URLs submitted for preview generation to detect and block potentially malicious or recursive URL patterns. 6. Educate users about the risks of clicking or sharing suspicious URLs within the Matrix environment, especially if URL previews are enabled. 7. Regularly audit and update Synapse deployments to ensure they run supported and patched versions, minimizing exposure to known vulnerabilities.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2022-05-18T00:00:00.000Z
Cisa Enriched
true

Threat ID: 682d9844c4522896dcbf35ad

Added to database: 5/21/2025, 9:09:24 AM

Last enriched: 6/23/2025, 4:05:54 AM

Last updated: 8/7/2025, 6:42:42 PM

Views: 14

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats