Skip to content
Access control Write-up Advanced

How We Escaped Docker in Azure Functions

An undocumented Microsoft 'Mesh' process running as root inside the Azure Functions container exposed an HTTP interface that could mount a user-supplied squashfs image onto an arbitrary path. By mounting a crafted image over the sudoers directory, an attacker with code execution in a function could gain root and then use the container's extra privileges to run commands on the Docker host.

Intezer Follow

Published on intezer.com

In previous months we identified vulnerabilities in Microsoft Azure Network Watcher and Azure App Services, leading us to investigate other types of Azure compute infrastructure. We found a new vulnerability in Azure Functions, which would allow an attacker to escalate privileges and escape the Azure Functions Docker…

Intezer, on intezer.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 an undocumented root-owned helper service exposed an HTTP interface that passed user-controlled file and target paths to a mount operation without validating them, letting an unprivileged user mount attacker content over sensitive paths.

Impact

An attacker with code execution in a function could escalate to root and run commands on the Docker host, but Microsoft stated the host is protected by a Hyper-V boundary and that the issue has no security impact on Azure Functions users.

What the attacker needed

Ability to upload function code; outbound access to attacker server; public Docker Hub image available

The fix

Microsoft did not treat it as a security fix but made changes to block the /etc and /sys directories, which had already been deployed.

How it was found

  1. Upload a function containing a reverse shell and connect back to get an interactive shell as the unprivileged app user.
  2. Add tools such as nmap to the function package, reupload it, and scan localhost to find open ports.
  3. Read network-related /proc files to map each open port to the process that owns it.
  4. Download the public Docker Hub image, extract the Mesh init binary, and reverse engineer it to find the HTTP paths and variables that invoke the mount functions.
  5. Build a squashfs image containing a sudoers file that grants the app user root, include it in the function, and instruct the server to mount it over the sudoers directory.
  6. With root, read the process capability bitmap and use a cgroup-based technique to run a command on the Docker 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.

Azure Functions lets you upload small pieces of code that Microsoft runs for you inside a container, which is a sealed-off box on a shared machine. The researchers showed that a hidden helper program inside that box would happily mount a file system image you provide at any location you name, including the place that decides who is allowed to become the all-powerful root user. From root they could reach the machine hosting the container, though Microsoft argued a further virtual machine boundary kept other customers safe.

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.

More by Intezer

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.

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.