Skip to content
Access control Write-up Intermediate

Escalating Privileges with Azure Function Apps

Undocumented Azure Function App VFS APIs allowed users with Reader role to read arbitrary files from Function App containers, including ASP.NET encryption keys on Windows and function master keys on Linux. On Linux, the master key could be used to overwrite function code and achieve command execution in the container.

Karl Fosaaen Follow

Published on netspi.com

Technical / Cloud Pentesting

Karl Fosaaen, on netspi.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 access control flaw in the undocumented VFS API that did not properly restrict file system access for users with only Reader permissions.

Impact

An attacker with Reader role could read sensitive files and, on Linux containers, overwrite function code to gain command execution and potentially access managed identities; Microsoft restricted the API for Reader role after remediation.

What the attacker needed

Reader role on a Function App; Linux container for RCE

The fix

Microsoft restricted the vulnerable API for the Reader role.

How it was found

  1. Start as a user with the Reader role on a Function App.
  2. Use the undocumented VFS API to list files in the Function App.
  3. Change the relativePath parameter from 1 to 0 to access the container's file system.
  4. On Linux, read the environ file from a process to get environment variables.
  5. Use the variables to access and decrypt configuration data from a SAS token URL.
  6. Use the exposed master key to overwrite the function code and execute commands.

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 Function Apps are small pieces of code that run in the cloud. The report found that a user with only 'Reader' permission (normally just allowed to view things) could use a hidden web address to read any file inside the container where the function runs. On Linux, this included a secret key that let the attacker replace the function's code and run commands on the server.

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 Karl Fosaaen

View all

2 more disclosed reports, best first.

More from Microsoft (Azure)

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.