/

CVE-2026-32241

Severity:

HIGH RISK

(7.5)

Command Injection in Flannel Extension Backend Node

CVE-2026-32241

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-77

Impact:

Remote Code Execution with Root Privileges on Flannel Nodes

Severity:

HIGH RISK

(7.5)

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

A command injection vulnerability in Flannel's experimental Extension backend allows attacker-controlled data from Kubernetes Node annotations to be passed directly to shell commands.

In clusters where the Extension backend is enabled and an attacker can modify flannel.alpha.coreos.com/backend-data annotations, this can lead to root-level arbitrary command execution on every flannel node in the cluster.

Affected context

This vulnerability occurs only when Kubernetes clusters are configured to use Flannel's experimental Extension backend.

In this mode, Flannel reads backend configuration from the flannel.alpha.coreos.com/backend-data Node annotation and feeds it into backend-specific commands.

Clusters using other Flannel backends (such as vxlan or wireguard) are not impacted by this specific issue, and environments where Node annotations cannot be influenced by attackers are less exposed.

Exploit preconditions

  • Attack surface: Kubernetes API / control plane configuration, specifically Node annotations.
  • Required access: Ability to create, modify, or patch Node annotations, especially flannel.alpha.coreos.com/backend-data (e.g., via elevated RBAC, compromised controller, or misconfigured permissions).
  • Trigger point: Execution of the Extension backend's SubnetAddCommand or SubnetRemoveCommand, which read annotation data from stdin and invoke shell commands on flannel nodes.
  • Why exploitation is possible: The Extension backend takes untrusted annotation content, unmarshals it, and pipes it directly to a shell without sufficient sanitization, quoting, or validation, allowing injection of arbitrary shell metacharacters and commands.

Why this happens

The core issue aligns with CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection').

Flannel's Extension backend constructs shell commands (for subnet add/remove operations) that consume data derived from Kubernetes Node annotations.

Instead of treating this data as opaque inputs passed to parameterized or non-shell execution APIs, it is fed into a shell environment where special characters (such as ;, &&, |, backticks, or $() constructs) are interpreted as part of the command.

Because the Node annotation is partially or fully attacker-controlled in some deployments, this unsafe mixing of code and data allows arbitrary command execution under the privileges of the flannel process, commonly root on the node.

Potential impact

  • Remote execution of arbitrary commands as root on every flannel node using the Extension backend.
  • Full compromise of affected worker and control-plane nodes where flannel runs.
  • Lateral movement across the Kubernetes cluster by pivoting from compromised nodes.
  • Tampering with network configuration, routing rules, and pod connectivity.
  • Deployment of persistence mechanisms or malware on underlying hosts.
  • Exfiltration or destruction of application data reachable from compromised nodes.

General mitigation guidance

Effective mitigation focuses on eliminating command injection opportunities and reducing the trust placed in annotation-sourced data:

  • Prefer non-shell execution APIs:
  • Use system calls or libraries that execute commands without invoking a shell.
  • Pass user-controlled data as strictly typed arguments rather than interpolated strings.
  • Strictly validate backend data:
  • Enforce schemas and allowlists for fields consumed by the Extension backend.
  • Reject or drop annotations containing shell metacharacters or unexpected structures.
  • Minimize and harden the Extension backend:
  • Avoid using the experimental Extension backend in production when possible.
  • If it must be used, constrain the set of allowed commands and parameters.
  • Apply least privilege on nodes:
  • Run flannel with the minimum required privileges and capabilities instead of full root where feasible.
  • Isolate network components using dedicated users, namespaces, and hardening mechanisms.
  • Constrain Node annotation writes:
  • Tighten RBAC so that only trusted, minimal components can modify Node annotations.
  • Periodically review and audit who and what can set or update flannel.alpha.coreos.com/backend-data.

How teams detect issues like this

Detection can combine code-centric and operational approaches:

  • Static analysis and code review:
  • Scan for usages of shell invocation APIs (e.g., /bin/sh, bash, system, or equivalent) that concatenate or pass untrusted data without quoting or validation.
  • Flag patterns where Kubernetes annotations or other cluster metadata are used directly in command strings or piped to shell commands.
  • Introduce secure coding guidelines and review checklists around command construction.
  • Configuration and policy checks:
  • Use policy-as-code tools (e.g., admission controllers, OPA/Gatekeeper) to prevent untrusted principals from modifying sensitive Node annotations.
  • Monitor for the presence and use of the experimental Extension backend in cluster configuration.
  • Runtime and log monitoring:
  • Monitor flannel and system logs for unusual command execution, unexpected arguments, or abnormal network configuration changes.
  • Establish alerts on suspicious annotation changes, especially to flannel.alpha.coreos.com/backend-data.
  • Security testing:
  • Incorporate command injection test cases into CI/CD security tests, focusing on components that translate cluster metadata into local commands.

Sources

SourceLink
github.comgithub.com/flannel-io/flannel/releases/tag/v0.28.2
github.comgithub.com/flannel-io/flannel/security/advisories/GHSA-vchx-5pr6-ffx2

Frequently asked

questions

Exploitability depends on whether the cluster uses Flannel's experimental Extension backend and whether an attacker can modify Node annotations. In environments where RBAC is strict and the Extension backend is disabled, the practical risk is significantly reduced.

An attacker must be able to create or change Kubernetes Node annotations, specifically the flannel.alpha.coreos.com/backend-data annotation. This usually requires elevated cluster permissions, a misconfigured controller, or compromise of a privileged identity.

The safest pattern is to avoid constructing shell commands from untrusted data altogether. Use non-shell execution mechanisms, pass data as parameters rather than interpolated strings, and enforce strict validation and allowlists on any inputs that influence command behavior.

Adopt secure coding practices that prohibit direct shell invocation with untrusted inputs, treat cluster metadata (annotations, labels, config) as untrusted by default, enforce strong RBAC around configuration surfaces, and integrate security reviews and automated checks to flag dangerous command construction patterns during development and deployment.

Find out what's already
exploitable in your codebase.