The vulnerability, identified as GHSA-864g-863m-vcvq, allows an attacker with git push access to a Fleet-monitored repository to bypass Pod Security Standards (PSS) by overwriting PSS enforcement labels on a target namespace. The root cause lies in the Fleet agent's deployer, which failed to sanitize user-provided namespace labels.
The analysis of the patches between vulnerable version v0.15.1 and patched version v0.15.2 pinpointed the vulnerable code. The key changes are in the internal/cmd/agent/deployer/deployer.go file.
The function addLabelsFromOptions was identified as the primary vulnerable function. Before the patch, it would take all labels defined in fleet.yaml (via BundleDeployment.spec.options.namespaceLabels) and apply them to the target namespace, removing any pre-existing labels not specified in the options. This allowed an attacker to inject or modify labels with the pod-security.kubernetes.io/ prefix, effectively weakening the namespace's security policy.
The patch, introduced in commit 74f2dc9fb0d98450962e1d885a1d10f0e28abf01, rectifies this by modifying addLabelsFromOptions to explicitly ignore any labels with the pod-security.kubernetes.io/ prefix from the user-provided options and to preserve any such labels that already exist on the namespace object. This ensures that PSS labels remain under the control of the cluster administrator.
The Deployer.setNamespaceLabelsAndAnnotations method is the direct caller of addLabelsFromOptions and is therefore a critical part of the vulnerable execution path. It reads the malicious labels from the BundleDeployment and passes them to addLabelsFromOptions for processing.