Skip to content
Race condition Write-up Advanced

Azure Synapse: Local Privilege Escalation Vulnerability in Spark

A local privilege escalation in Azure Synapse's Apache Spark pool allowed a low-privileged user to exploit a race condition in a mount script to gain root access. The attacker could then read sensitive files and access the instance metadata service.

Tzah Pahima Follow

Published on orca.security

Azure Synapse Analytics is an analytics service that processes data using various types of runtimes: SQL pools, Apache Spark, Data Explorer, and different types of integration runtimes. Over the past year, the Orca Research Pod has disclosed a series of vulnerabilities and tenant separation issues regarding the…

Tzah Pahima, on orca.security

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 a time-of-check to time-of-use race condition: the script validated the mount point path, but between validation and the chown operation, an attacker could replace the path with a symbolic link to a privileged directory.

Impact

The attacker could gain root access on the Spark pool VM, read sensitive files including credentials, and access the instance metadata service, though the credentials themselves were not very interesting.

What the attacker needed

Access to a Spark pool; ability to run code in the pool

The fix

Microsoft disabled the vulnerable API feature and later deployed a patched version.

How it was found

  1. Run a Python reverse shell in the reserved Spark pool.
  2. Discover that the trusted-service-user can run filesharemount.sh as root via sudo.
  3. Supply a mount point under /synfs that does not exist.
  4. Race to create a symbolic link from that mount point to /usr/lib/notebookutils/bin before the script performs mkdir and chown.
  5. Edit the filesharemount.sh script to execute arbitrary commands as root.

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 race condition is when a program checks something and then uses it, but an attacker can change it in between. Here, a script checked that a folder was safe to mount, but the attacker swapped it for a link to a sensitive folder before the script changed ownership, letting them edit a root-run script and become root.

What is Race condition?

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

More by Tzah Pahima

View all

1 more disclosed report, 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.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.