CVE-2024-31462: stable-diffusion-webui: path traversal file write
MEDIUMAny authenticated low-privilege user of stable-diffusion-webui 1.7.0 on Windows can write arbitrary JSON files anywhere the process account has access — including Windows startup folders, enabling persistence. Patch via commit d9708c92 or restrict the Backup/Restore tab to trusted users only. Internal AI workstations are the primary risk surface; if you run this tool, treat it as patched-or-disabled.
What is the risk?
Practically higher than CVSS 6.3 implies for Windows deployments in shared or multi-user environments. Exploitation is trivial: low privileges, network-accessible, no user interaction. The 'limited JSON-only write' framing understates risk — on Windows, writing to startup folders or overwriting application configs achieves persistence. Risk escalates further if the webui process runs as an admin account, which is common on AI practitioner workstations. Not in KEV, no known active exploitation, but the technique is well-understood and requires no specialized AI knowledge.
How severe is it?
What is the attack surface?
What should I do?
5 steps-
PATCH
Apply commit d9708c92b444894bce8070e4dcfaa093f8eb8d43 or update to a version incorporating this fix.
-
ACCESS CONTROL
Restrict webui to localhost or VPN-only; never expose the Backup/Restore tab to untrusted users.
-
LEAST PRIVILEGE
Run the webui process as a non-admin Windows account with an explicit NTFS deny ACL on startup folders (C:\Users\*\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\) and system config paths.
-
DETECTION
Alert on JSON file creation outside expected webui config directories — monitor for writes to AppData\Roaming, ProgramData, and Windows\System32 from the webui process.
-
INVENTORY
Audit all internal deployments; this tool is frequently installed informally on developer and data scientist workstations.
What does CISA's SSVC say?
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2024-31462?
Any authenticated low-privilege user of stable-diffusion-webui 1.7.0 on Windows can write arbitrary JSON files anywhere the process account has access — including Windows startup folders, enabling persistence. Patch via commit d9708c92 or restrict the Backup/Restore tab to trusted users only. Internal AI workstations are the primary risk surface; if you run this tool, treat it as patched-or-disabled.
Is CVE-2024-31462 actively exploited?
No confirmed active exploitation of CVE-2024-31462 has been reported, but organizations should still patch proactively.
How to fix CVE-2024-31462?
1. PATCH: Apply commit d9708c92b444894bce8070e4dcfaa093f8eb8d43 or update to a version incorporating this fix. 2. ACCESS CONTROL: Restrict webui to localhost or VPN-only; never expose the Backup/Restore tab to untrusted users. 3. LEAST PRIVILEGE: Run the webui process as a non-admin Windows account with an explicit NTFS deny ACL on startup folders (C:\Users\*\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\) and system config paths. 4. DETECTION: Alert on JSON file creation outside expected webui config directories — monitor for writes to AppData\Roaming, ProgramData, and Windows\System32 from the webui process. 5. INVENTORY: Audit all internal deployments; this tool is frequently installed informally on developer and data scientist workstations.
What systems are affected by CVE-2024-31462?
This vulnerability affects the following AI/ML architecture patterns: AI inference UI, image generation workstations, local model serving, shared GPU inference servers.
What is the CVSS score for CVE-2024-31462?
CVE-2024-31462 has a CVSS v3.1 base score of 6.3 (MEDIUM). The EPSS exploitation probability is 0.68%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software AML.T0037 Data from Local System AML.T0049 Exploit Public-Facing Application Compliance Controls Affected
What are the technical details?
Original Advisory
stable-diffusion-webui is a web interface for Stable Diffusion, implemented using Gradio library. Stable-diffusion-webui 1.7.0 is vulnerable to a limited file write affecting Windows systems. The create_ui method (Backup/Restore tab) in modules/ui_extensions.py takes user input into the config_save_name variable on line 653. This user input is later used in the save_config_state method and used to create a file path on line 65, which is afterwards opened for writing on line 67, which leads to a limited file write exploitable on Windows systems. This issue may lead to limited file write. It allows for writing json files anywhere on the server where the web server has access.
Exploitation Scenario
An attacker with low-privilege webui access — or a malicious insider on a shared GPU server — navigates to the Extensions Backup/Restore tab and submits a crafted config_save_name value containing path traversal sequences, e.g., ../../../../Users/Administrator/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/persist. The server-side code in modules/ui_extensions.py constructs the file path without sanitizing the input and opens it for writing. A controlled JSON payload is written to the startup folder. On the next admin login, the JSON file is processed by a registered handler or triggers execution depending on associated application, achieving persistence. Alternatively, the attacker overwrites application config files to redirect model loading paths toward attacker-controlled content.
Weaknesses (CWE)
CWE-22 — Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'): The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
- [Implementation] Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylis
- [Architecture and Design] For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L References
- github.com/AUTOMATIC1111/stable-diffusion-webui/blob/cf2772fab0af5573da775e7437e6acdca424f26e/modules/ui_extensions.py
- github.com/AUTOMATIC1111/stable-diffusion-webui/blob/cf2772fab0af5573da775e7437e6acdca424f26e/modules/ui_extensions.py
- github.com/AUTOMATIC1111/stable-diffusion-webui/blob/cf2772fab0af5573da775e7437e6acdca424f26e/modules/ui_extensions.py
- github.com/AUTOMATIC1111/stable-diffusion-webui/blob/cf2772fab0af5573da775e7437e6acdca424f26e/modules/ui_extensions.py
- github.com/AUTOMATIC1111/stable-diffusion-webui/blob/cf2772fab0af5573da775e7437e6acdca424f26e/modules/ui_extensions.py
- github.com/AUTOMATIC1111/stable-diffusion-webui/blob/v1.7.0/modules/ui_extensions.py
- github.com/AUTOMATIC1111/stable-diffusion-webui/commit/d9708c92b444894bce8070e4dcfaa093f8eb8d43
- github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/15461
- securitylab.github.com/advisories/GHSL-2024-010_stable-diffusion-webui
- securitylab.github.com/advisories/GHSL-2024-010_stable-diffusion-webui/
Timeline
Related Vulnerabilities
CVE-2024-2912 10.0 BentoML: RCE via insecure deserialization (CVSS 10)
Same attack type: Code Execution CVE-2026-21858 10.0 n8n: Input Validation flaw enables exploitation
Same attack type: Code Execution CVE-2025-5120 10.0 smolagents: sandbox escape enables unauthenticated RCE
Same attack type: Code Execution CVE-2025-59528 10.0 Flowise: Unauthenticated RCE via MCP config injection
Same attack type: Code Execution GHSA-vvpj-8cmc-gx39 10.0 picklescan: security flaw enables exploitation
Same attack type: Code Execution