Skip to content
Memory corruption Advisory Advanced CVE-2023-34365

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.

Francesco Benvenuto Follow

Originally disclosed on Cisco Talos

Critical 9.8 View original

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.

Francesco Benvenuto, on Cisco Talos

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

  1. Send a network request to the nvram.cgi endpoint with a specially crafted file upload.
  2. The uploaded file contains an entry with a key length greater than 128 bytes.
  3. The parse_nvram_file function writes the file to /tmp/restore.bin and calls nvram_restore.
  4. 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.

More by Francesco Benvenuto

View all

152 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.