/

CVE-2026-29955

Severity:

HIGH RISK

(8.8)

Command Injection in KubePlus kubeconfiggenerator

CVE-2026-29955

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-94

Impact:

Remote Code Execution via Command Injection

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

The /registercrd endpoint in KubePlus kubeconfiggenerator suffers from a command injection flaw where the user-controlled chartName parameter is concatenated directly into a shell command.

Because this command is executed using subprocess.Popen(..., shell=True) without validation or sanitization, an attacker can supply crafted input to execute arbitrary shell commands on the underlying host.

Affected context

This vulnerability appears in KubePlus 4.14 within the kubeconfiggenerator component, specifically when handling HTTP requests to the /registercrd endpoint.

It is relevant in deployments where kubeconfiggenerator is exposed over a network (intra-cluster or external) and where the service accepts client-controlled chartName values.

The risk increases when the process runs with elevated privileges or on hosts with access to sensitive Kubernetes credentials or cluster management interfaces.

Exploit preconditions

  • Attack surface: HTTP interface of the kubeconfiggenerator /registercrd endpoint.
  • Required access: Ability to send requests to kubeconfiggenerator (e.g., network reachability within the cluster, or externally if published).
  • Trigger point: Submission of a crafted chartName parameter value that is incorporated into the shell command.
  • Why exploitation is possible: The implementation constructs a shell command string by directly concatenating user input into it and executes it via subprocess.Popen() with shell=True, allowing shell metacharacters and sequences to be interpreted as additional commands.

Why this happens

The core issue is the construction of shell commands using untrusted input, combined with the use of shell=True in subprocess.Popen().

This pattern directly maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), as user-controlled data influences executable instructions interpreted by the system shell.

Instead of treating chartName as data, the code treats it as part of the command line, enabling attackers to inject shell operators, additional commands, or argument manipulations that the shell processes as executable logic.

Potential impact

  • Execution of arbitrary shell commands with the privileges of the kubeconfiggenerator process.
  • Unauthorized access to Kubernetes configuration files or credentials available on the host or in the container.
  • Modification, creation, or deletion of files on the system where kubeconfiggenerator runs.
  • Lateral movement within the cluster by leveraging host or service account permissions.
  • Disruption of KubePlus functionality or broader denial of service in the cluster environment.
  • Potential escalation to full cluster compromise if the service account or node has powerful Kubernetes API permissions.

General mitigation guidance

Effective mitigation centers around separating untrusted data from executable commands and minimizing shell usage:

  • Replace shell-based command execution with direct invocation of binaries using argument lists (e.g., subprocess.Popen([...], shell=False)), ensuring user input is always passed as a data argument.
  • Implement strict validation and normalization for parameters like chartName, such as whitelisting acceptable characters and known values or mapping user inputs to internal identifiers.
  • Avoid constructing command strings dynamically; instead, use parameterized command building that cannot alter control flow.
  • Run kubeconfiggenerator with the least privileges necessary, limiting file system access and Kubernetes API permissions.
  • Use container hardening (read-only filesystems, restricted capabilities, seccomp profiles) to reduce the blast radius of any command execution.

How teams detect issues like this

Detection typically combines code-centric and operational views:

  • Static analysis: Configure SAST tools or linters to flag uses of subprocess.Popen, os.system, or similar APIs with shell=True, especially when arguments include request parameters or other untrusted data.
  • Code review: Look for patterns where HTTP request fields (e.g., chartName) are concatenated into strings that are passed to command execution functions; enforce policies that require argument-list execution and strong input validation.
  • Policy enforcement: Integrate secure coding guidelines into CI pipelines to block merges that introduce shell-based execution with user-supplied input.
  • Runtime monitoring: Use process and command auditing within containers or hosts to detect unusual command invocations originating from kubeconfiggenerator, especially those that deviate from expected tool usage.

Sources

SourceLink
gist.github.comgist.github.com/b0b0haha/f011fdd69adc3ae272a4e3b99af90163
github.comgithub.com/b0b0haha/CVE-2026-29955/blob/main/README.md

Frequently asked

questions

It can be, provided that an attacker can reach the /registercrd endpoint over the network. If kubeconfiggenerator is exposed externally or accessible from compromised in-cluster workloads, the vulnerability is remotely exploitable.

An attacker needs network access to the kubeconfiggenerator service and the ability to send requests containing a controlled chartName parameter. No additional local privileges are required beyond the service being reachable.

The safest pattern is to avoid shell interpretation entirely: use subprocess with argument lists (shell=False), treat all user input strictly as data, and apply strong allowlist-based validation on any parameters that influence external command execution.

Establish coding standards that prohibit dynamic shell command construction with untrusted data, enforce these standards through code review and automated static analysis, and design APIs so that user inputs are mapped to predefined, validated options rather than interpolated directly into command strings.

Find out what's already
exploitable in your codebase.