Facebook Google Plus Twitter LinkedIn YouTube RSS Menu Search Resource - BlogResource - WebinarResource - ReportResource - Eventicons_066 icons_067icons_068icons_069icons_070

Command Injection Vulnerability in /bin/protest Binary on Multiple D-Link Routers

Medium

Synopsis

Command Injection in /bin/protest

AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H (7.8/7.1)

The /bin/protest binary on various D-Link router firmware images is vulnerable to command injection. This allows an authenticated attacker to execute arbitrary shell commands as root, and can easily be used to obtain a root shell on the device.

In order to exploit this vulnerability, we first need to obtain access to the /bin/cli interface over telnet. In order to access this interface on the DIR-2640, we must first:

  1. download the router's configuration binary
  2. decrypt and unpack that binary using D-Link's own mkconfig binary, which can be found on several of their firmware images
  3. set the telnetEnabled field in config_2g to 1
  4. repack and re-encrypt the config file using the same tool
  5. upload the modified config through the router's web interface
  6. connect to the router over telnet on port 23

We will then be prompted for a password. The password will be the one set as the admin password for the web UI followed by the suffix @twsz2018.

This will take us to the "router> " prompt.

The command injection vulnerability can then be triggered with the following input:

protest --fota -client_secret -w ;telnetd\${IFS}-b0.0.0.0:4444\${IFS}-l\${IFS}/bin/sh\${IFS} 

This will launch a telnet shell, listening on port 4444, which may then be accessed without providing any further authentication.

Demonstration of Vulnerability on DIR-2640 Firmware Version 1.11B2

We have established that this vulnerability exists on the DIR-2640 router, running firmware version 1.11B2, as shown in the animated GIF below.

By running tests in a series of virtual environments, I have also been able to establish, with reasonable confidence, that the router models and firmware versions indicated in this advisory are affected by this command injection vulnerability.

