/

CVE-2026-12186

Severity:

HIGH RISK

(8.8)

Command Injection (CWE-77) in GL.iNet Tor Proxy Handler

CVE-2026-12186

Deferred

Vulnerability type

Category:

Command Injection

CWE:

CWE-74, CWE-77

Impact:

Remote Code Execution on Network Device

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

GL.iNet GL-MT3000 devices contain a command injection flaw in the Tor Proxy Service Configuration Handler, specifically in the replace_country function.

A remote attacker who can reach the web configuration interface may inject arbitrary shell commands, leading to full compromise of the affected router.

Affected context

This vulnerability occurs within the Tor Proxy Service Configuration Handler on GL.iNet GL-MT3000 devices running firmware versions up to 4.4.5.

It affects environments where the router's HTTP/RPC interface is reachable over the network (LAN or, in misconfigured cases, from the internet) and user-controlled input is passed to backend scripts.

The issue is present when configuration values, such as the Tor exit country setting, are processed without adequate sanitization before being used in command-line operations.

Exploit preconditions

  • Attack surface: The router's HTTP/RPC configuration interface backing the Tor Proxy Service.
  • Required access: Network-level access to the management interface (e.g., authenticated web admin session or any exposed API endpoint that reaches replace_country).
  • Trigger point: Submission of crafted configuration parameters that are processed by the replace_country function in /usr/lib/oui-httpd/rpc/tor.
  • Why exploitation is possible: User-supplied data is concatenated into shell commands or command parameters without robust escaping or validation, enabling attackers to break out of intended arguments and execute arbitrary commands.

Why this happens

The defect is rooted in improper handling of user-controlled input when constructing shell commands.

The replace_country function appears to interpolate configuration values directly into command strings executed by the system shell, or pass them to APIs that implicitly invoke a shell.

This pattern maps to CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), and is closely related to CWE-74: Improper Neutralization of Special Elements in Output, because unsanitized input is embedded into an output context (a shell command) where meta-characters are interpreted as control syntax.

Instead of treating configuration fields as opaque data and passing them via safe, argument-based process execution or strict allowlists, the implementation trusts the input format, allowing injection of shell metacharacters.

Potential impact

  • Remote execution of arbitrary shell commands on the router's underlying operating system
  • Full takeover of the device, including modification of configuration, DNS settings, or routing behavior
  • Installation of persistent malware or backdoors on the router
  • Interception, redirection, or inspection of network traffic traversing the device
  • Use of the compromised router as a pivot point for attacking other systems on the local network
  • Participation of the device in botnets or large-scale distributed attacks

General mitigation guidance

Effective mitigation focuses on eliminating direct shell command construction from user input and constraining configuration values to safe, well-defined sets.

Recommended defensive patterns include:

  • Replacing shell-based invocations with APIs that accept parameter arrays (e.g., exec-style calls with no shell) and treating all user input as opaque data.
  • Enforcing strict allowlists for configuration fields like country codes, validating against known ISO lists instead of accepting arbitrary strings.
  • Normalizing and validating all external input early, rejecting values containing shell metacharacters or unexpected patterns for the domain.
  • Decomposing complex command logic into internal, parameterized functions that never concatenate strings into commands.
  • Running configuration-handling processes with least privilege and separating high-risk operations into isolated components or sandboxes.

These measures reduce the impact of untrusted configuration data and make command injection patterns structurally impossible or significantly harder to introduce.

How teams detect issues like this

Detection typically involves a combination of code-centric and behavior-centric approaches:

  • Static analysis rules that flag use of shell invocation functions (e.g., system, popen, backticks) where arguments include user-sourced values or HTTP parameters.
  • Pattern-based scanning for string concatenation or formatting that builds command lines from request parameters in RPC or HTTP handler code.
  • Code review checklists focusing on configuration handlers, ensuring all user inputs are validated against allowlists and never embedded directly in commands.
  • Runtime monitoring of the device for unusual process spawns, unexpected command-line arguments, or network connections originating from router services.
  • Incorporating security linting and automated code review tools into CI pipelines to catch command injection signatures before release.

These strategies help identify both this specific issue and similar command-injection risks in related components.

Sources

SourceLink
fw.gl-inet.comfw.gl-inet.com/firmware/mt3000/release/mt3000-4.8.1-0819-1755615825.tar
github.comgithub.com/StrTzz123/iot_vul/blob/main/GL-iNet/MT3000/4.4.5/tor_set_config/Readme.md
vuldb.comvuldb.com/cve/CVE-2026-12186
vuldb.comvuldb.com/submit/815579
vuldb.comvuldb.com/vuln/370832
vuldb.comvuldb.com/vuln/370832/cti

Frequently asked

questions

It can be, depending on how the router is deployed. If the management or RPC interface is exposed to the internet or reachable through port forwarding, an external attacker could exploit it. In more typical configurations where management is limited to the local network, exploitation is generally restricted to attackers with LAN access or those who have already compromised an internal host.

In many deployments, exploiting the vulnerability will require authenticated access to the configuration interface or an authenticated API call that reaches the Tor Proxy Service handler. However, misconfigurations, weak credentials, or other vulnerabilities could lower this bar, so the precise requirement depends on the router's access controls and network exposure.

The most robust fix is to remove all shell-based command construction that incorporates user input. Use APIs that execute commands without invoking a shell, pass arguments as arrays, and strictly validate or allowlist configuration values before use. This structural change is more reliable than attempting to "sanitize" shell strings in an ad hoc manner.

Establish development practices that treat all external input as untrusted, enforce validation against strict schemas or allowlists, and prohibit direct string concatenation into shell commands. Complement these practices with secure coding guidelines, automated static analysis tuned to flag command construction patterns, and mandatory security review for components that bridge user input and system-level operations.

Find out what's already
exploitable in your codebase.