China-linked APT Mustang Panda targets TP-Link routers with a custom firmware implant

China-linked APT group Mustang Panda employed a custom firmware implant targeting TP-Link routers in targeted attacks since January 2023.

Since January 2023, Check Point Research monitored a series of targeted attacks aimed at European foreign affairs entities that have been linked to the China-linked cyberespionage group Mustang Panda (aka Camaro Dragon, RedDelta or “Bronze President).

MustangPanda has been active since at least 2012, it targeted American and European entities such as government organizations, think tanks, NGOs, and even Catholic organizations at the Vatican. Past campaigns were focused on Asian countries, including Taiwan, Hong Kong, Mongolia, Tibet, and Myanmar. In 2022 campaigns, threat actors used European Union reports on the conflict in Ukraine and Ukrainian government reports as lures. Upon opening the reports, the infection process starts leading to the deployment of malware on the victim’s system.

In most recent attacks observed by Check Point, the threat actors employed custom firmware implant designed explicitly for TP-Link routers.

The implant includes multiple components, such as a custom backdoor dubbed “Horse Shell” that allows attackers to maintain persistence, build anonymous infrastructure and enable lateral movement into compromised networks.

The Horse Shell backdoor is inserted into the modified firmware by the attackers, due to its firmware-agnostic design, it can be used to target various firmware by different vendors.

The backdoor supports the following main functionalities:

  • Remote shell — Execution of arbitrary shell commands on the infected router
  • File transfer — Upload and download files to and from the infected router.
  • SOCKS tunneling — Relay communication between different clients.

The researchers have yet to discover the deployment method of the firmware images on the infected routers. The attackers likely gain access to the devices by exploiting known vulnerabilities or brute-forcing devices using default or weak and easily guessable passwords.

Experts believe the goal of the threat is the creation of a chain of nodes between main infections and real C2, and they do this by installing the backdoor on arbitrary devices with no particular interest, including residential and home networks.

“The TP-Link router, like many routers, has a web interface that allows its users to configure the router and manage it. One of the features of the management website provides the user with the option to manually upgrade their device’s firmware version. The web form for uploading a new firmware exists in SoftwareUpgradeRpm.htm.” This page, on the original and legitimate firmware we obtained from the official TP-Link website, is shown in the image below.” reads the report published by Check point. “However, in the modified version of the firmware we obtained, a small CSS property was inline added to the HTML form. This property, display:none, will hide the form from a user entering the page. Hiding the form, will not remove it or the feature from the HTML itself, so users can technically still manually upgrade their firmware version. Although now, it will be harder to perform the upgrade or even know that this feature exists.”

Mustang Panda TP-Link router

SoftwareUpgradeRpm.htm as shown in the original interface

The malicious image hides from a user the ability to flash another firmware image

The Horse Shell component communicates with its peers and server on a port specified for each of them individually. The default port for communication is 80. The component uses HTTP communication with hard-coded HTTP headers. The communications are encrypted using a custom or modified encryption scheme that is based on Substitution-Permutation Network. Horse Shell is able to communicate with numerous peers simultaneously.

The communication between infected routers relies on SOCK tunneling to obscure the origin and destination of the traffic.

The network is resilient to take down or compromise of a single in the chain because the traffic is routed through a different node in the chain.

“our discovery of the firmware-agnostic nature of the implanted components indicates that a wide range of devices and vendors may be at risk.” concludes the report.

We are in the final!

Please vote for Security Affairs (https://securityaffairs.com/) as the best European Cybersecurity Blogger Awards 2022 – VOTE FOR YOUR WINNERS
Vote for me in the sections where is reported Securityaffairs or my name Pierluigi Paganini

Please nominate Security Affairs as your favorite blog.

Nominate Pierluigi Paganini and Security Affairs here here: https://docs.google.com/forms/d/e/1FAIpQLSepvnj8b7QzMdLh7vWEDQDqohjBUsHyn3x3xRdYGCetwVy2DA/viewform

Follow me on Twitter: @securityaffairs and Facebook and Mastodon

Pierluigi Paganini

(SecurityAffairs – hacking, Zelensky)

The post China-linked APT Mustang Panda targets TP-Link routers with a custom firmware implant appeared first on Security Affairs.

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to our Newsletter