Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2024-52602

CVE-2024-52602: T2bot Matrix-media-repo SSRF Vulnerability

CVE-2024-52602 is a server-side request forgery flaw in T2bot Matrix-media-repo that enables attackers to access private network resources. This article covers the technical details, affected versions, and mitigation strategies.

Published:

CVE-2024-52602 Overview

Matrix Media Repo (MMR) is a highly configurable multi-homeserver media repository for the Matrix protocol. CVE-2024-52602 is a Server-Side Request Forgery (SSRF) vulnerability [CWE-918] that allows attackers to make MMR serve content from private networks reachable by the server. Under certain conditions, the media repository can be coerced into fetching resources from internal hosts that should not be exposed. The maintainers fixed the issue in MMR v1.3.8. Administrators unable to upgrade can restrict outbound connections using local firewall rules or a transparent proxy.

Critical Impact

Attackers can leverage MMR as a proxy to reach internal network resources, exposing confidential data from services that trust the server's network position.

Affected Products

  • t2bot matrix-media-repo (all versions prior to v1.3.8)
  • Matrix homeserver deployments using MMR as media backend
  • Multi-homeserver Matrix federations relying on MMR

Discovery Timeline

  • 2025-01-16 - CVE-2024-52602 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-52602

Vulnerability Analysis

CVE-2024-52602 is a Server-Side Request Forgery flaw in the media fetching logic of MMR. The server accepts requests to retrieve remote media and issues outbound HTTP requests on behalf of clients. Without sufficient validation of destination hosts, an attacker can direct these requests toward internal IP ranges, loopback addresses, or metadata services accessible only from the server. The response content can then be returned through the media repository, disclosing information from resources behind the network perimeter.

Root Cause

The root cause is insufficient validation of URLs and resolved IP addresses before MMR initiates outbound requests. Preventing SSRF in Go-based services typically requires resolving hostnames, checking each returned IP against denylists of private and reserved ranges, and rejecting redirects that point at internal addresses. See Agwa's blog on preventing SSRF in Go for the technique the fix aligns with.

Attack Vector

An unauthenticated remote attacker can trigger media fetch operations that resolve to internal hosts. Because Matrix federation and media APIs are network-exposed, no privileges or user interaction are required. Successful exploitation yields confidentiality impact by returning internal content through MMR. See the GitHub Security Advisory GHSA-r6jg-jfv6-2fjv for advisory details and the OWASP SSRF reference for background on this class of flaws.

// No verified proof-of-concept code is publicly available.
// The vulnerability enables SSRF via MMR's remote media fetch endpoints.
// Refer to the vendor advisory for technical specifics.

Detection Methods for CVE-2024-52602

Indicators of Compromise

  • Outbound HTTP requests from the MMR process to RFC1918 addresses, 127.0.0.0/8, or cloud metadata endpoints such as 169.254.169.254
  • Unusual media fetch requests referencing hostnames that resolve to internal IPs
  • MMR access logs showing repeated remote media downloads targeting non-standard URIs

Detection Strategies

  • Correlate MMR request logs with egress firewall logs to identify fetches directed at internal ranges
  • Alert on DNS lookups from the MMR host that resolve to private address space during media operations
  • Monitor for anomalous spikes in remote media fetch API calls from a single Matrix identity or IP

Monitoring Recommendations

  • Enable verbose logging of MMR remote media endpoints and forward logs to a centralized analytics platform
  • Instrument the network path with egress filtering and log denied outbound connections from the MMR host
  • Track MMR version strings in asset inventories to detect hosts still running versions prior to v1.3.8

How to Mitigate CVE-2024-52602

Immediate Actions Required

  • Upgrade MMR to v1.3.8 or later using the GitHub release notes for v1.3.8
  • Audit MMR outbound traffic history for prior requests to internal IP ranges or metadata services
  • Restrict the MMR service account's network reachability to the minimum required destinations

Patch Information

The fix is available in MMR v1.3.8. Review the GitHub Security Advisory GHSA-r6jg-jfv6-2fjv for advisory details and the v1.3.8 release notes for upgrade instructions. Additional background on SSRF prevention is available in the Snyk SSRF lesson.

Workarounds

  • Deploy local firewall rules on the MMR host blocking outbound connections to RFC1918, loopback, and link-local ranges
  • Route MMR outbound traffic through a transparent proxy that enforces an allowlist of external destinations
  • Disable or restrict remote media fetching for untrusted homeservers until upgrade is complete
bash
# Example egress restriction using iptables to block MMR access to private ranges
iptables -A OUTPUT -m owner --uid-owner mmr -d 10.0.0.0/8 -j REJECT
iptables -A OUTPUT -m owner --uid-owner mmr -d 172.16.0.0/12 -j REJECT
iptables -A OUTPUT -m owner --uid-owner mmr -d 192.168.0.0/16 -j REJECT
iptables -A OUTPUT -m owner --uid-owner mmr -d 169.254.0.0/16 -j REJECT
iptables -A OUTPUT -m owner --uid-owner mmr -d 127.0.0.0/8 -j REJECT

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.