CVE-2025-61672 Overview
CVE-2025-61672 affects Synapse, the reference open source Matrix homeserver implementation maintained by Element. The vulnerability stems from missing validation of device keys submitted through the /keys/upload endpoint. An authenticated attacker registered on the victim homeserver can submit malformed device key payloads that degrade federation functionality. The result unpredictably breaks outbound federation to other homeservers, disrupting encrypted messaging and cross-server communication. The issue is tracked under CWE-1287: Improper Validation of Specified Type of Input.
Critical Impact
A low-privileged authenticated user on a Synapse homeserver can corrupt outbound federation, disrupting encrypted communication with other Matrix servers across the federation.
Affected Products
- Synapse versions prior to 1.138.3
- Synapse 1.139.0
- Element Matrix homeserver deployments running vulnerable Synapse builds
Discovery Timeline
- 2025-10-08 - CVE-2025-61672 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2025-61672
Vulnerability Analysis
Synapse implements the Matrix protocol's end-to-end encryption by tracking device keys per user. Clients upload these keys through the /keys/upload client-server API endpoint, which is handled by synapse/handlers/e2e_keys.py. Before the fix, Synapse accepted request bodies without enforcing structural validation on the submitted key material.
An authenticated attacker with a local account can upload malformed device key entries. Synapse persists these entries and later attempts to relay them across federation. Remote homeservers reject or mishandle the invalid data, causing federation requests to fail. Because Synapse retries and queues federation traffic per destination, invalid key state produces cascading failures affecting message delivery and device list synchronization.
Root Cause
The root cause is missing input validation on the request body of /keys/upload (CWE-1287). Synapse did not verify that device key objects conformed to expected Matrix specification structures before storing them. Downstream federation code assumed well-formed key data, so malformed values propagated into outbound federation traffic without sanitization.
Attack Vector
Exploitation requires only a registered account on the target homeserver. The attacker sends a crafted HTTP request to /keys/upload containing device key fields that violate the Matrix specification. No user interaction is required, and the attack can be automated with any Matrix client library. Impact is limited to integrity and availability of federation; confidentiality is not directly compromised.
# Patch summary from synapse/handlers/e2e_keys.py (#17097)
# The fix adds validation of the request body submitted to /keys/upload
# before device keys are persisted and later shared over federation.
logger = logging.getLogger(__name__)
ONE_TIME_KEY_UPLOAD = "one_time_key_upload_lock"
Source: Synapse commit 26aaaf9e and commit 7069636c. Full technical context is in GitHub Pull Request #17097.
Detection Methods for CVE-2025-61672
Indicators of Compromise
- Repeated HTTP POST requests to /_matrix/client/r0/keys/upload or /_matrix/client/v3/keys/upload from a single account with abnormal payload structures.
- Increased outbound federation errors in Synapse logs, particularly related to device list updates or EDU delivery to remote homeservers.
- Growth of queued federation transactions per destination without corresponding legitimate activity.
Detection Strategies
- Parse Synapse application logs for validation errors, JSON schema mismatches, or repeated federation transaction failures tied to specific local users.
- Correlate /keys/upload request volume with the number of unique device IDs per user; abnormal ratios can indicate abuse.
- Alert on federation sender queue backpressure metrics exposed through Synapse's Prometheus endpoint.
Monitoring Recommendations
- Enable structured logging on the homeserver and forward logs to a centralized analytics platform for correlation across accounts and destinations.
- Track synapse_federation_client_sent_transactions and error counters to identify degradation across remote destinations.
- Review new user registrations and rate-limit account creation to reduce the attack surface for authenticated abuse.
How to Mitigate CVE-2025-61672
Immediate Actions Required
- Upgrade Synapse to version 1.138.4 or 1.139.2. The maintainers advise skipping 1.138.3 and 1.139.1 because those releases introduced an unrelated regression.
- Audit user accounts and disable or remove accounts exhibiting anomalous /keys/upload behavior.
- Restrict open registration on public homeservers until the upgrade is deployed.
Patch Information
The fix is delivered in Synapse v1.138.3, v1.138.4, v1.139.1, and v1.139.2. Details are documented in GitHub Security Advisory GHSA-fh66-fcv5-jjfr. Administrators should apply 1.138.4 or 1.139.2 to avoid the regression present in 1.138.3 and 1.139.1.
Workarounds
- Disable open registration in homeserver.yaml by setting enable_registration: false until patched.
- Enforce registration tokens or CAPTCHA to prevent automated account creation used for abuse.
- Deploy a reverse proxy rule to rate-limit requests to /_matrix/client/*/keys/upload per authenticated user.
# homeserver.yaml hardening example
enable_registration: false
registration_requires_token: true
rc_registration:
per_second: 0.05
burst_count: 3
# Verify the running Synapse version after upgrading
python -m synapse.app.homeserver --version
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

