Skip to content
Access control Write-up Advanced

Kubernetes Remote Code Execution Via Nodes/Proxy GET Permission

A service account holding only the nodes/proxy GET permission can execute commands in any Pod on a reachable Node, because the Kubelet authorises a WebSocket upgrade using the initial HTTP GET method instead of the CREATE verb the /exec operation requires. An attacker with such a token and network access to the Kubelet port could run commands in Pods, including privileged system Pods, and the direct Kubelet connection is not logged with the executed command.

grahamhelton.com

Published on grahamhelton.com

An authorization bypass in Kubernetes RBAC allows for nodes/proxy GET permissions to execute commands in any Pod in the cluster.

The author, on grahamhelton.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The Kubelet maps the HTTP GET used in a WebSocket handshake to the RBAC GET verb and performs no further authorisation check once the connection is upgraded, so a write operation on /exec is allowed with only nodes/proxy GET.

Impact

Anyone with a service account holding nodes/proxy GET that can reach a Node's Kubelet on port 10250 could execute commands in any Pod, including privileged system Pods, potentially leading to full cluster compromise, and the executed commands are not recorded by AuditPolicy.

What the attacker needed

Service account with nodes/proxy GET; network access to Kubelet port 10250

The fix

The report says the issue was closed as working as intended, so the Kubelet should be changed to re-check authorisation for the actual operation after a WebSocket upgrade, or nodes/proxy GET should not be granted to service accounts that do not need command execution.

How it was found

  1. Confirm the service account holds only nodes/proxy GET by listing its permissions.
  2. Open a WebSocket connection to the Kubelet's /exec endpoint on port 10250 using the service account token.
  3. Observe that the command runs in the target Pod and returns output.
  4. Send the same request as an HTTP POST and observe it is forbidden because CREATE is missing.

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 write-up has not been written yet. The Original tab links to the source.

Kubernetes lets administrators give accounts narrow permissions, such as the ability to read monitoring data from a node. This report shows that one of those read permissions also quietly allows running commands inside containers, because the component that checks permissions looks only at the first message of a two-way connection rather than at what the connection is later used for. Someone holding that read permission, and able to reach the node's management port, could therefore run commands in other people's containers.

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.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.