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.
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…
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
- Run a Python reverse shell in the reserved Spark pool.
- Discover that the trusted-service-user can run filesharemount.sh as root via sudo.
- Supply a mount point under /synfs that does not exist.
- Race to create a symbolic link from that mount point to /usr/lib/notebookutils/bin before the script performs mkdir and chown.
- 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.