Skip to content
RCE Write-up Advanced

Executive Summary

Azure Container Instances ran outdated container runtime and Kubernetes components, allowing a malicious user to escape their container, steal a service account token, and gain cluster-admin control over multitenant clusters. A second SSRF flaw in the bridge pod let an attacker set a pod's hostIP to a crafted value and execute commands on the api-server, achieving the same full cluster takeover.

Unit42_Intel Follow

Published on unit42.paloaltonetworks.com

Azure Container Instances (ACI) is Azure's Container-as-a-Service (CaaS) offering, enabling customers to run containers on Azure without managing the underlying servers. Unit 42 researchers recently identified and disclosed critical security issues in ACI to Microsoft.

Yuval Avrahami, on unit42.paloaltonetworks.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

Likely the platform ran an outdated container runtime (runC v1.0.0-rc2) vulnerable to container breakout, and a custom bridge pod sent its privileged service account token to nodes and trusted an unvalidated pod status.hostIP field when constructing exec requests.

Impact

A malicious Azure user could have gained cluster-admin control over multitenant Kubernetes clusters, enabling execution of commands in other customers' containers, exfiltration of secrets and private images, and deployment of cryptominers; Microsoft patched both issues.

What the attacker needed

A free Azure account; ability to deploy a container to ACI; container lands on a Kubernetes-backed cluster

The fix

Microsoft patched ACI so the bridge pod no longer sends its service account token to nodes and verifies that a pod's status.hostIP is a valid IP before sending an exec request.

How it was found

  1. Deploy an image exploiting CVE-2019-5736 to ACI to break out and gain code execution on the underlying node.
  2. On the node, monitor traffic on the Kubelet port and wait for a request that includes a JWT token in the Authorization header.
  3. Issue az container exec to run a command on the uploaded container, causing the bridge pod to send an exec request to the Kubelet on the compromised node.
  4. Extract the bridge token from the request's Authorization header and use it to pop a shell on the api-server.
  5. For the second issue, repeatedly update the pod's status.hostIP field to a crafted value containing URL components.
  6. Issue az container exec; the bridge sends the exec request to the api-server container instead of the customer container.

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.

Containers are meant to keep one customer's code separate from another's, like separate rooms in a shared building. Here, a flaw in the software that runs containers let someone break out of their room and then steal a key that opened every other room in the building. The researchers also found a second way to trick a helper service into running commands on the building's control system.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Unit42_Intel

View all

2 more disclosed reports, best first.

More from Microsoft

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.