Overview

D-Link DIR-853 A1 FW1.20B07 was discovered to contain a command injection vulnerability in the SetVirtualServerSettings module.

屏幕截图 2025-01-20 095036.png

Vulnerability details

The vulnerability is in the SetVirtualServerSettings module of prog.cgi.

屏幕截图 2025-01-20 094710.png

When the value of the request field "Enable" is set to "true", the value of the request field "InternalPort" is set to "9", and the value of the request field "ProtocolType" is set to "UDP", then the value of the request field "LocalIPAddress" can be passed to function sub_456CD0 and be part of the string which is executed by function FCGI_popen.

屏幕截图 2025-01-20 094802.png

Attack

After logging into the service's website, chose "Virtual Server" to add a new rule.

image.png

Set the value of "Internal Port" to "9" and the value of "Protocol" to "UDP", then catch the HTTP request packet sent when clicking on the save button.

image.png

When modifying the value of the request field "LocalIPAddress" from "xxx.xxx.xxx.xxx" to "xxx.xxx.xxx.xxx | command", the service will execute the command.

屏幕截图 2025-01-20 095321.png

For example, when modifying it to "xxx.xxx.xxx.xxx | telnetd -l /bin/sh -p 2333 -b 0.0.0.0", an open port 2333 with shell access can be opened.

屏幕截图 2025-01-20 095448.png

屏幕截图 2025-01-20 095620.png