Google Cloud Shell Container Escape
Google Cloud Shell ran inside a privileged Docker container with excessive capabilities, allowing an attacker to escape to the host by abusing kernel features like hotplug and core_pattern. This gave root access on the host, but the host itself was a virtual machine, limiting further impact.
Published on medium.com
On a fine late-monsoon weekend morning in India, I was sitting by my window with my laptop in hand, contemplating nature and life at a “multi-threading” level. The next thing I thought of was hack something (ethically, of course), it’s the second most exciting thing for me!
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
Impact
An attacker could escape the container and gain root on the host, but the host was a virtual machine, so further access to other users' data was not possible.
What the attacker needed
Access to Google Cloud Shell; ability to run commands as root inside the container
How it was found
- Check capabilities to confirm privileged container.
- Create a reverse shell payload inside the container.
- Find the host path to the payload via mount output.
- Write the host path to /proc/sys/kernel/hotplug.
- Trigger a hotplug event by adding and removing a dummy network interface.
- Receive a root shell from the host.
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.
A container is like a lightweight virtual machine that shares the host's kernel. If the container is given too many permissions, a user inside it can trick the kernel into running commands on the host, breaking out of the container. Here, the container had full privileges, so the author could escape and get root on the host.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.