Yifan YF325 libutils.so nvram_restore stack-based buffer overflow vulnerability
A stack-based buffer overflow in the nvram_restore function of libutils.so allows an unauthenticated attacker to send a crafted network request that overflows a 128-byte buffer with a key length up to 255, potentially leading to code execution.
Originally disclosed on Cisco Talos
A stack-based buffer overflow vulnerability exists in the libutils.so nvramrestore functionality of Yifan YF325 v1.020221108. A specially crafted network request can lead to a 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
Impact
An unauthenticated attacker could exploit this to cause a buffer overflow, potentially leading to arbitrary code execution with high confidentiality, integrity, and availability impact.
What the attacker needed
Network access to the router's web interface; no authentication required
The fix
The vulnerability was fixed by the vendor in a patch release.
How it was found
- Send a network request to the nvram.cgi endpoint with a specially crafted file upload.
- The uploaded file contains an entry with a key length greater than 128 bytes.
- The parse_nvram_file function writes the file to /tmp/restore.bin and calls nvram_restore.
- nvram_restore reads the key length and copies that many bytes into a 128-byte stack buffer, causing an 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.
This router has a function that restores settings from an uploaded file. The function reads a length value from the file and then copies that many bytes into a fixed-size buffer on the stack. Because the length can be larger than the buffer, an attacker can overflow it and potentially take control of the device.
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.