Skip to content
Access control Write-up Advanced

Royal Flush: Privilege Escalation Vulnerability in Azure Functions

Azure Functions containers ran with the --privileged Docker flag, and device files in /dev had world-readable and writable permissions, allowing an unprivileged user to read and write the Docker host's filesystem. An attacker could edit arbitrary host files, such as /etc/passwd, and potentially execute code on the Docker host, though Microsoft stated this had no security impact because the host was a Hyper-V guest with an additional sandboxing layer.

intezer.com

Published on intezer.com

One of the most common benefits of transitioning to cloud services is the shared responsibility for securing your assets. But cloud providers are not immune to security mistakes such as a vulnerability or misconfiguration.

The author, 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

The container was run with the --privileged flag and the device files in /dev had 'rw' permissions for 'others', allowing an unprivileged user to access the host's disk.

Impact

An attacker could edit arbitrary files on the Docker host and potentially execute malicious code there, but Microsoft assessed that this had no security impact because the Docker host was a Hyper-V guest protected by an additional sandboxing layer.

What the attacker needed

Access to an Azure Functions container; low-privileged user account inside the container

The fix

The text does not state a fix; the issue was reported to Microsoft, who determined it had no security impact due to an additional sandboxing layer.

How it was found

  1. Access the Azure Functions container as the low-privileged app user.
  2. Identify the device file for the Docker host's root filesystem (e.g., /dev/sda5) with world read/write permissions.
  3. Use debugfs to read and write to the host's filesystem through the device file.
  4. Create a hard link via debugfs into the container's diff directory to make changes visible.
  5. Use posix_fadvise to flush the kernel's read cache so changes to the device file propagate to the host's view of files.
  6. Edit /etc/ld.so.preload and serve a malicious shared object to achieve code execution 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.

Containers are meant to keep programs isolated, like separate rooms in a building. Here, the container was given extra privileges and its device files were accessible to any user, so someone inside the container could reach out and change files on the underlying host machine. That could let them run their own code on the host, although Microsoft said another layer of protection prevented real harm.

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.