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.
Risk Assessment
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.
Severity & Risk
Attack Surface
Recommended Action
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.
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
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.24%.
Technical Details
NVD Description
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)
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
AI Threat Alert