Summary
GL-iNet GL-AR300M16 routers running firmware v4.3.11 contain an OS command injection flaw in the set_config function, where user-controlled input is passed into system-level commands without proper sanitization.
An attacker who can reach this functionality can inject crafted shell metacharacters and execute arbitrary commands on the device with the privileges of the affected service.
Affected context
The vulnerability exists in the GL-iNet GL-AR300M16 firmware (version 4.3.11) within the logic that applies configuration updates via the set_config function.
It is relevant in deployments where the router's management interface or related configuration endpoints are exposed to untrusted networks or where untrusted input can reach configuration parameters.
The issue is more impactful when the affected process runs with elevated privileges, which is common in embedded networking devices applying system-wide settings.
Exploit preconditions
- Attack surface: Configuration interface or API that invokes the set_config function on the GL-AR300M16.
- Required access: Ability to send crafted input to the configuration mechanism (e.g., via web UI, HTTP API, or other management interface that reaches set_config).
- Trigger point: Submission or processing of configuration values that are concatenated into or passed directly to underlying shell/system commands.
- Why exploitation is possible: The implementation allows user-controlled data to be interpreted by a command interpreter without robust quoting, escaping, or parameterization, enabling shell metacharacters to alter command structure.
Why this happens
This issue is a classic OS command injection (CWE-77) where configuration data is treated as part of a shell command line.
Instead of using parameterized APIs or strongly typed system calls, the set_config function appears to build command strings that embed user input and then hand them off to a shell or equivalent interpreter.
When metacharacters such as separators, pipes, or redirection operators are not neutralized, the shell parses them as additional commands, allowing attackers to execute arbitrary code in the device's operating environment.
Potential impact
- Execution of arbitrary commands on the router's operating system
- Full compromise of the device, including configuration and stored credentials
- Pivoting into attached networks to perform reconnaissance or further attacks
- Interception, modification, or redirection of network traffic handled by the router
- Installation of persistent malware or backdoors on the device
General mitigation guidance
Effective mitigation focuses on avoiding direct interaction between untrusted input and command interpreters.
Recommended defensive patterns include:
- Replacing shell invocation with safer, parameterized system APIs that do not invoke a command parser.
- Whitelisting and strictly validating configuration parameters against expected formats, ranges, and allowed values before processing.
- Avoiding string concatenation for commands; when shell usage is unavoidable, rigorously escape and quote arguments, and restrict allowed characters to a minimal safe set.
- Applying least-privilege to the process handling configuration changes, so that a compromise has a reduced blast radius.
- Segregating critical system operations from directly user-supplied data, using intermediary layers or configuration files that are parsed safely rather than executed.
How teams detect issues like this
Organizations can identify and monitor for this vulnerability class using several approaches:
- Static analysis: Flag usage of shell execution routines (e.g., system, popen, backtick invocation, or equivalent) where arguments include user-controlled or configuration-derived data.
- Code review: Look for patterns where configuration parameters are concatenated into command strings or passed through without strict validation and normalization.
- Policy enforcement: Establish coding guidelines that require parameterized APIs for system interactions, and enforce them via automated checks in CI pipelines.
- Runtime monitoring: On embedded or test devices, observe unusual process spawns, unexpected command arguments, or anomalous network connections following configuration changes, which may indicate attempted exploitation.

