/

CVE-2026-18615

Severity:

CRITICAL RISK

(9.8)

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

CVE-2026-18615

Deferred

Vulnerability type

Category:

Command Injection

CWE:

CWE-74, CWE-77

Impact:

Remote Code Execution on Router Firmware

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

A command injection flaw in the wg-server.generate_publickey function of GL-iNet GL-MT3000 routers allows crafted private_key parameters to break out of expected processing and execute arbitrary system commands.

When the vulnerable CGI endpoint is exposed to untrusted networks, a remote attacker may gain full control of the device by sending malicious HTTP requests.

Affected context

This vulnerability occurs in GL-iNet GL-MT3000 devices running firmware up to version 4.4.5, specifically in the wg-server.so native plugin accessed via the /cgi-bin/glc endpoint.

It manifests when the wg-server.generate_publickey function processes the private_key argument and forwards it, directly or indirectly, into shell-level operations without robust sanitization or proper command construction.

The issue is most relevant when the web administration interface or associated APIs are reachable from untrusted clients, such as over the WAN or shared local networks.

Exploit preconditions

  • Attack surface: HTTP-based management/API interface exposed via the /cgi-bin/glc endpoint
  • Required access: Network reachability to the router's web interface; may or may not require authentication depending on configuration
  • Trigger point: Invocation of wg-server.generate_publickey with a crafted private_key parameter containing shell metacharacters or injected commands
  • Why exploitation is possible: The input value is incorporated into a command execution context without adequate neutralization or safe API usage, enabling the attacker to alter command structure and inject arbitrary shell commands

Why this happens

The underlying bug class corresponds to command injection, primarily mapping to CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection') and related CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component.

Instead of treating the private_key argument as opaque data, the implementation appears to pass it into a shell or shell-invoking function (e.g., system, popen, or equivalent) where shell metacharacters and operators are interpreted.

This pattern arises when application logic composes command strings by concatenating user-controlled input, relies on shell parsing for convenience, and omits strict validation or encoding.

As a result, attackers can transform what should be a simple key-generation operation into a vehicle for arbitrary command execution on the router's operating system.

Potential impact

  • Remote execution of arbitrary OS commands on the GL-MT3000 device
  • Complete compromise of the router's configuration, including VPN and network settings
  • Installation of persistent malware or backdoors on the device
  • Interception, modification, or redirection of user network traffic traversing the router
  • Use of the compromised router as a pivot point for further attacks on internal networks
  • Participation of the device in botnets or large-scale distributed attacks

General mitigation guidance

Effective mitigation focuses on eliminating direct shell command construction and minimizing the trust placed in user-controlled parameters.

Pattern-based defensive measures include:

  • Replacing shell-based command execution with library calls or APIs that perform key generation without invoking a shell.
  • When command execution is unavoidable, using parameterized process-spawning APIs (e.g., execve-like calls with argument arrays) and avoiding string concatenation entirely.
  • Applying strict input validation on parameters like private_key, enforcing expected formats (such as key length, character sets, and structure) and rejecting anything outside defined constraints.
  • Normalizing and constraining outputs sent to downstream components so that special characters are either encoded or safely handled, reducing the chance of shell interpretation.
  • Running web management components under least-privilege accounts, with restricted filesystem and process capabilities, so that any compromise has reduced blast radius.
  • Limiting remote exposure of administrative interfaces through network segmentation, access control lists, or management-only networks to reduce opportunities for exploitation.

How teams detect issues like this

Organizations can approach detection through a combination of code-centric and system-level techniques:

  • Static analysis: Configure rules to flag any use of shell-invoking functions (e.g., system, popen, exec with "/bin/sh") where arguments may derive from HTTP parameters such as private_key, especially in CGI handlers or router plugins.
  • Code review: During manual review, treat any string-based command construction in web administration code as a high-risk pattern, and verify that untrusted input paths are either sanitized or eliminated.
  • Policy enforcement: Enforce development policies that disallow direct shell concatenation in network-exposed components and mandate the use of safer process execution primitives or dedicated libraries.
  • Runtime monitoring: Deploy logging and monitoring on router or embedded systems (where feasible) to detect unusual command executions, unexpected processes, or anomalies in CGI handler behavior.
  • Automated tooling: Use firmware analysis platforms and SAST tools capable of scanning C/CGI code paths, correlating external inputs (HTTP parameters) to sensitive sinks (command execution) to uncover similar injection flaws.

Sources

SourceLink
github.comgithub.com/StrTzz123/iot_vul/blob/main/GL-iNet/MT3000/4.4.5/wg_generate_publickey_glc/CVE.md
vuldb.comvuldb.com/cve/CVE-2026-18615
vuldb.comvuldb.com/submit/851566
vuldb.comvuldb.com/vuln/385535
vuldb.comvuldb.com/vuln/385535/cti

Frequently asked

questions

Exploitability depends on how the router's management interface is exposed. If the /cgi-bin/glc endpoint is reachable from the internet or untrusted local users, an attacker can remotely trigger the flaw by sending crafted HTTP requests. In more restricted environments, the attack surface may be confined to authenticated or internal users.

At minimum, an attacker needs network access to the device's web or API interface where wg-server.generate_publickey is reachable. Authentication requirements depend on the deployment configuration; if the vulnerable endpoint lacks robust access control, exploitation can potentially be unauthenticated.

The safest pattern is to remove shell-based command execution from the code path entirely, relying instead on dedicated cryptographic or key-generation libraries. Where external tools are necessary, inputs must never be concatenated into shell command strings; instead, use APIs that pass parameters as discrete arguments and enforce strict validation of all user-controlled data.

Preventing future issues requires adopting secure coding standards for embedded web interfaces: avoid shell invocation where possible, apply rigorous input validation at trust boundaries, and integrate automated checks that flag command-construction patterns during development. Coupling these practices with regular security reviews of router management components significantly reduces the risk of repeat injection flaws.

Find out what's already
exploitable in your codebase.