CVE-2024-31462: stable-diffusion-webui: path traversal file write

MEDIUM
Published April 12, 2024
CISO Take

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.

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

CVSS 3.1
6.3 / 10
EPSS
0.2%
chance of exploitation in 30 days
Higher than 48% of all CVEs
Exploitation Status
No known exploitation
Sophistication
Trivial

Attack Surface

AV AC PR UI S C I A
AV Network
AC Low
PR Low
UI None
S Unchanged
C Low
I Low
A Low

Recommended Action

5 steps
  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.

CISA SSVC Assessment

Decision Track
Exploitation none
Automatable No
Technical Impact partial

Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.

Classification

Compliance Impact

This CVE is relevant to:

EU AI Act
Article 15 - Accuracy, robustness and cybersecurity
ISO 42001
8.4 - AI system operation and monitoring
NIST AI RMF
MANAGE-2.2 - Mechanisms are in place and applied to sustain the value of deployed AI systems
OWASP LLM Top 10
LLM07 - System Prompt Leakage

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

Timeline

Published
April 12, 2024
Last Modified
November 21, 2024
First Seen
April 12, 2024

Related Vulnerabilities