Skip to main content
Menu
Advisories

Admission control bypass via ephemeral containers

GHSA-X447-GQMH-6MCXPublished Updated GitHub

Description

Impact

NeuVector's admission control can be bypassed for requests that attach or update ephemeral containers on an existing pod.

NeuVector installs its ValidatingWebhookConfiguration (neuvector-validating-admission-webhook) dynamically at runtime. The generated rules register the pods resource (and other workload kinds such as deployments, daemonsets, replicationcontrollers and statefulsets), but they do not register the pods/ephemeralcontainers subresource. In Kubernetes, a rule for pods does not match the pods/ephemeralcontainers subresource, so admission requests that inject or update ephemeral containers are never delivered to the NeuVector admission webhook.

As a result, the admission policy engine is never reached for these requests. Even an admission rule configured in protect mode that would deny privileged containers (for example runAsPrivileged) does not apply, and NeuVector produces no admission denial and no policy-layer audit or log entry for the bypassed request.

A principal who holds the Kubernetes RBAC permission to update the pods/ephemeralcontainers subresource — the permission required to use kubectl debug — can therefore attach a privileged ephemeral container to an existing pod without NeuVector enforcing its admission policies. Because an ephemeral container may set securityContext.privileged: true, the injected container gains host device access and CAP_SYS_ADMIN, which can be leveraged (for example by loading a kernel module or accessing worker-node secrets) to escalate toward node-level compromise. This permission is commonly delegated to developers and operators for debugging, without granting them the ability to create privileged pods directly.

  • Affected component: NeuVector Controller — admission webhook registration logic (controller/nvk8sapi/nvvalidatewebhookcfg/*.go, controller/rest/admwebhook.go) and the deployed ValidatingWebhookConfiguration.
  • Affected configuration: NeuVector deployments relying on admission control (protect mode) to restrict privileged or otherwise non-compliant containers.

A secondary, lower-severity issue was also identified: when the containers criterion is omitted from an admission rule, the code defaults to regular containers only ([]string{share.AdmCtrlRuleContainers}), silently excluding ephemeral containers from evaluation. This is secondary because the primary webhook-registration gap already prevents these requests from reaching admission control.

Note: Exploitation requires an authenticated Kubernetes principal with update permission on the pods/ephemeralcontainers subresource in the target namespace, a NeuVector deployment using admission control in protect mode with rules that would otherwise deny the container, and Kubernetes ≥ 1.25 (ephemeral containers GA). Because the bypassed requests never reach NeuVector, defenders should not rely on NeuVector admission logs to detect this activity; audit the Kubernetes API server for update/patch on pods/ephemeralcontainers instead. Full exploitation details are intentionally omitted.

Patches

The fix registers the pods/ephemeralcontainers subresource in the webhook configuration and evaluates the newly injected ephemeral container (the last entry in request.object.spec.ephemeralContainers) against admission rules.

The affected versions and the fixed release versions are listed below. Users are advised to upgrade to the fixed version as soon as possible.

  • Affected versions: >= 5.6.0, < 5.6.5; >= 5.5.0, < 5.5.6
  • Fixed version(s): 5.7.0, 5.6.5, 5.5.6

Workarounds

Until a fixed version is available, users can reduce exposure by:

  • Restricting RBAC update permission on pods/ephemeralcontainers to break-glass roles only, rather than granting it broadly for debugging.
  • Enabling Kubernetes Pod Security Admission (restricted or baseline) on target namespaces. Pod Security Admission evaluates the ephemeral-containers subresource and will block privileged ephemeral containers independently of NeuVector.

References

For more information

If you have any questions or comments about this advisory:

Credits

Reported by Alperen Keskin.

Affected versions

References

GitHub · neuvector/neuvector