Compromise of node can lead to compromise of pods on other nodes
An attacker who has already compromised a node can replace the Kubelet process with a fake server that redirects kubectl exec requests to other nodes. This allows arbitrary command execution in pods on those other nodes, bypassing network restrictions and authentication.
- Triaged in 2 months
- Fixed in 2 months
- Paid in 2 months
- Disclosed after 6 months
Hi Kubernetes team,
Summary:
If an attacker manages to escape a (eg. privileged) container and gains access to the underlying node it can replace the Kubelet process listening on port 10250/10255 on the node. A fake Kubelet server issueing 301 redirects can trick 'kubectl' (or other clients) into issueing commands against a other pods in the cluster. This attack bypasses firewalling configurations where nodes cannot talk directly to eachother on port 10250/10255 and also works when port 10250 requires authentication since kubectl is happy to resend the Authorization header / bearer token when a 301redirect is received.
Kubernetes Version:
1.14.10
Component Version:
kubelet/kubectl
Steps To Reproduce:
- Attacker escapes container
- Attacker issues a 'kill -9
pidof kubelet; python fakekubet.py (see attachment) - Attacker waits for a /exec request coming in to the fakekubelet.py server, and redirects it (with an arbitrary command) to another node.
Example exec request for 'hello-app' by kubectl: 10.138.0.10 - - [01/May/2020 11:28:55] "POST /exec/default/hello-server-7f8fd4d44b-j5rsc/hello-app?command=%2Fbin%2Fs&input=1&output=1&tty=1 HTTP/1.1" 307 -
Example response by the fakekubelet: HTTP/1.1 301 Redirect Location: https://10.138.0.8/exec/default/victim-67c59cd9f4-vm5dl/nginx?command=/bin/arbitrary_command_here&error=1&input=1&output=1&tty=0
- kubectl follows the redirect and contacts the victim node, requesting /exec as specified by fakekubelet.py (can also redirect to 'master')
- arbitrary command is executed on the victim node
Supporting Material/References:
attachment 1: fakekubelet.py attachment 2: ugly_diagram.png related Kubelet code: https://github.com/kubernetes/kubernetes/blob/4a6935b31fcc4d1498c977d90387e02b6b93288f/pkg/kubelet/server/server.go#L257-L263
I hope this helps!
Kind regards, Offensi.com
Wouter ter Maat
Impact
execute arbitrary command in victim's pod
Attachments

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 Kubelet's exec endpoint does not validate redirects, and kubectl follows HTTP redirects while resending authentication headers, allowing a compromised node to redirect commands to other nodes.
Impact
An attacker could execute arbitrary commands in pods on other nodes, bypassing firewalling and authentication.
What the attacker needed
Attacker has compromised a node; kubectl or other client sends exec request; victim node reachable from attacker node
How it was found
- Attacker escapes container
- Attacker kills the Kubelet process and starts a fake Kubelet server
- Attacker waits for an exec request and redirects it to another node with an arbitrary command
- kubectl follows the redirect and contacts the victim node
- Arbitrary command is executed on the victim node
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.
In Kubernetes, each machine (node) runs a program called Kubelet that manages containers. If an attacker takes over one node, they can run a fake Kubelet that tells kubectl to send commands to a different node instead. Because kubectl trusts the redirect and resends the login token, the attacker can run commands in pods on that other node.
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.