☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]

CVE-2024-32027

CVE-2024-32027 Command Injection in Kohya_ss
📅 PUBLISHED: 2024-04-16 14:46 UTC 🔄 UPDATED: 2026-10-09 05:42 UTC
[ PATCH UNDER REVIEW ↓ ] Remains UNDER REVIEW until an independent source confirms the fix
[ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 3.03%
👁️
3.03% probability
75.7× above the median CVE
Tier: HIGH
30-day exploitation window · FIRST.org · updated daily
VULNERABLE: version not auto-detected — verify your deployed version locally
CVSS SEVERITY SCALE
9.0–10.0 CRITICAL
7.0–8.9 HIGH
4.0–6.9 MEDIUM
0.1–3.9 LOW
0.0 NONE
9.1
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2024-32027 is a critical command injection vulnerability in Kohya_ss, a GUI for Kohya's Stable Diffusion trainers. The vulnerability resides in the finetune_gui.py file and allows an unauthenticated attacker to execute arbitrary commands on the server. With a CVSS score of 9.1, this vulnerability poses a severe risk to confidentiality, integrity, and availability. The vendor has released a fix in version 23.1.5, but the patch status for earlier versions remains unpatched. No public proof-of-concept (PoC) or exploit code has been identified at this time.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

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.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

Kohya_ss is a Python-based application distributed via GitHub and PyPI. The vulnerability affects the core application logic, not a dependency. However, users should verify the integrity of their installation and ensure they are using the latest patched version (23.1.5 or later). The package is not signed, and there is no official checksum verification mechanism, increasing the risk of supply chain attacks if the repository is compromised.

CVSS Breakdown & Threat Level

  • CVSS Score: 9.1 (Critical)
  • Attack Vector: Network (AV:N)
  • Attack Complexity: Low (AC:L)
  • Privileges Required: None (PR:N)
  • User Interaction: None (UI:N)
  • Scope: Unchanged (S:U)
  • Confidentiality Impact: High (C:H)
  • Integrity Impact: High (I:H)
  • Availability Impact: High (A:H)

The vulnerability is remotely exploitable without authentication, making it a prime target for automated scanning and exploitation. The low attack complexity and high impact make this a critical threat.

Deep Dive & Mechanics

The vulnerability exists in the finetune_gui.py script, which handles user input for fine-tuning parameters. The application fails to sanitize or validate user-supplied data before passing it to a system command (e.g., via os.system() or subprocess.Popen() with shell=True). An attacker can inject arbitrary shell commands by crafting malicious input in fields such as dataset paths, model names, or training arguments.

For example, if the application constructs a command like:

python train.py --data_dir {user_input}

An attacker could provide:

; rm -rf / ; echo pwned

This would result in the execution of:

python train.py --data_dir ; rm -rf / ; echo pwned

Leading to arbitrary command execution.

The root cause is the lack of input sanitization and the use of shell execution functions without proper escaping. The fix in version 23.1.5 likely involves using shlex.quote() or switching to subprocess.Popen() with a list of arguments (no shell=True).

Vulnerable vs. Patched Code

Vulnerable Code (v22.6.1):

import os

def run_finetune(user_input):
    command = f"python train.py --data_dir {user_input}"
    os.system(command)

Patched Code (v23.1.5):

import subprocess
import shlex

def run_finetune(user_input):
    safe_input = shlex.quote(user_input)
    command = f"python train.py --data_dir {safe_input}"
    subprocess.Popen(command, shell=False)

The patched version uses shlex.quote() to escape shell metacharacters and disables shell=True to prevent command injection.

Exploitation & Lab Setup

Red Team

Prerequisites:

  • Kohya_ss v22.6.1 or earlier running on a target system.
  • Network access to the web interface (default port 7860).

Exploitation Steps:

  1. Identify the vulnerable endpoint (e.g., /finetune or similar).
  2. Craft a POST request with a malicious payload in the data_dir parameter.
  3. Execute the request to trigger command injection.

Example Payload:

curl -X POST http://target:7860/finetune \
  -d "data_dir=;id > /tmp/pwned.txt;"

Verification:

curl http://target:7860/static/pwned.txt

Blue Team

Detection:

  • Monitor for unusual shell commands in process logs (e.g., os.system, subprocess.Popen with shell=True).
  • Look for requests containing shell metacharacters (;, |, &, $(), `) in parameters.
  • Use the detection rules provided below.

Hunting:

  • Search for finetune_gui.py processes with unexpected arguments.
  • Review web server logs for anomalous POST requests to /finetune.

Indicators of Compromise (IOCs)

  • Network:
    • POST requests to /finetune with shell metacharacters in parameters.
    • Outbound connections to attacker-controlled IPs from the Kohya_ss server.
  • File System:
    • Unexpected files in /tmp/ or web root (e.g., pwned.txt).
    • Modified or deleted files in the Kohya_ss installation directory.
  • Process:
    • Child processes spawned by finetune_gui.py (e.g., id, curl, nc).
    • Unusual shell processes (e.g., /bin/sh -c).

Detection Engineering

YARA Rule

rule CVE_2024_32027_Command_Injection {
    meta:
        description = "Detects command injection attempts in Kohya_ss finetune_gui.py"
        author = "Valters IT"
        date = "2025-04-01"
        cve = "CVE-2024-32027"
    strings:
        $s1 = "os.system" ascii nocase
        $s2 = "subprocess.Popen" ascii nocase
        $s3 = "shell=True" ascii nocase
        $s4 = "finetune_gui.py" ascii nocase
    condition:
        any of ($s1, $s2) and $s3 and $s4
}

Sigma Rule

title: CVE-2024-32027 Command Injection in Kohya_ss
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects command injection attempts via shell metacharacters in Kohya_ss finetune_gui.py
author: Valters IT
date: 2025-04-01
logsource:
    category: webserver
    product: apache
detection:
    selection:
        cs-method: 'POST'
        cs-uri-stem: '/finetune'
        cs-uri-query|contains:
            - ';'
            - '|'
            - '&'
            - '$('
            - '`'
    condition: selection
falsepositives:
    - Legitimate use of special characters in dataset paths (unlikely)
level: critical

Suricata Rule

alert http $HOME_NET any -> $EXTERNAL_NET any (
    msg:"CVE-2024-32027 Kohya_ss Command Injection Attempt";
    flow:to_server,established;
    content:"POST"; http_method;
    content:"/finetune"; http_uri;
    content:"data_dir"; http_client_body;
    pcre:"/(;|\||&|\$\(|`)/Ri";
    classtype:attempted-admin;
    sid:1000001;
    rev:1;
)

Remediation & Mitigation

Immediate Actions:

  1. Upgrade Kohya_ss to version 23.1.5 or later.
  2. If upgrade is not possible, restrict network access to the Kohya_ss web interface (e.g., firewall rules, VPN).
  3. Implement a Web Application Firewall (WAF) rule to block requests containing shell metacharacters.

Long-term Measures:

  • Conduct a code review of all user input handling in the application.
  • Use parameterized commands or subprocess.Popen() with a list of arguments (no shell=True).
  • Implement input validation and sanitization using libraries like shlex.
  • Enable logging and monitoring for all system command executions.

Valters IT Signature

This report was generated by Valters IT Cyber Threat Intelligence. For questions or support, contact threatintel@valtersit.com.

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2024-32027/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.