Summary
A high-severity OS command injection vulnerability in the Baicells EG3661M LuCI Web Interface may allow remote attackers to influence command execution through the MaxHops, Timeout, or Size arguments.
The issue becomes risky when attacker-controlled request parameters reach an operating-system command without sufficiently strict validation, separation, or safe process invocation.
Affected context
The vulnerability occurs in the LuCI Web Interface exposed through /cgi-bin/luci on affected Baicells EG3661M deployments. It appears to involve handling of the MaxHops, Timeout, and Size arguments, although the precise internal function and deployment conditions may vary. Exposure is particularly concerning when the management interface is reachable from an untrusted or broadly accessible network.
Exploit preconditions
- Attack surface: The LuCI Web Interface at
/cgi-bin/luci - Required access: Network reachability to the affected web interface; additional authentication requirements depend on the device's access controls
- Trigger point: Processing of requests containing the
MaxHops,Timeout, orSizearguments - Why exploitation is possible: User-controlled argument values may reach an operating-system command construction or execution path without adequate validation or safe argument separation
Why this happens
The underlying bug is command injection caused by treating web request parameters as trusted input when constructing or invoking operating-system commands.
If untrusted values are concatenated into shell commands, interpreted by a shell, or insufficiently constrained before process execution, an attacker may alter the intended command behavior. This maps primarily to CWE-78: Improper Neutralization of Special Elements used in an OS Command, with CWE-77: Improper Neutralization of Special Elements in Output Used by a Downstream Component describing the broader injection pattern.
Potential impact
- An attacker may execute unauthorized operating-system commands
- Device configuration or service behavior could be altered
- Sensitive device data may be accessed or modified
- Network traffic could be disrupted or redirected
- The device could be used as a foothold for further attacks
- Persistent compromise could occur if sufficient privileges are available
General mitigation guidance
Mitigation generally focuses on eliminating shell interpretation and reducing trust in web request parameters.
Common defensive patterns include:
- Replacing shell-based command construction with direct process APIs that pass arguments separately
- Applying strict allowlists, type validation, and bounded ranges to parameters such as hop counts, timeouts, and sizes
- Rejecting unexpected characters, formats, and duplicate parameters before business logic runs
- Running web-facing services with the least privileges required for their functions
- Restricting management interfaces to trusted administrative networks or access paths
- Separating device-management capabilities from externally reachable services
- Logging and reviewing rejected requests and command-execution failures
How teams detect issues like this
Detection approaches may include:
- Static analysis for string concatenation or interpolation involving request parameters and shell or process execution APIs
- Code review of handlers processing
MaxHops,Timeout, andSize - Testing boundary values, malformed types, unexpected delimiters, and shell metacharacters in controlled environments
- Web application monitoring for unusual requests to
/cgi-bin/luciand abnormal parameter combinations - Runtime controls that alert on unexpected child-process creation by the LuCI service
- Policy enforcement requiring allowlisted command arguments and prohibiting shell execution for web-derived input
- Automated security review tools that flag command construction from untrusted sources