Those images were tested the following fashion:

  1. First, the firmware image was unpacked (and decrypted, if necessary), and the root file system isolated.
  2. I then checked for a binary named protest was found on the filesystem. If no such binary was found, then the image was ignored.
  3. I would then ensure that the cli binary was present as well, and that the protest functionality could be triggered from the cli interface.
  4. Using a QEMU emulator for the appropriate architecture, I executed the cli binary inside a chroot jail, restricted to the firmware image's root filesystem, under supervision by strace, and fed the cli process a payload similar to the one shown above. The injected command, however, was set to /VULNERABLE.
  5. I then inspected the strace output to see if a system call beginning with execve("/VULNERABLE" had taken place. If it had, this meant that command injection was possible on that build of protest, exposed through the cli interface.

Disclosure Timeline

December 28, 2021: Vendor notified
December 28, 2021: Vendor responds, requesting further details
December 28, 2021: Tenable responds to vendor, with additional details
December 28, 2021: Issue forwarded to vendor's R&D department
February 7, 2022: Tenable contacts vendor with additional information
February 8, 2022: Vendor acknowledges

All information within TRA advisories is provided “as is”, without warranty of any kind, including the implied warranties of merchantability and fitness for a particular purpose, and with no guarantee of completeness, accuracy, or timeliness. Individuals and organizations are responsible for assessing the impact of any actual or potential security vulnerability.

Tenable takes product security very seriously. If you believe you have found a vulnerability in one of our products, we ask that you please work with us to quickly resolve it in order to protect customers. Tenable believes in responding quickly to such reports, maintaining communication with researchers, and providing a solution in short order.

For more details on submitting vulnerability information, please see our Vulnerability Reporting Guidelines page.

If you have questions or corrections about this advisory, please email [email protected]

Risk Information

CVE ID: CVE-2022-1262
Tenable Advisory ID: TRA-2022-09
Credit:
Olivia Lucca Fraser
CVSSv3 Base / Temporal Score:
7.8/7.1
CVSSv3 Vector:
AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H
Affected Products:
DIR-1360 A1 firmware version 1.02B03
DIR-1360 A1 firmware version 1.03B02
DIR-1360 A1 firmware version 1.11B04
DIR-1360 firmware version 1.00B15
DIR-1360 firmware version 1.01B03
DIR-1360 firmware version 1.11B04 Beta for WPA2 2020/11/03
DIR-1760 firmware version 1.01B04
DIR-1760 firmware version 1.11B03 Beta for WPA2 2020/11/03
DIR-1960 A1 firmware version 1.02B01
DIR-1960 A1 firmware version 1.03B03
DIR-1960 A1 firmware version 1.11B03
DIR-1960 firmware version 1.11B03 Beta for WPA2 2020/11/03
DIR-2640 A1 firmware version 1.01B04
DIR-2640 A1 firmware version 1.11B02
DIR-2640 firmware version 1.11B02 Beta for WPA2 2020/11/03
DIR-2660 A1 firmware version 1.04B03
DIR-2660 A1 firmware version 1.11B04
DIR-2660 firmware version 1.00B14
DIR-2660 firmware version 1.01B03
DIR-2660 firmware version 1.02B01
DIR-2660 firmware version 1.03B04
DIR-2660 firmware version 1.11B04 Beta for WPA2 2020/11/03
DIR-3040 A1 firmware version 1.11B02
DIR-3040 A1 firmware version 1.12B01
DIR-3040 A1 firmware version 1.13B03
DIR-3040 A1 firmware version 1.20B03
DIR-3040 firmware version 1.13B03 Beta for WPA2 2020/11/03
DIR-3060 A1 firmware version 1.01B07
DIR-3060 A1 firmware version 1.02B03
DIR-3060 A1 firmware version 1.11B02 Beta for Guest zone connect issue 2020/01/19
DIR-3060 A1 firmware version 1.11B04
DIR-3060 firmware version 1.00B12
DIR-3060 firmware version 1.11B04 Beta for WPA2 2020/11/03
DIR-867 A1 firmware version 1.20B10
DIR-867 firmware version 1.10B04
DIR-867 firmware version 1.30B07
DIR-878 firmware version 1.20B05
DIR-878 firmware version 1.30B08
DIR-882 A1 firmware version 1.30B06
DIR-882 A1 firmware version 1.30B10
DIR-882 firmware version 1.20B06
Risk Factor:
Medium
Additional Keywords:
router
command injection

Advisory Timeline

April 6, 2022: Advisory Published

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Try Tenable Web App Scanning

Enjoy full access to our latest web application scanning offering designed for modern applications as part of the Tenable One Exposure Management platform. Safely scan your entire online portfolio for vulnerabilities with a high degree of accuracy without heavy manual effort or disruption to critical web applications. Sign up now.

Your Tenable Web App Scanning trial also includes Tenable Vulnerability Management and Tenable Lumin.

Buy Tenable Web App Scanning

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

5 FQDNs

$3,578

Buy Now

Try Tenable Lumin

Visualize and explore your exposure management, track risk reduction over time and benchmark against your peers with Tenable Lumin.

Your Tenable Lumin trial also includes Tenable Vulnerability Management and Tenable Web App Scanning.

Buy Tenable Lumin

Contact a Sales Representative to see how Tenable Lumin can help you gain insight across your entire organization and manage cyber risk.

Try Tenable Nessus Professional Free

FREE FOR 7 DAYS

Tenable Nessus is the most comprehensive vulnerability scanner on the market today.

NEW - Tenable Nessus Expert
Now Available

Nessus Expert adds even more features, including external attack surface scanning, and the ability to add domains and scan cloud infrastructure. Click here to Try Nessus Expert.

Fill out the form below to continue with a Nessus Pro Trial.

Buy Tenable Nessus Professional

Tenable Nessus is the most comprehensive vulnerability scanner on the market today. Tenable Nessus Professional will help automate the vulnerability scanning process, save time in your compliance cycles and allow you to engage your IT team.

Buy a multi-year license and save. Add Advanced Support for access to phone, community and chat support 24 hours a day, 365 days a year.

Select Your License

Buy a multi-year license and save.

Add Support and Training

Try Tenable Nessus Expert Free

FREE FOR 7 DAYS

Built for the modern attack surface, Nessus Expert enables you to see more and protect your organization from vulnerabilities from IT to the cloud.

Already have Tenable Nessus Professional?
Upgrade to Nessus Expert free for 7 days.

Buy Tenable Nessus Expert

Built for the modern attack surface, Nessus Expert enables you to see more and protect your organization from vulnerabilities from IT to the cloud.

Select Your License

Buy a multi-year license and save more.

Add Support and Training