Advisory Details

September 7th, 2023

D-Link DIR-3040 prog.cgi SetWLanRadioSecurity Stack-Based Buffer Overflow Remote Code Execution Vulnerability

ZDI-23-1329
ZDI-CAN-21621

CVE ID CVE-2023-41221
CVSS SCORE 6.8, AV:A/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
AFFECTED VENDORS D-Link
AFFECTED PRODUCTS DIR-3040
VULNERABILITY DETAILS

This vulnerability allows network-adjacent attackers to execute arbitrary code on affected installations of D-Link DIR-3040 routers. Authentication is required to exploit this vulnerability.

The specific flaw exists within the prog.cgi binary, which handles HNAP requests made to the lighttpd webserver listening on TCP ports 80 and 443. The issue results from the lack of proper validation of a user-supplied string before copying it to a fixed-size stack-based buffer. An attacker can leverage this vulnerability to execute code in the context of root.

ADDITIONAL DETAILS D-Link has issued an update to correct this vulnerability. More details can be found at:
https://supportannouncement.us.dlink.com/announcement/publication.aspx?name=SAP10350
DISCLOSURE TIMELINE
  • 2023-07-12 - Vulnerability reported to vendor
  • 2023-09-07 - Coordinated public release of advisory
CREDIT Peter Girnus, Nicholas Zubrisky
BACK TO ADVISORIES