Remote Code Execution Vulnerability on Huawei Devices
Jan 17, 2018
On November 27, 2017, Juniper Threat Labs discovered a severe vulnerability in select Huawei devices that was being exploited in the wild. This vulnerability gives an attacker remote code execution capability. After due analysis and confirming this was not a previously known vulnerability, Juniper disclosed the issue to Huawei on November 29 and waited for Huawei to provide a patch for the vulnerability. This vulnerability has been since labeled as CVE-2017-17215. Huawei confirmed that Check Point Software Technologies independently notified them of the same vulnerability.The devices concerned are listed on Huawei’s web site at http://www.huawei.com/en/psirt/security-notices/huawei-sn-20171130-01-hg532-en.
Based on our observations, the beginning of this attack coincided with the U.S. Thanksgiving holiday on November 23. Usually holidays are a prime target for cyber attacks as more people browse the web and fewer security professionals are monitoring the networks.
The attack seemed to target Huawei’s ADSL routers. It used a specific HTTP POST command and parameters to trigger execution of a shell command on the UPnP port of the device. This zero-day vulnerability was used to run a script that downloads a payload from a hardcoded IP address and executes it.
Below is a capture that took place on November 23, 2017 at 2:33:58 AM.
These attacks, as there were many of them, all originated from three IP addresses:
These IP addresses were scanning internet-facing IPs on port 37215 and attempting the POST command below:
As you can see from the capture above, the CnC server is hosted on 18.104.22.168.
We obtained three different payloads from this site. All are Linux binaries that seem to be Mirai-related. One binary has zero VT detections, while the second had one initial detections, and the third had two initial detections (then six after rescan).
When executed, these binaries connect to their CnC at control.almashosting[.]ru, which happens to resolve to the same IP address as the original download site at 172.93.97[.]219.
To protect your devices from this type of attack, you should follow the below protocols:
If not required, do not expose an open port 37215 to the internet. The easiest way is to disable UPnP on Huawei devices.
Apply a patch from Huawei.
Additional mitigation steps are listed on Huawei’s security advisory page mentioned above.