Node Validation Admission does not observe all oldObject fields
The Validating Admission webhook for Node objects incorrectly populates the oldObject field in AdmissionReview requests with the same values as the new object for several fields, including labels, taints, and schedulability. This allows users to bypass validating admission controls and modify these fields, potentially steering workloads or disrupting scheduling.
- Fixed in 6 months
- Paid in 56 days
- Disclosed after 7 months
Summary:
The Validating Admission webhook for Node Objects is passing oldObject fields incorrectly on AdmissionReview.Request. It was identified initially in metadata.labels, but a list of impacted fields follows below:
oldNode.Spec.PodCIDRs oldNode.Spec.ProviderID oldNode.Spec.ConfigSource oldNode.Status.Config oldNode.ObjectMeta oldNode.Status.Capacity oldNode.Spec.Unschedulable oldNode.Status oldNode.Spec.Taints
Those fields are being set with the same values as the new node object, potentially allowing users to bypass validating admission to update node labels, taints, and others.
Kubernetes Version:
v1.19.x
Component Version:
Validation Webhook for Nodes
Steps To Reproduce:
- Create a Validating Webhook Configuration for Node updates
- Create an admission Webhook that outputs the content of oldNode and newNode from the admissionReview obejct
- Run a patch that changes one of the fields mentioned above.
- Look at the log output and compare the old and newObject CRs -- you will notice that the patch you just made appears on the new AND oldObject CRs logged.
Supporting Material/References:
Validating Webhook we created -> https://github.com/ArielLima/managed-cluster-validating-webhooks/blob/nodelabels-webhook/pkg/webhooks/node/node.go#L145-L179
Dummy Validating Webhook -> https://github.com/openshift/generic-admission-server/pull/40/files#diff-ce34cccb3b86fc2740015cfa93de7e314262e3db76d54708d5e1c302e6986436R39
Potential issue location -> https://github.com/kubernetes/kubernetes/blob/c970a46bc1bcc100bbbfabd5c12bd4c5d87f8aea/pkg/apis/core/validation/validation.go#L4792-L4794
Impact
Even though a validating admission webhook thinks that it is restricting actors from mutating certain fields like taints, labels, and schedulability it is not.
Some examples of actions you could perform:
- change labels to steer workloads
- change labels to prevent scheduling any workload
- change taints to push pods off a node
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the code that constructs the AdmissionReview request for Node updates copies the new object into the oldObject field for certain fields instead of using the actual previous state.
Impact
A validating admission webhook that intends to restrict changes to node labels, taints, or schedulability may fail to do so, allowing an actor to steer workloads, prevent scheduling, or push pods off a node.
What the attacker needed
Kubernetes v1.19.x; Validating webhook for Node updates; Ability to patch Node objects
How it was found
- Create a Validating Webhook Configuration for Node updates.
- Create an admission webhook that outputs the content of oldNode and newNode from the admissionReview object.
- Run a patch that changes one of the fields mentioned above.
- Compare the logged old and new objects; the patch appears in both.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A validating admission webhook is a security check that runs before changes to a Kubernetes object are saved. It compares the old and new versions to decide if the change is allowed. Here, the old version was incorrectly filled with the new values, so the check could not see what actually changed and let forbidden modifications through.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.