Skip to content

Lesson 9 of 13 · 12m

The Admission Chain Is Checkpoint and Door

Mutating-then-validating ordering, failurePolicy fail-open, webhook attack surface, IngressNightmare, and when ValidatingAdmissionPolicy beats a webhook.

The pipeline has a policy checkpoint — and it's reachable

After authentication and authorization pass, every write request runs the admission chain: mutating admission plugins first (they may rewrite the object — DefaultStorageClass adds PVC storage classes, ServiceAccount injects the default SA, webhook endpoints get an AdmissionReview payload to modify), then schema validation, then validating admission plugins (pure yes/no), then persist to etcd. The built-ins you've met — PodSecurity, ResourceQuota, LimitRanger, NodeRestriction, AlwaysPullImages — all live here.

Dynamic admission uses MutatingWebhookConfiguration and ValidatingWebhookConfiguration. Each names webhook rules (which apiGroups/resources/operations trigger it) and clientConfig — an in-cluster Service or an external url, always HTTPS. The fields that decide whether it helps or hurts:

When a webhook fires, the API server POSTs an AdmissionReview object containing the candidate resource; the endpoint inspects it and returns allowed/denied or a mutated object. TLS to the configured endpoint is the only thing authenticating that exchange — which is why an exposed webhook port is an unauthenticated input surface into your admission pipeline.

  • failurePolicy: Fail rejects the request when the webhook errors or times out. Ignore admits the request anyway. A security webhook on Ignore is a security control that votes "yes" whenever it's down — fail-open by design. CVE-2023-2727 showed even a built-in plugin could be bypassed — the ImagePolicyWebhook check skipped entirely by launching the image as an ephemeral container (fixed in 1.27.3/1.26.6/1.25.11/1.24.15); a webhook on Ignore needs no CVE at all.
  • timeoutSeconds: how long the API server waits before invoking failurePolicy.
  • namespaceSelector / objectSelector: scope what the webhook sees. A cluster-wide selector on a security webhook multiplies both its coverage and its outage radius.
  • Invocation order: webhooks run sorted by name, and mutating webhooks can be re-invoked after later mutations — a mutator that must see the final object needs a name sorting last, because any webhook after it can cause the earlier ones to run again.
  • matchPolicy: Equivalent (default) fires the webhook for equivalent versions/groups of a resource; Exact restricts it to literally the listed versions. Leave it at the default unless you're deliberately narrowing.

When the webhook itself is the door

IngressNightmare, disclosed March 24, 2025 (CVE-2025-1974, CVSS 9.8), is the best argument that admission controllers are attack surface, not just controls. The ingress-nginx admission webhook accepted attacker-crafted AdmissionReview objects sent directly to its port, processed the object's nginx config snippets, and executed arbitrary code — unauthenticated, over the network, as a controller that reads every Secret in the cluster to validate TLS references. Wiz's disclosure estimated roughly 43% of cloud environments carried a vulnerable ingress-nginx and ~6,500 clusters exposed it publicly. No credentials needed, one request to a component most clusters run and nobody networks down.

The fix pattern it implies is broader than ingress-nginx: admission webhook pods should not be reachable from outside the cluster's control path. They're trusted with the raw object before validation — the least-scrutinized input in the pipeline.

The serverless alternative

ValidatingAdmissionPolicy (CEL expressions evaluated inside the API server, GA in 1.30) covers the declarative cases with no pod to crash, no endpoint to attack, and no failurePolicy to set wrong:

kind: ValidatingAdmissionPolicy
spec:
  validations:
    - expression: "object.spec.replicas <= 10"
      message: "replicas over 10 not permitted"

The expression evaluates inside the API server at the same pipeline stage a webhook would run. When a rule is expressible in CEL, prefer it; reserve webhooks (Kyverno, OPA/Gatekeeper) for policy that needs external data like image-signature lookups.

What to actually do

failurePolicy: Fail on anything whose absence should block deploys; explicit namespaceSelector scoping; webhook services reachable only inside the cluster; keep admission components patched first — IngressNightmare's victims were running a default addon. And audit which webhooks exist at all: kubectl get validatingwebhookconfigurations,mutatingwebhookconfigurations is a short list that should contain only things you put there.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.