Authenticated command injection in multiple Ubiquiti Networks products

Title

Authenticated Command Injection

Product

Multiple Ubiquiti Networks products e.g. see Vulnerable / tested versions

Vulnerable Version

v1.3.3 (SW), v5.6.9/v6.0 (XM)

Fixed Version

-

CVE Number

-

Impact

critical

Found

22.11.2016

By

Thomas Weber (Office Vienna) | SEC Consult Vulnerability Lab

The firmware of various Ubiquiti Networks devices contains a command injection vulnerability which can be exploited by luring an authenticated user to click on a malicious link or surf to a malicious website. Low privileged users can elevate their rights and use the vulnerability for further attacks.

Vendor description:
-------------------
"Ubiquiti Networks develops high-performance networking 
technology for service providers and enterprises. Our technology 
platforms focus on delivering highly advanced and easily deployable 
solutions that appeal to a global customer base in underserved and 
underpenetrated markets."

Source: ir.ubnt.com


Business recommendation:
------------------------
SEC Consult recommends not to use this product in a production environment
until a thorough security review has been performed by security
professionals and all identified issues have been resolved.


Vulnerability overview/description:
-----------------------------------
1) Command Injection in Admin Interface
A command injection vulnerability was found in "pingtest_action.cgi".
This script is vulnerable since it is possible to inject a value of a 
variable. One of the reasons for this behaviour is the used PHP version 
(PHP/FI 2.0.1 from 1997). 

The vulnerability can be exploited by luring an attacked user to click 
on a crafted link or just surf on a malicious website. The whole attack 
can be performed via a single GET-request and is very simple since there 
is no CSRF protection. See our other advisory published in January 2017:

sec-consult.com/vulnerability-lab/advisory/xss-csrf-vulnerabilities-in-multiple-ubiquiti-networks-products/


 

An attacker can open a port binding or reverse shell to connect to the 
device and is also able to change the "passwd" since the web service
runs with root privileges!

Furthermore, low privileged read-only users, which can be created in the web
interface, are also able to perform this attack.

If the Ubiquiti device acts as router or even as firewall, the attacker 
can take over the whole network by exploiting this vulnerability.


Proof of concept:
-----------------
1) Command Injection in Admin Interface
The following link can be used to open a reverse shell to the attacker's
IP address. There are two possibilities for the different firmware 
versions.
Reverse root shell - firmware: v1.3.3 (SW)
[ PoC removed - no patch available ]

Reverse root shell - firmware: v5.6.9/v6.0 (XM)
[ PoC removed - no patch available ]
 

Vulnerable / tested versions:
-----------------------------
The following devices and firmware versions have been tested/verified:
TS-8-PRO                     - v1.3.3 (SW) 
(Rocket) M5                  - v5.6.9/v6.0 (XM)
(PicoStationM2HP) PICOM2HP   - v5.6.9/v6.0 (XM)
(NanoStationM5) NSM5         - v5.6.9/v6.0 (XM)

Based on information embedded in the firmware of other Ubiquiti products
gathered from our IoT Inspector tool we believe the following devices are
affected as well:

