Totolink X2000R boa formUpload() heap-based buffer overflow vulnerability
A heap-based buffer overflow exists in the get_filename_from_buf function of the Totolink X2000R router's boa web server, where a filename from a multipart upload is copied without a length limit into a global buffer. An authenticated attacker can send a crafted HTTP request to overwrite the heap and potentially achieve arbitrary code execution.
Originally disclosed on Cisco Talos
A heap-based buffer overflow vulnerability exists in the boa formUpload() 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 get_filename_from_buf function uses strncpy with a length derived from the input filename itself, copying an unbounded amount of data into a fixed-size global buffer.
Impact
An authenticated attacker could overwrite the entire process heap and potentially achieve arbitrary code execution.
What the attacker needed
Authenticated access to the web interface; device in easy mesh mode
How it was found
- Authenticate to the router's web interface via the login form.
- Send an HTTP POST request to the formUpload endpoint with a multipart body containing a crafted filename.
- Ensure the device is in easy mesh mode, or enable it via other requests.
- The filename is copied without bounds into the global upload_filename buffer, overflowing into the heap.
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.
This router's web interface lets you upload files, and it reads the filename you provide. The code copies that filename into a fixed-size memory area without checking how long it is, so a very long filename spills over into other memory. An attacker who is already logged in could use this to crash the router or possibly run their own code on it.
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.