CVE-2022-28743
Executive Summary
CVE-2022-28743 is a Time-of-check Time-of-use (TOCTOU) race condition vulnerability in the Foscam R2C IP camera. The flaw affects devices running System Firmware versions up to and including 1.13.1.6 and Application Firmware versions up to and including 2.91.2.66. An authenticated remote attacker with administrator privileges can exploit this race condition to execute arbitrary code on the device through a maliciously crafted firmware patch, ultimately gaining full root access to the underlying Linux operating system and the camera hardware itself. This vulnerability is currently unpatched, presenting a persistent risk to affected devices connected to production networks.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Technical Analysis
CVE-2022-28743 is a TOCTOU race condition that arises from an asymmetry between a security check and the subsequent use of a resource. In the context of the Foscam R2C IP camera, the affected code path involves the firmware update and patch application mechanism. The vulnerability allows an authenticated administrator to replace or modify a legitimate firmware patch with malicious content between the time the system validates the patch's integrity and the time the patch is actually applied to the device's filesystem.
A TOCTOU race condition of this nature typically involves the following sequence:
- The application performs a security verification (e.g., checking a file's signature, hash, or origin) on an object.
- The application proceeds to use that object without revalidating it after a time delay.
- An attacker who has the ability to modify the object during that delay window can substitute malicious content that bypasses the initial validation.
In the context of the Foscam R2C camera, the specific mechanism is that the firmware patch application process performs a check on the patch file, and then, due to a race condition, an authenticated administrator can theoretically swap the legitimate patch file with a malicious one before it is applied. Because the check and the application are not atomic — that is, they occur as separate operations with a time interval between them — an attacker with sufficient control over the device (which an administrator account provides) can exploit this window.
The attack surface is the firmware update functionality accessible through the camera's web interface or administrative API. The precondition of administrator privileges is significant, as it narrows the attacker pool to individuals who already have significant control over the device. However, the severity (CVSS 9.1) reflects that once exploited, the attacker gains complete control over the device and the underlying Linux system, with no meaningful residual security boundaries. The CVSS vector with High privileges, Unchanged scope, and Critical Confidentiality/Integrity/Availability impact objectively describes an escalation from administrative control of the camera firmware to full arbitrary code execution with root system access.
It is important to note that insufficient technical detail is available in the public description to identify the specific file paths, function names, or API endpoints involved in this race condition. The vulnerability's root cause is the cryptographic or integrity validation of firmware patch files not being atomically linked to their installation.
Exploitation Scenarios
Preconditions: An active session on the Foscam R2C camera with administrator credentials, and network connectivity to the device's management interface (typically HTTP/HTTPS on ports 80/443 or proprietary streaming ports).
Scenario 1 — Firmware Substitution Attack:
Reconnaissance/Target Identification: An attacker identifies Foscam R2C cameras on the network. This can be done via network scanning using default credentials lists, brute-force attempts, or through exposed web interfaces. Shodan queries for Foscam products are a common initial step. Internal network penetration testers may use ARP scans and banner grabs to find the devices.
Triggering the TOCTOU Flaw: The attacker initiates a firmware update session through the administrative interface, uploading a legitimate firmware patch. During the time window between the patch's integrity verification and its application to the system, the attacker races to overwrite the legitimate patch file on the device's filesystem with a maliciously crafted patch. Because the verification happens only once, the malicious file passes through the application phase.
Payload/Execution Method: The malicious patch is written at the vulnerability-class level to include arbitrary shell commands or a custom binary. The camera's patch application utility then executes the payload with root privileges, since firmware updates inherently require elevated system permissions to write to protected system partitions. The exact payload format is unknown without public PoC, but it would logically include a stage to establish persistent remote access (e.g., a reverse shell or SSH backdoor).
Post-Exploitation Impact: Once the malicious patch executes, the attacker has root access to the camera's Linux OS. The attacker can exfiltrate live video streams, modify or delete recorded footage, install additional backdoors for persistent access, and potentially leverage the camera as a pivot point to access other devices on the local network segment. The camera can also be enlisted into a botnet due to its persistent network connectivity.
Scenario 2 — Insider/Compromised Admin Threat: If the camera's administrator credentials are phished or obtained through other means, the attacker can skip the reconnaissance step and directly exploit the race condition. This is relevant for corporate environments where IP cameras may share credentials with other enterprise accounts.
It is important to note: No public PoC is available; attack chain is inferred from the vulnerability class (TOCTOU) and the NVD description's explicit mention of "malicious firmware patch" and "administrator permissions."
Impact Assessment
Business Impact: The Foscam R2C is an Internet Protocol camera used in both home and small-business surveillance environments. A successful compromise has direct privacy consequences (unauthorized video surveillance), integrity consequences (tampered or deleted footage), and availability consequences (camera functions as a persistent remote access tool that can be disabled or weaponized).
CVSS Analysis: The 9.1 base score derives from High attack complexity (race conditions are difficult to reliably trigger), High privileges required, Unchanged scope, and Critical C/I/A. The scope is Unchanged because the compromise stays within the camera, but the practical blast radius is amplified by the camera's network position — an attacker with root on the camera can sniff network traffic, launch lateral movement attacks into the local subnet, or use the camera as a covert relay.
Affected Systems: Foscam R2C cameras running System FW ≤ 1.13.1.6 and Application FW ≤ 2.91.2.66. Given the lack of patch evidence, this extends to all known firmware versions of this model line. Other Foscam models may share the same vulnerable firmware update code, but this is not confirmed by the NVD description.
Blast Radius: Full root access to the Linux OS, live camera stream compromise, persistent backdoor, and network pivot point.
Detection Guidance
Sigma Rule
title: Foscam R2C - Potential TOCTOU Firmware Patch Exploitation
id: 3f3a8c0e-5a7b-4c2d-9e4f-1b2a3d4e5f6a
status: experimental
description: Detects suspicious firmware update activity on Foscam R2C cameras that may indicate TOCTOU race condition exploitation (CVE-2022-28743)
author: Valtersit Threat Intel
date: 2024/01/15
logsource:
product: linux
category: process_creation
detection:
selection:
Image|endswith:
- '/fwupdate'
- '/patch_apply'
- '/upgrade'
CommandLine|contains:
- 'firmware'
- 'patch'
- 'upgrade'
condition: selection
falsepositives:
- Legitimate firmware update procedures initiated by authorized administrators
level: medium
tags:
- attack.privilege_escalation
- attack.t1068
- cve.2022-28743
YARA Rule
rule CVE_2022_28743_Foscam_R2C_TOCTOU_Firmware {
meta:
author = "Valtersit Threat Intelligence"
date = "2024-01-15"
description = "Detect firmware patch files that may be part of TOCTOU exploitation against Foscam R2C cameras"
cve = "CVE-2022-28743"
score = "60"
strings:
$fw_magic = { 46 57 44 4D 50 } // "FWDMP" - potential firmware format marker
$root_shell = { 2F 62 69 6E 2F 73 68 } // "/bin/sh"
$persist = "adduser" ascii
$backdoor = "reverse" ascii
$ssh_key = "authorized_keys" ascii
condition:
uint32(0) == 0x1A2B3C4D // Firmware header magic
and 2 of ($fw_magic, $root_shell, $persist, $backdoor, $ssh_key)
and filesize > 1MB
}
Suricata IDS Rule
alert http any any -> $HOME_NET any (msg:"CVE-2022-28743 - Foscam R2C TOCTOU Firmware Patch Attempt"; flow:established,to_server; content:"POST"; http_method; content:"/fw_update"; http_uri; content:"application/octet-stream"; http_client_body; fileext:"bin"; content:"|1A 2B 3C 4D|"; file_data; classtype:attempted-admin; reference:cve,2022-28743; reference:url,https://nvd.nist.gov/vuln/detail/CVE-2022-28743; sid:2022874301; rev:1;)
Elastic Detection
sequence by host.name with maxspan=30s
[network where destination.port == 80 and process.name : "httpd"]
[file where event.action == "write" and file.name : "*.bin" and process.name : "httpd"]
[process where event.action == "exec" and process.parent.name : "apply_patch" and process.command_line : "*sh*"]
Splunk SPL Query
index=main sourcetype=linux_audit OR source="/var/log/syslog"
| search (process="*fwupdate*" OR process="*apply_patch*" OR command="*/upgrade*")
| transaction host maxspan=30s
| search transaction_members > 2
| stats count by host, command, _time
| where count > 1
| head 20
Wazuh OSSEC Rule
<group name="foscam_cve_2022_28743,">
<rule id="100291" level="8">
<decoded_as>json</decoded_as>
<field name="auditd.data.syscall">execve</field>
<match>fwupdate|apply_patch|upgrade</match>
<description>Potential CVE-2022-28743 exploitation - firmware update process detected on Foscam device</description>
<group>attack.privilege_escalation</group>
<mitre>
<id>T1068</id>
</mitre>
</rule>
</group>
Mitigation & Patch Guidance
Patch Confidence: 0/4 — UNPATCHED. No vendor fix is available from any tracked source at the time of this report. Insufficient technical detail is available about the vendor's plan or timeline. This vulnerability remains exploitable on all confirmed affected firmware versions.
Immediate Mitigations (administrative controls):
- Restrict administrative access. Change default admin credentials immediately. Enforce strong, unique passwords. Limit admin-level access to trusted IP ranges or a VPN.
- Network segmentation. Isolate IP cameras on a dedicated VLAN with strict firewall rules. Do not allow camera management interfaces to be reachable from the internet or untrusted networks. Block inbound access to the camera's web management ports from external sources.
- Disable remote management. Turn off UPnP port forwarding and any remote-access features that expose the camera to the internet.
Patch/Upgrade Steps:
- Contact Foscam support or check the official Foscam website for any firmware updates or security advisories. Monitor their release notes for a version that explicitly addresses this CVE.
- Until a patched firmware is released, ensure the current firmware is the latest available within the vulnerable range. Watch for any security advisories from Foscam that may provide interim patched builds.
- If firmware updates are released, test them in a non-production environment first, then stage the rollout to all affected devices.
Long-Term Hardening:
- Disable unused features. If the R2C camera is used for local recording only, disable cloud connectivity and any network services that are not strictly required.
- Monitor network traffic. Implement egress filtering on the camera's VLAN to block outbound connections except to legitimate update servers and recording/NVR endpoints.
- Regular security audits. Periodically review camera user accounts, check for unknown SSH keys or binaries on the device (if accessible via the web interface), and audit firmware integrity.
- Consider replacement. For critical deployments, consider whether EOL (End-of-Life) reach of the R2C cable is a factor. If this model is past its support lifecycle, replacement with a supported, actively patched model may be the only comprehensive mitigation.
References
- NVD Entry: https://nvd.nist.gov/vuln/detail/CVE-2022-28743
- MITRE CVE Record: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-28743
- CWE-367 (TOCTOU Race Condition): https://cwe.mitre.org/data/definitions/367.html
- Foscam Official Security/Support Page: https://www.foscam.com/downloads/firmware.html
- ATT&CK Technique T1068 (Exploitation for Privilege Escalation): https://attack.mitre.org/techniques/T1068/
Threat Actor Activity: No known active exploitation campaigns, exploit code, or CISA KEV (Known Exploited Vulnerabilities) listing were identified at the time of this analysis. The EPSS score of 0.01091 (62.3rd percentile) indicates a moderate probability of exploitation in the wild, though the lack of public PoC and the High Privilege precondition reduce the immediate likelihood of mass exploitation relative to lower-privilege vulnerabilities.
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.