1. Advisory Information Title: AirLive Multiple Products OS Command Injection Advisory ID: CORE-2015-0012 Advisory URL: http://www.coresecurity.com/advisories/airlive-multiple-products-os-command-injection Date published: 2015-07-06 Date of last update: 2015-07-06 Vendors contacted: AirLive Release mode: User release 2. Vulnerability Information Class: OS Command Injection [CWE-78], OS Command Injection [CWE-78] Impact: Code execution Remotely Exploitable: Yes Locally Exploitable: No CVE Name: CVE-2015-2279, CVE-2014-8389 3. Vulnerability Description AirLive MD-3025 [3], BU-3026 [4], BU-2015 [2], WL-2000CAM [5] and POE-200CAM [6] are IP cameras designed for professional surveillance and security applications. The built-in IR LEDs provide high quality nighttime monitoring. These AirLive [1] devices are vulnerable to an OS Command Injection Vulnerability. In the case of the MD-3025, BU-3026 and BU-2015 cameras, the vulnerability lies in the cgi_test.cgi binary file. In the case of the WL-2000CAM and POE-200CAM cameras, the command injection can be performed using the vulnerable wireless_mft.cgi binary file. 4. Vulnerable Packages AirLive BU-2015 with firmware 1.03.18 16.06.2014 AirLive BU-3026 with firmware 1.43 21.08.2014 AirLive MD-3025 with firmware 1.81 21.08.2014 AirLive WL-2000CAM with firmware LM.1.6.18 14.10.2011 AirLive POE-200CAM v2 with firmware LM.1.6.17.01 Other devices may be affected too, but they were not checked. 5. Vendor Information, Solutions and Workarounds Core Security recommends to apply a WAF (Web Application Firewall) rule that would filter the vulnerable request (either the CGI file or the parameters where the injection is performed) in order to avoid exploitation. Contact the vendor for further information. 6. Credits These vulnerabilities were discovered and researched by Nahuel Riva from Core Security Exploit Writing Team. The publication of this advisory was coordinated by Joaquin Rodriguez Varela from Core Security Advisories Team. 7. Technical Description / Proof of Concept Code 7.1. OS Command Injection in cgi_test.cgi when handling certain parameters [CVE-2015-2279] There is an OS Command Injection in the cgi_test.cgi binary file in the AirLive MD-3025, BU-3026 and BU-2015 cameras when handling certain parameters. That specific CGI file can be requested without authentication, unless the user specified in the configuration of the camera that every communication should be performed over HTTPS (not enabled by default). The vulnerable parameters are the following: write_mac write_pid write_msn write_tan write_hdv These parameters are used to invoke another binary file called "info_writer". In the sub_93F4 function it uses the "QUERY_STRING" and checks if it contains any of the parameters followed by an ampersand symbol: sub_93F4 STMFD SP!, {R4-R7,LR} LDR R0, =aQuery_string ; "QUERY_STRING" SUB SP, SP, #4 BL getenv MOV R1, #0 ; c MOV R2, #0x12 ; n MOV R6, R0 LDR R0, =unk_14B70 ; s BL memset LDR R0, =aContentTypeTex ; "Content-type: text/html\n\n
" BL printf MOV R5, #0 LDR R7, =off_B7D0 MOV R4, R5 B loc_943C [...] loc_9540 ; jumptable 00009470 case 7 MOV R0, R6 LDR R1, =aWrite_pid ; "write_pid&" BL strstr CMP R0, #0 BEQ loc_94CC ; jumptable 00009470 default case [...] It then uses whatever appears after the ampersand symbol in a call to printf() in order to put together the parameter with which the "info_writer" binary will be invoked. Finally, it calls the system() function: [...] .text:00009730 loc_9730 ; CODE XREF: .text:00009714j .text:00009730 MOV R2, R5 .text:00009734 LDR R1, =aOptIpncInfo__1 ; "/opt/ipnc/info_writer -p %s > /dev/null" .text:00009738 MOV R0, SP .text:0000973C BL sprintf .text:00009740 MOV R0, SP .text:00009744 BL system .text:00009748 MOV R2, R5 .text:0000974C LDR R1, =aWrite_pidOkPid ; "WRITE_PID OK, PID=%s\r\n" .text:00009750 LDR R0, =unk_1977C .text:00009754 MOV R4, SP .text:00009758 BL sprintf .text:0000975C B loc_9728 [...] Consequently, if a semicolon (;) is used after the ampersand symbol, arbitrary commands can be injected into the operating system. It's important to take into account that depending on the parameter used, there are checks like this (corresponding to the write_pid parameter): .text:00009708 MOV R0, R5 .text:0000970C BL strlen .text:00009710 CMP R0, #9 This verifies that the parameter has a specific length. Because of this, the injection is somewhat limited. Nevertheless, there are possible commands that can be executed, for example: Proof of Concept: http://