Summary
GL.iNet GL-MT3000 routers prior to firmware 4.7 contain a command injection vulnerability in the /usr/lib/oui-httpd/rpc/ path normalization handler, specifically in logic that uses dlopen and processes the dev_name argument.
A remote attacker who can invoke the affected RPC methods can inject crafted values into dev_name, leading to execution of arbitrary system commands on the device.
Affected context
The vulnerability exists in the GL-MT3000's embedded web/RPC service, where HTTP requests to the /rpc layer are mapped to backend functions using a path normalization handler.
The dev_name parameter is processed and ultimately influences dynamic library loading or command execution without sufficient sanitization.
Deployments are at risk when the device exposes its management or RPC interface to untrusted networks, or when an attacker can reach the default /rpc endpoint through the LAN or a VPN.
Exploit preconditions
- Attack surface: HTTP /rpc interface of the GL-MT3000 router
- Required access: Network-level access to the device's management/RPC port; no physical access required
- Trigger point: Invocation of the affected RPC method(s) with a malicious dev_name parameter that passes minimal superficial validation
- Why exploitation is possible: The dev_name value is incorporated into downstream command or library loading logic without robust validation, escaping or strict whitelisting, enabling crafted input to alter the intended command or code path
Why this happens
The underlying issue is improper neutralization of user-controlled input before it is used in command or dynamic loading contexts, mapping to CWE-77: Command Injection and CWE-74: Improper Neutralization of Data in Output Used by a Downstream Component.
The path normalization handler takes a dev_name argument supplied over HTTP and propagates it into sensitive operations, such as dlopen-based loading or shell-invoked utilities, without enforcing strict constraints on allowed values.
Instead of binding requests to a closed set of safe, pre-defined operations, the design permits flexible parameter-driven behavior, creating a channel where crafted data can escape its role as data and influence control flow.
Potential impact
- Remote execution of arbitrary commands on the router
- Unauthorized access to router configuration and stored credentials
- Use of the device as a foothold for further attacks within the local network
- Installation of persistent malware or backdoors on the router
- Disruption of network services provided by the device
General mitigation guidance
Mitigation generally focuses on constraining how user input influences backend operations and reducing the reachable attack surface.
Pattern-based mitigations include:
- Applying strict method-level whitelisting at RPC boundaries so only explicitly allowed operations can be invoked, independent of user-supplied parameters.
- Validating parameters like dev_name against tight schemas or enumerated sets (e.g., known device identifiers), rejecting any value that does not conform.
- Avoiding composition of shell commands or dynamic library paths directly from user input; instead, mapping user-facing tokens to internal constants or preconfigured paths.
- Implementing robust input neutralization when interaction with downstream components is unavoidable, ensuring special characters and control metacharacters are either rejected or safely encoded.
- Running web/RPC services with least privilege on the system so that, even if misuse occurs, the blast radius is minimized.
- Restricting external exposure of the management/RPC interface through firewall rules, access control lists, or VPN-only access to administrative endpoints.
How teams detect issues like this
Detection efforts can target both code-level patterns and runtime behavior.
Possible strategies:
- Static analysis rules that flag any use of dlopen, system, popen, or similar APIs where arguments incorporate HTTP or RPC parameters without clear validation or whitelisting.
- Code review checklists that explicitly call out RPC handlers and path normalization logic, ensuring all callable methods are enumerated and guarded by allow-lists.
- Configuration and policy checks that verify administrative interfaces, including /rpc endpoints, are not exposed directly to the internet and require authentication.
- Runtime monitoring and logging of RPC invocations, including method names and key parameters, with anomaly detection for unusual dev_name values or patterns suggesting command injection attempts.
- Use of automated firmware or embedded security testing tools to fuzz RPC endpoints and identify cases where user-controlled input reaches system-level calls.

