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

CVE-2024-29882: Ossrs Simple Realtime Server XSS Vulnerability

CVE-2024-29882 is a cross-site scripting flaw in Ossrs Simple Realtime Server that allows attackers to inject malicious JavaScript through unfiltered callback parameters. This article covers technical details, affected versions, and mitigation steps.

Published:

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-29882 Overview

CVE-2024-29882 is a reflected Cross-Site Scripting (XSS) vulnerability in Simple Realtime Server (SRS), an open-source real-time video server maintained by ossrs. The flaw resides in the /api/v1/vhosts/vid-<id>?callback=<payload> endpoint, which fails to sanitize the callback query parameter before reflecting it in the HTTP response. An attacker who tricks an authenticated administrator into clicking a crafted link can execute arbitrary JavaScript in the browser session of the victim. The issue is tracked as [CWE-79] and is fixed in SRS versions 5.0.210 and 6.0.121.

Critical Impact

Attackers can hijack administrator sessions, exfiltrate API tokens, and pivot into the SRS management interface by injecting malicious JavaScript through the unfiltered callback parameter.

Affected Products

  • ossrs/simple_realtime_server versions prior to 5.0.210
  • ossrs/simple_realtime_server versions prior to 6.0.121
  • SRS HTTP API endpoint /api/v1/vhosts/vid-<id>

Discovery Timeline

  • 2024-03-28 - CVE-2024-29882 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-29882

Vulnerability Analysis

SRS exposes an HTTP management API that supports JSONP-style callbacks. The /api/v1/vhosts/vid-<id> endpoint accepts a callback query parameter and wraps the JSON response in a function call named after the parameter value. The server does not validate that the callback value is a legitimate JavaScript identifier. An attacker can supply arbitrary characters, including <script> tags or JavaScript expressions, and the server reflects them directly into the response body.

Because the response is returned with a content type the browser will render or execute, the injected payload runs in the context of the SRS web origin. This enables session theft, forced API calls against the SRS control plane, and tampering with streaming configuration.

Root Cause

The root cause is missing input validation on the callback query parameter. JSONP endpoints must restrict callback names to a conservative character set such as [A-Za-z0-9_]. SRS did not enforce this constraint, allowing attacker-controlled content to flow into executable JavaScript context without encoding or filtering.

Attack Vector

Exploitation requires user interaction. An attacker crafts a URL targeting a vulnerable SRS instance with a malicious callback payload and delivers it through phishing, chat, or a cross-origin page. When an authenticated SRS administrator loads the link, the browser executes the attacker's script within the SRS origin.

text
// Patch metadata from the fix commit
// trunk/src/core/srs_core_version5.hpp
#define VERSION_MAJOR       5
#define VERSION_MINOR       0
-#define VERSION_REVISION    209
+#define VERSION_REVISION    210

Source: GitHub Commit 244ce7b

Detection Methods for CVE-2024-29882

Indicators of Compromise

  • HTTP requests to /api/v1/vhosts/vid-* containing non-alphanumeric characters in the callback parameter such as <, >, (, ), or ;.
  • Access log entries where the callback value exceeds typical JavaScript identifier length or contains URL-encoded script fragments like %3Cscript%3E.
  • Outbound requests from administrator browsers to unknown domains shortly after visiting an SRS management URL.

Detection Strategies

  • Deploy a web application firewall rule that inspects the callback parameter against a strict [A-Za-z0-9_]{1,64} allowlist.
  • Correlate SRS API access logs with browser referrer headers to identify administrators clicking externally sourced links.
  • Hunt for SRS process versions reporting a VERSION_REVISION below 210 on the 5.x branch or below 121 on the 6.x branch.

Monitoring Recommendations

  • Enable verbose HTTP access logging on the SRS management interface and ship logs to a centralized analytics pipeline.
  • Alert on any 2xx response from /api/v1/vhosts/ endpoints where the reflected body contains HTML tag characters.
  • Monitor administrator endpoints for anomalous JavaScript execution against the SRS origin using browser telemetry or EDR process events.

How to Mitigate CVE-2024-29882

Immediate Actions Required

  • Upgrade SRS to version 5.0.210 or 6.0.121 or later as a priority.
  • Restrict access to the SRS HTTP API using network ACLs so that only trusted operator hosts can reach /api/v1/.
  • Rotate any administrator session tokens or API credentials that may have been exposed to vulnerable instances.

Patch Information

The fix is delivered in commit 244ce7bc013a0b805274a65132a2980680ba6b9d and documented in GitHub Security Advisory GHSA-gv9r-qcjc-5hj7. The patch bumps VERSION_REVISION to 210 on the 5.x line and adds callback validation. Users on the 6.x branch should install 6.0.121 or later.

Workarounds

  • Block external HTTP requests containing a callback query parameter at the reverse proxy or WAF layer until patching is complete.
  • Disable or firewall the SRS HTTP API if JSONP functionality is not required in production deployments.
  • Require administrators to access the SRS console only from dedicated management workstations that do not browse arbitrary web content.
bash
# Example nginx reverse proxy rule to drop requests with unsafe callback values
location /api/v1/vhosts/ {
    if ($arg_callback ~* "[^A-Za-z0-9_]") {
        return 400;
    }
    proxy_pass http://srs_backend;
}

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

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.