CVE-2020-16995: Microsoft Azure Network Watcher Linux Extension EoP
The Azure Network Watcher Agent for Linux ran a script from a predictable /tmp path as root on startup, and that file did not exist by default. Any local user could create the file with their own commands and have them executed as root after a reboot.
intezer.com
Published on intezer.com
In our last blog post we disclosed an escalation of privileges vulnerability in Microsoft Azure App Services. In this post, we’ll describe a similar vulnerability that we found in one of Microsoft’s official Azure VM extensions, known as the Azure Network Watcher Agent for Linux.
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 leftover development code caused the agent to execute a file from a world-writable temporary directory with root privileges.
Impact
Any local user could gain root privileges on the Azure virtual machine, but the exploit required a system reboot and a narrow timing window.
What the attacker needed
Local unprivileged account on the VM; ability to create systemd user services; system reboot
The fix
The extension was fixed so it no longer runs a file from the temporary directory.
How it was found
- Create a systemd user service that starts before the network target.
- Have that service create the expected file in the temporary directory with commands that add the user to sudoers.
- Reboot the system so the agent runs the file as root.
- Use sudo to escalate to 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 background service that starts when the machine boots was running a file from a shared temporary folder as the all-powerful root user. That file was not supposed to be there, so any normal user could put their own file in its place. After a restart, the service would run the user's file with full control of the machine.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.