Totolink X2000R boa formUploadFile stack-based buffer overflow vulnerability
A stack-based buffer overflow exists in the formUploadFile function of the Totolink X2000R router's boa web server. An authenticated attacker can send a specially crafted HTTP request with an overly long filename in a multipart form to overwrite the stack and potentially execute arbitrary code.
Originally disclosed on Cisco Talos
A stack-based buffer overflow vulnerability exists in the boa formUploadFile 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 formUploadFile function uses sprintf to copy a user-controlled filename into a fixed-size stack buffer without any length limit.
Impact
An authenticated attacker could achieve arbitrary code execution on the router, potentially leading to full compromise.
What the attacker needed
Authenticated access to the web interface
How it was found
- Authenticate to the router's web interface via the /boafrm/formLogin page.
- Send a multipart form data request to /boafrm/formUploadFile containing a file with a valid firmware header.
- Include an overly long filename in the multipart form data.
- The filename is copied into a fixed-size stack buffer, 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.
The router's web interface has a file upload feature that copies the uploaded file's name into a fixed-size memory area without checking its length. By sending a very long filename, an attacker can overflow that area and overwrite nearby memory, which can crash the router or let the attacker run their own code. The attacker must already be logged in to the router's web interface.
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.