Foscam IP Video Camera CGIProxy.fcgi Wifi Settings Code Execution Vulnerability
A stack-based buffer overflow in the setWifiSetting command of the Foscam C1 camera's CGIProxy.fcgi service allows an authenticated attacker to overwrite saved registers and potentially execute code by sending a crafted HTTP request with an overly long psk parameter.
Originally disclosed on Cisco Talos
An exploitable stack-based buffer overflow vulnerability exists in the web management interface used by the Foscam C1 Indoor HD Camera running application firmware 2.52.2.37. A specially crafted HTTP request can cause a buffer overflow resulting in overwriting arbitrary data, potentially resulting in code execution.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The psk parameter is copied into a 0x100-byte stack buffer using strcpy without any length check, causing a stack-based buffer overflow.
Impact
An authenticated attacker could overwrite arbitrary data on the stack and potentially achieve code execution on the device.
What the attacker needed
Valid user account with privilege level 2; network access to the camera's web interface
How it was found
- Authenticate with a valid user account that has privilege level 2.
- Send an HTTP request to /cgi-bin/CGIProxy.fcgi with cmd=setWifiSetting and a psk parameter containing a long string.
- The psk value overflows the stack buffer and overwrites the saved r4 register.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This report describes a memory corruption bug in a security camera's web interface. When the camera processes a request to change Wi-Fi settings, it copies the supplied Wi-Fi password into a fixed-size memory area without checking length, so a very long password spills over into adjacent memory and can crash the device or let an attacker run their own code.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.