CVE-2024-51750
Executive Summary
CVE-2024-51750 is a denial-of-service (DoS) vulnerability affecting Element Web and Desktop, the official Matrix web and desktop clients built using the Matrix React SDK. A malicious homeserver can send specially crafted invalid messages over the Matrix federation protocol, causing the client to fail to render either a single message or the entire room containing the malicious message. This effectively denies the user access to communication within that room. The vulnerability has been patched in version 1.11.85. The CVSS score is 5.0 (Medium), and the EPSS probability is 0.0%, indicating low exploitation likelihood in the wild. No public proof-of-concept code or exploit templates are available at this time.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability is not directly related to a package manager (NPM, PyPI, Go, Ruby) but affects the Element client application. The fix is delivered through standard application updates.
CVSS Breakdown & Threat Level
- CVSS Score: 5.0 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L
- Attack Vector (AV): Network – the malicious homeserver sends data over the network.
- Attack Complexity (AC): Low – no special conditions required.
- Privileges Required (PR): None – the attacker only needs to control a federated homeserver.
- User Interaction (UI): Required – the victim must be using Element to view the malicious message.
- Scope (S): Unchanged – the vulnerability affects the client only.
- Confidentiality (C): None – no data exposure.
- Integrity (I): None – no data modification.
- Availability (A): Low – partial denial of service (message or room rendering failure).
Threat Level: Medium. The attack requires the victim to be in a room with a malicious homeserver, but the impact is limited to denial of service within the client.
Deep Dive & Mechanics
The vulnerability lies in how Element Web and Desktop parse and render Matrix events received over federation. The Matrix protocol allows homeservers to send events (messages, state changes, etc.) to other homeservers, which then forward them to connected clients. A malicious homeserver can craft an event that, when processed by the client's React SDK, causes an unhandled exception or infinite loop during rendering.
Specifically, the issue is in the message rendering pipeline. The client expects certain fields in the event content to be of a specific type (e.g., strings, objects). By sending an event with a malformed body or formatted_body field (e.g., a number instead of a string, or a deeply nested object), the client's React components fail to render the message. This can result in:
- Single message failure: The malicious message is not displayed, but the rest of the room works.
- Room-wide failure: The entire room fails to load, showing a blank or error state.
The root cause is insufficient input validation in the Matrix React SDK's message rendering components. The SDK does not properly sanitize or validate the structure of event content before passing it to React's rendering engine.
Vulnerable vs. Patched Code
The fix in version 1.11.85 involves adding input validation and error handling in the message rendering components. Below is a conceptual comparison.
Vulnerable Code (Conceptual):
// In some message rendering component
function MessageBody({ content }) {
// Directly uses content.body without validation
return <div>{content.body}</div>;
}
Patched Code (Conceptual):
function MessageBody({ content }) {
// Validate that body is a string
if (typeof content.body !== 'string') {
return <div>[Invalid message]</div>;
}
return <div>{content.body}</div>;
}
The actual patch likely involves more comprehensive checks across multiple components that handle different event types (messages, reactions, edits, etc.).
Exploitation & Lab Setup
Red Team (Attacker)
Prerequisites:
- Control of a Matrix homeserver (e.g., Synapse) that is federated with the victim's homeserver.
- The victim must be a member of a room that includes the attacker's homeserver.
Exploitation Steps:
- Setup: Deploy a malicious Matrix homeserver (e.g., using Synapse with custom modifications).
- Craft Malicious Event: Create a Matrix event with a malformed
contentfield. For example, send am.room.messageevent wherecontent.bodyis an integer instead of a string.{ "type": "m.room.message", "sender": "@attacker:malicious.server", "content": { "msgtype": "m.text", "body": 12345 } } - Send Event: Use the Matrix federation API (e.g.,
PUT /_matrix/federation/v1/send/{txnId}) to send the crafted event to the victim's homeserver. - Trigger: The victim's Element client will receive the event and attempt to render it, causing the denial of service.
Note: No public exploit code is available. The above is a conceptual approach.
Blue Team (Defender)
Detection:
- Monitor for unusual Matrix federation events with unexpected data types in
contentfields. - Look for client-side errors in Element logs (e.g., JavaScript exceptions related to rendering).
- Use the detection rules provided below.
Mitigation:
- Update Element Web and Desktop to version 1.11.85 or later.
- Implement network-level filtering to block malformed federation requests (if possible).
- Educate users to report rooms that fail to load.
Indicators of Compromise (IOCs)
- Network:
- Matrix federation requests containing events with non-string
bodyfields. - Events with deeply nested or circular
contentobjects.
- Matrix federation requests containing events with non-string
- Client:
- JavaScript errors in the browser console related to
TypeError,Cannot read properties of undefined, or similar. - Rooms that fail to load or show a blank screen.
- JavaScript errors in the browser console related to
- Logs:
- Element client logs showing
Uncaught ErrororReact rendering errorwhen processing a specific event.
- Element client logs showing
Detection Engineering
YARA Rule
rule CVE_2024_51750_Matrix_Event_Malformed {
meta:
description = "Detects malformed Matrix events that may trigger CVE-2024-51750"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2024-51750"
strings:
$json_body = /"body"\s*:\s*\d+/ nocase
$json_formatted_body = /"formatted_body"\s*:\s*\d+/ nocase
$json_body_null = /"body"\s*:\s*null/ nocase
$json_body_array = /"body"\s*:\s*\[/ nocase
condition:
any of them
}
Sigma Rule
title: CVE-2024-51750 - Malicious Matrix Federation Event
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects Matrix federation events with malformed content fields that may cause denial of service in Element clients.
author: Valters IT
date: 2024-01-01
logsource:
category: application
product: matrix
detection:
selection:
event_type: "m.room.message"
content.body|type: "integer"
content.formatted_body|type: "integer"
condition: selection
falsepositives:
- Legitimate events with numeric body (unlikely)
level: medium
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-51750 - Malicious Matrix Federation Event"; flow:to_server; content:"/_matrix/federation/"; http_uri; content:"\"body\""; http_server_body; pcre:"/\"body\"\s*:\s*\d+/"; classtype:attempted-dos; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate:
- Update Element Web and Desktop to version 1.11.85 or later.
- If immediate update is not possible, restrict federation with untrusted homeservers.
Long-term:
- Implement input validation in the Matrix React SDK for all event content fields.
- Add error boundaries in React components to gracefully handle malformed data.
- Monitor for similar vulnerabilities in other Matrix clients.
Valters IT Signature:
This report was prepared by Valters IT, an elite DevSecOps and Cyber Threat Intelligence team.
For questions or further analysis, contact: security@valters-it.com