Ubiquiti Networks AF24 (Version: AF24 v3.2)
Ubiquiti Networks AF24HD (Version: AF24 v3.2)
Ubiquiti Networks AF-2X (Version: AF2X v3.2 )
Ubiquiti Networks AF-3X (Version: AF3X v3.2)
Ubiquiti Networks AF5 (Version: AF5 v3.2)
Ubiquiti Networks AF5U (Version: AF5 v3.2)
Ubiquiti Networks AF-5X (Version: AF5X v3.2.1)
Ubiquiti Networks AG-PRO-INS (Version: AirGWP v1.1.7)
Ubiquiti Networks airGateway (Version: AirGW v1.1.7)
Ubiquiti Networks airGateway-LR (Version: AirGW v1.1.7)
Ubiquiti Networks AMG-PRO (Version: AirGWP v1.1.7)
Ubiquiti Networks LBE-5AC-16-120 (Version: WA v7.2.4)
Ubiquiti Networks LBE-5AC-23 (Version: WA v7.2.4)
Ubiquiti Networks LBE-M5-23 (Version: XW v5.6.9/v6.0)
Ubiquiti Networks NBE-5AC-16 (Version: WA v7.2.4)
Ubiquiti Networks NBE-5AC-19 (Version: XC v7.2.4)
Ubiquiti Networks NBE-M2-13 (Version: XW v5.6.9/v6.0)
Ubiquiti Networks NBE-M5-16 (Version: XW v5.6.9/v6.0)
Ubiquiti Networks NBE-M5-19 (Version: XW v5.6.9/v6.0)
Ubiquiti Networks PBE-5AC-300 (Version: XC v7.2.4)
Ubiquiti Networks PBE-5AC-300-ISO (Version: XC v7.2.4)
Ubiquiti Networks PBE-5AC-400 (Version: XC v7.2.4)
Ubiquiti Networks PBE-5AC-400-ISO (Version: XC v7.2.4)
Ubiquiti Networks PBE-5AC-500 (Version: XC v7.2.4)
Ubiquiti Networks PBE-5AC-500-ISO (Version: XC v7.2.4)
Ubiquiti Networks PBE-5AC-620 (Version: XC v7.2.4)
Ubiquiti Networks PBE-M2-400 (Version: XW v5.6.9/v6.0)
Ubiquiti Networks PBE-M5-300 (Version: XW v5.6.9/v6.0)
Ubiquiti Networks PBE-M5-300-ISO (Version: XW v5.6.9/v6.0)
Ubiquiti Networks PBE-M5-400 (Version: XW v5.6.9/v6.0)
Ubiquiti Networks PBE-M5-400-ISO (Version: XW v5.6.9/v6.0)
Ubiquiti Networks PBE-M5-620 (Version: XW v5.6.9/v6.0)
Ubiquiti Networks R5AC-Lite (Version: XC v7.2.4)
Ubiquiti Networks R5AC-PRISM (Version: XC v7.2.4)
Ubiquiti Networks R5AC-PTMP (Version: XC v7.2.4)
Ubiquiti Networks R5AC-PTP (Version: XC v7.2.4)
Ubiquiti Networks RM2-Ti (Version: XW v5.6.9/v6.0)
Ubiquiti Networks RM5-Ti (Version: XW v5.6.9/v6.0)


Vendor contact timeline:
------------------------
2016-11-22: Contacting vendor via HackerOne
2016-11-22: Vendor marks it as duplicate to: #143447
2016-11-23: Asking the vendor for a patch.
2016-11-25: Vendor responds that #143447 should be fixed for next stable release.
2016-11-25: Asking for an estimated time frame for a fix of the vulnerability.
2016-11-25: Vendor can not give a precise date.
2017-01-10: Asking the vendor for a patch and defined release of the advisory for 2017-01-16 (concerning the SEC Consult disclosure policy).
                      Shifted the deadline to 2017-01-30 due to Christmas holidays; No answer.
2017-01-17: Asked for an update.
2017-01-17: Vendor excuses for the delay and responds that they got a similar report but our PoC does not work.
2017-01-18: Explained PoC again
2017-01-19: Vendor responds that they received a similar report and assumed a duplication. They state that our PoC never worked and did not make any sense.
2017-01-20: Uploaded a video which shows a live command injection at an up-to-date (v6.0) device and posted an assumed reason why it's possible to exploit
2017-01-21: Vendor responds that they were able to reproduce it now. They also posted the real cause.
2017-01-24: Asking whether the vulnerability is a duplicate to #143447.
2017-01-24: Vendor responds that it is no duplicate and that this issue will be fixed as soon as possible.
2017-02-03: Asking for a status update; No answer.
2017-02-21: Asking for a status update; No answer.
2017-03-01: Informing the vendor that the release of the advisory is set to 2017-03-16; No answer.
2017-03-16: Public advisory release


Solution:
---------
There is no fix available from the vendor.


Workaround:
-----------
Restrict user and network access.


Advisory URL:
-------------

www.sec-consult.com/en/Vulnerability-Lab/Advisories.htm


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SEC Consult Vulnerability Lab

SEC Consult
Bangkok - Berlin - Linz - Luxembourg - Montreal - Moscow
Kuala Lumpur - Singapore - Vienna (HQ) - Vilnius - Zurich

About SEC Consult Vulnerability Lab
The SEC Consult Vulnerability Lab is an integrated part of SEC Consult. It
ensures the continued knowledge gain of SEC Consult in the field of network
and application security to stay ahead of the attacker. The SEC Consult
Vulnerability Lab supports high-quality penetration testing and the evaluation
of new offensive and defensive technologies for our customers. Hence our
customers obtain the most current information about vulnerabilities and valid
recommendation about the risk profile of new technologies.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Interested to work with the experts of SEC Consult?

Send us your application www.sec-consult.com/en/Career.htm

Interested in improving your cyber security with the experts of SEC Consult? 

Contact our local offices www.sec-consult.com/en/About/Contact.htm


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Mail: research at sec-consult dot com

Web: www.sec-consult.com


Blog: blog.sec-consult.com


Twitter: twitter.com/sec_consult

EOF T. Weber / @2017