Kubernetes `runAsNonRoot` Bypass via UID Integer Overflow (CVE-2026-46680)
by r0binak · 2026-07-05
- Severity
- High
- CVE
- CVE-2026-46680
- Category
- cloud
- Affected product
- Kubernetes (kubelet / container runtime UID handling)
- Affected versions
- Per source repository (affected Kubernetes releases enforcing runAsNonRoot via UID checks)
- Disclosed
- 2026-07-05
- Patch status
- unpatched
Tags
References
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-07 |
| Author / Researcher | r0binak |
| CVE / Advisory | CVE-2026-46680 |
| Category | cloud |
| Severity | High |
| CVSS Score | Not specified in source |
| Status | PoC |
| Tags | kubernetes, container-escape, runasnonroot, uid-overflow, security-context-bypass, privilege-escalation |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Kubernetes (kubelet / container runtime UID handling) |
| Versions Affected | Per source repository (affected Kubernetes releases enforcing runAsNonRoot via UID checks) |
| Language / Platform | Kubernetes manifests / OCI container image (Dockerfile) |
| Authentication Required | Requires ability to deploy a Pod (namespace-scoped deploy access) |
| Network Access Required | No (cluster API/deploy access is sufficient; no external network exploitation needed) |
Summary
Kubernetes’ securityContext.runAsNonRoot: true admission check is meant to prevent Pods from running as UID 0 (root). This PoC demonstrates that a crafted container image with a numeric UID value that overflows the integer type used internally by the runtime’s non-root check can cause the effective runtime UID to wrap around to 0, even though the declared/checked UID appears non-zero. This lets a Pod pass the runAsNonRoot policy check while its container process actually executes as root inside the container, undermining a commonly relied-upon Pod Security Standard control.
Vulnerability Details
Root Cause
The runAsNonRoot enforcement compares a UID value against zero using a numeric type/range that does not match the full range accepted by the underlying container runtime or /etc/passwd-less numeric UID assignment in the image. By setting a UID large enough to overflow the check’s integer representation (wrapping to 0), the validation logic sees a “non-zero” value while the actual OS-level UID the container runs as resolves to root (UID 0).
Attack Vector
- Attacker builds (or is otherwise able to supply) a container image (
Dockerfile) whose default user is set to a specially chosen large numeric UID designed to overflow to 0 under the runtime’s non-root validation. - Attacker (or any principal with permission to create Pods in the target namespace) deploys a Pod manifest (
pod.yaml) that setssecurityContext.runAsNonRoot: trueand specifies the crafted UID, satisfying the admission-time non-root check. - The container runtime starts the container; due to the overflow, the process’s effective in-container UID is
0(root) despite the declared security context appearing compliant. - The attacker now has a running container process with root privileges inside a Pod that was believed to be constrained to non-root execution, undermining any security controls (e.g. Pod Security Admission, OPA/Gatekeeper policies) that depend on
runAsNonRootbeing enforced correctly.
Impact
Bypass of the runAsNonRoot Pod Security Standard/admission control, allowing a Pod to run its container as root despite passing policy validation. This can facilitate container breakout attempts, abuse of root-only capabilities inside the container, and undermines defense-in-depth assumptions made by cluster operators who rely on runAsNonRoot as a compensating control for other risks (e.g. permissive hostPath mounts, weaker seccomp/AppArmor profiles).
Environment / Lab Setup
Target: Kubernetes cluster (kubelet + container runtime enforcing runAsNonRoot)
Attacker: kubectl access sufficient to build/push a custom image and create a Pod
Tooling: Docker (to build the crafted image from Dockerfile), kubectl apply -f pod.yaml
Proof of Concept
PoC Script
See
Dockerfileandpod.yamlin this folder.
| |
Building the image and deploying pod.yaml (which sets runAsNonRoot: true with the crafted UID) demonstrates that the Pod is admitted despite the non-root policy, and id executed inside the running container shows an effective UID of 0, confirming the bypass.
Detection & Indicators of Compromise
kubectl get pods -A -o json | jq '.items[] | select(.spec.securityContext.runAsUser > 65535 or .spec.containers[].securityContext.runAsUser > 65535)'
kubectl exec <pod> -- id -u
Signs of compromise:
- Pods passing
runAsNonRoot: trueadmission checks yet reporting UID0when inspected at runtime (id,/proc/self/status). - Container images with unusually large numeric
USERvalues in their Dockerfile/image config. - Unexpected root-level file writes or capability usage inside Pods labeled/expected to run non-root.
Remediation
| Action | Detail |
|---|---|
| Primary fix | Upgrade Kubernetes/kubelet and the container runtime to a version that validates runAsUser/runAsNonRoot using a correctly-ranged integer type and rejects out-of-range UID values. |
| Interim mitigation | Enforce an explicit allow-listed UID range via admission policy (e.g. Pod Security Admission restricted profile, OPA/Gatekeeper, Kyverno) rather than relying solely on runAsNonRoot; scan images for anomalous UID declarations before deployment. |
References
Notes
Mirrored from https://github.com/r0binak/CVE-2026-46680 on 2026-07-05. Source repository README was minimal; details above are derived from inspecting the provided Dockerfile and pod.yaml.