Wavlink AC3000 adm.cgi set_wzdgw4G() buffer overflow vulnerability
A stack-based buffer overflow exists in the set_wzdgw4G function of the adm.cgi binary on the Wavlink AC3000 router. An authenticated attacker can send a crafted HTTP request with an overly long wlan_ssid2 parameter to overwrite the return address and potentially execute arbitrary code.
Originally disclosed on Cisco Talos
A buffer overflow vulnerability exists in the adm.cgi setwzdgw4G() functionality of Wavlink AC3000 M33A8.V5030.210505. A specially crafted HTTP request can lead to stack-based buffer overflow.
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 set_wzdgw4G function uses sprintf to copy the user-controlled wlan_ssid2 parameter into a fixed-size stack buffer without any length validation.
Impact
An authenticated attacker could achieve arbitrary code execution on the device, potentially leading to full compromise.
What the attacker needed
Valid session cookie (authenticated)
The fix
The vulnerability should be fixed by adding proper length validation before copying the user-supplied input into the stack buffer.
How it was found
- Log in to the router's web interface to obtain a valid session cookie.
- Send an HTTP POST request to adm.cgi with page=wzdgw4G and a wlan_ssid2 parameter longer than 0xa0 bytes.
- The set_wzdgw4G function copies the parameter into a stack buffer, overflowing it and overwriting the return address.
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 area than it can hold, causing adjacent memory to be overwritten. Here, the router's web server takes a user-supplied value and copies it into a small stack buffer without checking its length, allowing an attacker to control the program's execution flow.
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.