Totolink X2000R Mcli stack-based buffer overflow vulnerability
A stack-based buffer overflow exists in the Mcli binary of the Totolink X2000R router because user-supplied device MAC parameters are copied without length checks. An authenticated attacker can send a crafted HTTP request to trigger the overflow and potentially execute arbitrary code.
Originally disclosed on Cisco Talos
A stack-based buffer overflow vulnerability exists in the Mcli functionality of X2000R (version(s): TOTOLINK-X2000R-Gh-V1.0.0-B20250421.1327). A specially crafted HTTP request can lead to arbitrary code execution.
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The Mcli binary uses strcpy to copy user-controlled devicemac parameters into fixed-size stack buffers without any length validation.
Impact
An authenticated attacker could achieve arbitrary code execution on the router, potentially leading to full compromise.
What the attacker needed
Authentication to the web interface; device in easy mesh mode or ability to set it; crafted HTTP request with long devicemac values
How it was found
- Authenticate to the router's web interface via the login page.
- Send an HTTP POST request to the formUpload endpoint with a valid firmware file and set the deviceNum parameter to control the loop count.
- Include enable%d and devicemac%d parameters for each iteration, where devicemac%d contains an overly long value.
- Ensure the device is in easy mesh mode or set that configuration via other HTTP requests.
- The formUpload handler builds an Mcli command string and executes it via system().
- The Mcli binary copies the devicemac values into stack buffers with strcpy, causing a buffer overflow.
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 report has not been written yet. The Original tab links to the source.
A buffer overflow happens when a program copies more data into a fixed-size memory space than it can hold, causing the extra data to spill over and corrupt nearby memory. Here, the router's Mcli program copies device MAC address values from an HTTP request into small stack buffers without checking their length, so an attacker who is already logged in can send overly long values and overwrite the program's control flow, potentially running their own code.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.