CVE-2024-32027

9.1 CRITICAL

📋 TL;DR

CVE-2024-32027 is a command injection vulnerability in Kohya_ss GUI for Stable Diffusion trainers. Attackers can execute arbitrary commands on affected systems by injecting malicious input into the finetune_gui.py component. Users running Kohya_ss v22.6.1 or earlier versions are affected.

💻 Affected Systems

Products:
  • Kohya_ss
Versions: v22.6.1 and earlier
Operating Systems: Windows, Linux, macOS
Default Config Vulnerable: ⚠️ Yes
Notes: All installations using vulnerable versions are affected regardless of configuration.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise allowing remote code execution, data theft, ransomware deployment, or complete system takeover.

🟠

Likely Case

Unauthorized command execution leading to data exfiltration, cryptocurrency mining, or lateral movement within the network.

🟢

If Mitigated

Limited impact with proper input validation and execution restrictions in place.

🌐 Internet-Facing: HIGH - If exposed to internet, attackers can remotely exploit without authentication.
🏢 Internal Only: MEDIUM - Internal attackers or compromised systems could exploit, but requires network access.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Proof-of-concept available in GitHub advisory. Exploitation requires user interaction with the GUI but no authentication.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 23.1.5

Vendor Advisory: https://github.com/bmaltais/kohya_ss/security/advisories/GHSA-8h78-3vqm-xw83

Restart Required: Yes

Instructions:

1. Backup current configuration. 2. Update Kohya_ss to version 23.1.5 or later using pip: 'pip install --upgrade kohya_ss'. 3. Restart the application.

🔧 Temporary Workarounds

Input Validation Enhancement

all

Add input sanitization to user-controlled parameters in finetune_gui.py

# Manual code review and sanitization of user inputs in finetune_gui.py

Network Isolation

all

Restrict network access to Kohya_ss instance

# Firewall rule: iptables -A INPUT -p tcp --dport [KOHYA_PORT] -j DROP
# Windows: netsh advfirewall firewall add rule name="Block Kohya" dir=in action=block protocol=TCP localport=[KOHYA_PORT]

🧯 If You Can't Patch

  • Disable or remove Kohya_ss from production systems
  • Implement strict network segmentation and monitor for suspicious command execution

🔍 How to Verify

Check if Vulnerable:

Check Kohya_ss version: 'python -c "import kohya_ss; print(kohya_ss.__version__)"' and compare to v22.6.1

Check Version:

python -c "import kohya_ss; print(kohya_ss.__version__)"

Verify Fix Applied:

Verify version is 23.1.5 or later: 'python -c "import kohya_ss; print(kohya_ss.__version__)"'

📡 Detection & Monitoring

Log Indicators:

  • Unusual command execution patterns in system logs
  • Suspicious process creation from Kohya_ss
  • Unexpected network connections from Kohya_ss process

Network Indicators:

  • Outbound connections to suspicious IPs from Kohya_ss
  • Unexpected data exfiltration patterns

SIEM Query:

Process Creation where Parent Process contains 'python' AND Command Line contains 'kohya' AND (Command Line contains ';' OR '|' OR '&' OR '`')

🔗 References

📤 Share & Export