September 27, 2023

The newest model of Kubernetes launched final month consists of patches for a complete class of vulnerabilities that enable attackers to abuse the subPath property of YAML configuration information to execute malicious instructions on Home windows hosts. “The vulnerability permits distant code execution with SYSTEM privileges on all Home windows endpoints inside a Kubernetes cluster,” Akamai researcher Tomer Peled said about the vulnerability he found and which triggered the invention of two different comparable points. “To take advantage of this vulnerability, the attacker wants to use a malicious YAML file on the cluster.”

Assault YAML

Kubernetes is a broadly in style container orchestration system that’s utilized by organizations to automate the deployment and administration of purposes working in containers. YAML is a language used to put in writing configuration and different administration information for Kubernetes. It subsequently is smart for it to be a goal for potential attackers because it’s a direct method to push person enter to the Kubernetes engine and have it parsed and interpreted.

YAML parsing points have led to Kubernetes vulnerabilities earlier than. For instance the CVE-2022-1471 distant code execution vulnerability within the SnakeYaml parser impacted the Kubernetes Java shopper, whereas the CVE-2021-25749 flaw allowed misspelled person names to be included in a YAML file ensuing within the execution of workloads as root. The CVE-2017-1002101 and CVE-2021-25741 points then confirmed how the subPath subproperty in a YAML file can be utilized together with symbolic hyperlinks (symlinks) to entry information exterior the container, breaking the isolation. It was these final two flaws that gave Peled the thought to research the problem additional.

Kubernetes permits mounting a listing from the host system inside a container via a property referred to as quantity. It is a broadly used function and comes with a number of subproperties to outline the trail of the listing on the host and the mount path contained in the container. The mountPath additional has a subPath property that when offered in a YAML file is processed by kubelet, a core Kubernetes service.

New path processing points permits PowerShell code execution

Peled discovered that when the subPath string is processed, kubelet additionally checks if it’s a symlink, which is a part of the defenses put in place for the older vulnerabilities. Nonetheless, it does this via a PowerShell command that’s invoked by the “exec.Command” operate name. This opens the chance that an attacker might connect PowerShell code to the subPath string the place it could be executed.

“PowerShell permits customers to judge values inside strings earlier than they’re used,” the researcher defined. “This may be completed by including $(<experssion_to_be_evaluated>) to your string […]. Any PowerShell command might be inserted between the parentheses and shall be evaluated — equivalent to $(Begin-Course of cmd), $(Invoke-Expression exp), and different PowerShell treats.”