Yifan YF325 httpd gwcfg.cgi get stack-based buffer overflow vulnerability
The router's httpd gwcfg.cgi get handler reads request body data into a fixed-size stack buffer using the attacker-supplied Content-Length without checking it against the buffer size. A remote, unauthenticated attacker can send a crafted request to overflow the buffer and potentially execute commands.
Originally disclosed on Cisco Talos
A stack-based buffer overflow vulnerability exists in the httpd gwcfg.cgi get functionality of Yifan YF325 v1.020221108. A specially crafted network packet can lead to command 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 handler reads the request body using the client-supplied Content-Length into a fixed-size stack buffer without validating the length against the buffer size.
Impact
An unauthenticated remote attacker could achieve command execution on the device; the text states this as a consequence of the overflow.
What the attacker needed
Network access to the router's web interface; no authentication needed
The fix
The handler should validate the supplied Content-Length against the size of the destination buffer before reading, and the vendor released a patch.
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 is a small reserved area of memory. The router copies incoming request data into a fixed-size buffer but trusts a length value supplied by the sender, so sending more data than the buffer holds spills over into nearby memory. That can crash the device or let an attacker run their own commands 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.