Exploiting embedded mitel phones for unauthenticated remote code execution
The Mitel IP phone web server had an authentication bypass allowing unauthenticated POST requests, and a buffer overflow in a hidden POST handler for setting the MAC address. An attacker could chain these to achieve unauthenticated remote code execution as root.
Published on baldur.dk
This post details the process of going from absolutely nothing to achieving a fully unauthenticated remote code execution exploit as root in a Mitel IP phone. We've discovered several zero-days which chained together gives the privilege of completely owning the phone.
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 the web server's authentication check only applied to GET requests, and a POST handler used unsafe string functions (strcat/strcpy) without bounds checking.
Impact
An attacker on the network could execute arbitrary commands as root on the phone without authentication, potentially bricking the device or using it as a foothold.
What the attacker needed
Network access to the phone's web interface; no authentication required
The fix
The vulnerabilities were fixed by Mitel, as indicated by the security advisories.
How it was found
- Send a GET request to /favicon.ico to renew the session timer without authentication.
- Send an unauthenticated POST request to /sysinfo.html with a crafted 'mac' parameter.
- The 'mac' parameter overflows a stack buffer, overwriting the return address.
- Use a pointer to the EXTERNAL segment to survive the free() call.
- Use a ROP chain to set r0 to point to a command string and call system().
- The command executes as root, allowing arbitrary actions like downloading and running a script.
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.
The phone's web interface was supposed to require a password for all actions, but the check was missing for some requests. A hidden feature that sets the phone's MAC address had a bug that let an attacker write too much data and take control of the phone, running commands as the root user.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.