Skip to main content

CVE-2024-5062: Zenml Zenml Reflected XSS Vulnerability

CVE-2024-5062 is a reflected XSS flaw in Zenml Zenml that enables attackers to execute arbitrary JavaScript via unvalidated survey redirect parameters. This post covers technical details, affected versions, and mitigation steps.

Updated:

CVE-2024-5062 Overview

CVE-2024-5062 is a reflected Cross-Site Scripting (XSS) vulnerability in zenml-io/zenml version 0.57.1. The flaw exists in the survey redirect handler, which fails to neutralize user-controlled input in the redirect parameter during web page generation. An attacker can craft a malicious URL that executes arbitrary JavaScript in the victim's browser session after the survey completes. Successful exploitation enables cookie theft and can lead to account takeover of the ZenML user. The issue is tracked under CWE-79 and requires user interaction to trigger.

Critical Impact

Attackers can execute arbitrary JavaScript in an authenticated ZenML user's session, steal session cookies, and hijack accounts by luring the user to a crafted survey redirect URL.

Affected Products

  • ZenML (zenml-io/zenml) version 0.57.1
  • ZenML server survey redirect endpoint
  • Deployments upgraded from earlier releases without patching to 0.58.0

Discovery Timeline

  • 2024-06-30 - CVE-2024-5062 published to NVD
  • 2026-06-17 - Last updated in NVD database
  • Vendor patch reference - Commit 21edd863 prepared release 0.58.0
  • Public report - Disclosed through the Huntr Bounty Report

Technical Details for CVE-2024-5062

Vulnerability Analysis

ZenML's survey completion flow accepts a redirect query parameter that determines where the user is sent after submitting the form. The application reflects this parameter into the response without proper output encoding or URL scheme validation. An attacker can supply a javascript: URI or inject HTML/JS payloads that the browser renders in the ZenML origin context. Because the payload executes within the authenticated user's session, it can read document.cookie, exfiltrate session tokens, and issue authenticated API calls against the ZenML backend. Exploitation requires the victim to click a crafted link, which is trivial to deliver through phishing, chat, or malicious documentation.

Root Cause

The root cause is improper neutralization of input during web page generation (CWE-79). The survey redirect handler treats the redirect parameter as trusted and neither validates the URL scheme against an allowlist (for example, restricting to https:// and internal paths) nor HTML-encodes the value before reflection.

Attack Vector

The attack is network-based and requires user interaction. An attacker crafts a URL pointing at a vulnerable ZenML instance that embeds a malicious payload in the redirect parameter. When an authenticated user visits the link and completes the survey step, the injected script runs in the ZenML origin and can steal cookies or perform actions on behalf of the user.

text
// Vendor fix reference — release bump to patched version 0.58.0
// pyproject.toml
 [tool.poetry]
 name = "zenml"
-version = "0.57.1"
+version = "0.58.0"

// src/zenml/VERSION
-0.57.1
+0.58.0

Source: zenml-io/zenml commit 21edd863

Detection Methods for CVE-2024-5062

Indicators of Compromise

  • Web server or reverse-proxy logs containing requests to the survey endpoint with redirect parameter values that include javascript:, <script, onerror=, onload=, or URL-encoded variants such as %3Cscript%3E.
  • Outbound requests from user browsers to attacker-controlled domains immediately following a survey redirect click.
  • ZenML session cookies observed in referrer headers or query strings to external hosts.
  • Reports from users of unexpected page behavior, popups, or redirects after completing an in-app survey.

Detection Strategies

  • Deploy WAF or reverse-proxy rules that inspect the redirect query parameter on ZenML endpoints and block payloads containing script tags, event handlers, or non-http(s) schemes.
  • Correlate ZenML access logs with browser DOM error telemetry to identify reflected payloads that reach clients.
  • Hunt across historical proxy logs for URLs targeting ZenML hosts that carry suspiciously long or encoded redirect values.

Monitoring Recommendations

  • Enable verbose HTTP request logging on ZenML deployments and forward logs to a centralized analytics platform for retention and search.
  • Alert on anomalous outbound traffic from workstations to newly registered domains shortly after ZenML activity.
  • Monitor authentication logs for session reuse from unexpected IP addresses, which may indicate stolen cookies.

How to Mitigate CVE-2024-5062

Immediate Actions Required

  • Upgrade ZenML to version 0.58.0 or later, which contains the fix referenced in commit 21edd863.
  • Invalidate active ZenML sessions and rotate API tokens after upgrading to remove any cookies potentially harvested through exploitation.
  • Communicate to users to avoid clicking untrusted ZenML links until the upgrade is complete.

Patch Information

The vendor released ZenML 0.58.0 to remediate the issue. The release bump is documented in the GitHub commit update. Additional context on the finding is available in the Huntr Bounty Report.

Workarounds

  • If patching is delayed, restrict access to the ZenML server to trusted networks or authenticated VPN users to reduce the phishing attack surface.
  • Deploy a WAF rule that rejects requests to the survey endpoint when the redirect parameter contains characters outside a strict URL allowlist.
  • Enforce a strict Content Security Policy (CSP) on the ZenML origin to block inline script execution and limit script sources.
  • Set the HttpOnly and Secure flags on session cookies to reduce the impact of script-based cookie theft.
bash
# Upgrade ZenML to the patched release
pip install --upgrade "zenml>=0.58.0"

# Verify the installed version
python -c "import zenml; print(zenml.__version__)"

# Example NGINX rule to block obvious XSS payloads in the redirect parameter
# Place inside the server block that fronts ZenML
if ($arg_redirect ~* "(<|>|script|javascript:|onerror=|onload=)") {
    return 400;
}

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.