/

CVE-2026-18616

Severity:

CRITICAL RISK

(9.8)

Command Injection (CWE-77) in GL-iNet GL-MT3000 Router

CVE-2026-18616

Deferred

Vulnerability type

Category:

Command Injection

CWE:

CWE-74, CWE-77

Impact:

Remote Code Execution on Router Platform

Severity:

CRITICAL RISK

(9.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 routers contain a command injection flaw in the wg-server native plugin, where the public_key parameter to server.set_peer is unsafely handled.

An attacker who can send crafted requests to the /cgi-bin/glc endpoint may execute arbitrary system commands on the device, making any exposed management interface a high-risk target.

Affected context

The vulnerability appears in GL-iNet GL-MT3000 devices running firmware versions up to 4.4.5 that expose the /cgi-bin/glc endpoint using the wg-server.so native plugin.

It affects scenarios where the router's web administration or related APIs are reachable to an attacker, such as from the local network, VPN, or improperly exposed WAN interfaces.

The flaw is triggered when the server.set_peer function processes user-supplied public_key values that are later incorporated into command execution without proper sanitization.

Exploit preconditions

  • Attack surface: HTTP(S) interface providing access to /cgi-bin/glc on the GL-MT3000 router.
  • Required access: Ability to send HTTP requests to the router's management or API interface (local network, authenticated session, or exposed WAN, depending on deployment).
  • Trigger point: Invocation of server.set_peer with a crafted public_key parameter that injects shell metacharacters or additional command segments.
  • Why exploitation is possible: The implementation appears to construct shell commands or invoke system utilities using unvalidated public_key data, causing it to be interpreted by the command interpreter (shell) instead of being treated as inert input.

Why this happens

This issue stems from improper neutralization of user-controlled input before it is used in a command execution context, a classic command injection pattern.

The public_key argument in server.set_peer is likely concatenated or interpolated directly into a shell command, or passed to a system execution API that invokes a shell, without robust quoting, escaping, or avoiding shell interpretation entirely.

This behavior maps to:

  • CWE-77: Command Injection, where input is not correctly sanitized, allowing attackers to inject additional commands.
  • CWE-74: Improper Neutralization of Special Elements, because special characters (such as ;, &&, |) are not neutralized and thus alter the structure of the command being executed.

The abstract insecure pattern is: user-supplied data flowing into a command-line string or shell context, with the shell responsible for interpreting that string, rather than using APIs that separate code from data.

Potential impact

  • Remote execution of arbitrary commands on the GL-MT3000 router's operating system.
  • Full compromise of router configuration, including manipulation of VPN, firewall, and routing rules.
  • Extraction of sensitive information, such as VPN keys, Wi-Fi credentials, or stored tokens.
  • Use of the router as a pivot point for attacking other devices on the local network.
  • Deployment of persistent malware or backdoors on the router, enabling long-term unauthorized access.
  • Participation of compromised routers in wider botnets or distributed attacks.

General mitigation guidance

Long-term resilience against this class of bug comes from eliminating shell-dependent command construction and enforcing strong separation between user input and executable logic.

Common defensive patterns include:

  • Avoiding use of shell-interpretive APIs (e.g., generic system command strings) and instead using parameterized or structured APIs (e.g., exec-family calls with argument arrays) that do not invoke a shell.
  • Applying strict validation and normalization to parameters like public_key, enforcing expected formats (length, character set, encoding) and rejecting any input that deviates.
  • Centralizing input handling for router management APIs, so that command-line relevant parameters are uniformly sanitized and constrained.
  • Running management plugins and auxiliary services with least-privilege identities and restricted capabilities, reducing the blast radius if a command is compromised.
  • Designing plugin interfaces such that configuration changes operate on data structures or configuration files, not through dynamically constructed shell commands.

How teams detect issues like this

Detection typically relies on identifying both the insecure coding pattern and anomalous runtime behavior.

High-level approaches include:

  • Static analysis: Define rules to flag uses of system command APIs (e.g., system, popen, exec* with "/bin/sh -c" patterns) where user input, including parameters like public_key, can reach the command string.
  • Code review cues: During manual review of router management and native plugin code, look for string concatenation or formatting involving user data that feeds into shell or command-line utilities, especially for network-exposed handlers.
  • Configuration and policy checks: Enforce secure coding guidelines that disallow shell-based command composition in web-CGI handlers and native plugins, and require validation functions for all externally reachable parameters.
  • Runtime monitoring: Use logging or telemetry (where available) to detect abnormal command executions or unexpected arguments being passed from CGI handlers, and correlate with suspicious requests.
  • Automated security scanners and SAST tools can be configured to focus on CGI binaries and native modules that process HTTP parameters, highlighting potential command injection flows early in development or QA.

Sources

SourceLink
github.comgithub.com/StrTzz123/iot_vul/blob/main/GL-iNet/MT3000/4.4.5/wg_set_peer_rce/CVE.md
vuldb.comvuldb.com/cve/CVE-2026-18616
vuldb.comvuldb.com/submit/851580
vuldb.comvuldb.com/vuln/385536
vuldb.comvuldb.com/vuln/385536/cti

Frequently asked

questions

It can be, depending on how the router is deployed. If the /cgi-bin/glc endpoint or the management interface is exposed over the WAN or via a VPN, an external attacker may exploit it remotely. If access is limited to the local network, exploitation is generally restricted to attackers with local or adjacent network access.

The exact access requirement depends on how the router's management interface and wg-server plugin are configured. In many deployments, these endpoints may require authentication; however, if misconfigured, exposed, or combined with other weaknesses, an unauthenticated attacker might still be able to reach and exploit the vulnerable function.

The safest pattern is to remove any dependence on shell-based commands for handling parameters like public_key. Instead, use APIs that accept arguments as structured parameters, enforce strict validation of all externally supplied fields, and ensure that user data is never directly concatenated into command strings.

Prevention strategies include adopting secure coding standards that forbid direct shell invocation from network-facing handlers, integrating static analysis rules that flag potential command injection paths, validating and constraining all input at trust boundaries, and performing focused security reviews on router management and plugin code before release.

Find out what's already
exploitable in your codebase.