Foscam IP Video Camera UPnP Discovery Code Execution Vulnerability
A buffer overflow exists in the UPnP discovery response parsing of the Foscam C1 camera. An attacker on the same network can send a crafted reply to the camera's discovery message, causing a crash and potentially arbitrary code execution.
Originally disclosed on Cisco Talos
An exploitable buffer overflow vulnerability exists in the UPnP implementation used by the Foscam C1 Indoor HD Camera running application firmware 2.52.2.43. A specially crafted UPnP discovery response can cause a buffer overflow resulting in overwriting arbitrary data.
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 code uses sprintf to build an HTTP request into a 200-byte buffer without checking the length of the control URL components, leading to a stack-based buffer overflow.
What the attacker needed
Attacker on same subnetwork; UPnP enabled on camera
How it was found
- Enable UPnP on the camera so it sends discovery messages.
- Send a UDP reply to the camera's discovery message containing '200 OK', 'http://', and an overly long control URL.
- The camera parses the reply and copies the control URL into a fixed-size buffer, causing a crash.
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 camera sends out a discovery message on the local network to find other UPnP devices. When it gets a reply, it copies part of that reply into a fixed-size memory buffer without checking the length. If the reply is too long, it overflows the buffer, which can crash the camera 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.