/

CVE-2026-26795

Severity:

CRITICAL RISK

(9.8)

OS Command Injection in GL-iNet GL-AR300M16 System Log

CVE-2026-26795

Modified

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-77

Impact:

Remote Code Execution on Router

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-AR300M16 routers running firmware v4.3.11 contain an OS command injection flaw in the M.get_system_log function, where the module parameter is unsafely incorporated into system-level commands.

A remote attacker who can reach the router's management interface can send crafted input in this parameter to execute arbitrary commands with the router's privileges, potentially fully compromising the device and its network role.

Affected context

The vulnerability exists in the web or RPC management logic of GL-iNet GL-AR300M16 routers, specifically in the M.get_system_log functionality that retrieves system log data.

The issue arises when the module parameter is used to build shell commands without proper neutralization of special characters.

It is most relevant in deployments where the management API or web interface is reachable from untrusted networks (e.g., WAN exposure, VPN access, or compromised local clients), and where default or weak management protections are in place.

Exploit preconditions

  • Attack surface: Router management interface or associated API exposing M.get_system_log
  • Required access: Ability to invoke the log retrieval function (e.g., HTTP/JSON-RPC request); may depend on authentication configuration
  • Trigger point: Submission of a crafted module parameter value that is passed into a shell command
  • Why exploitation is possible: User-controlled data is concatenated or interpolated into a shell command without proper quoting, escaping, or use of safe command invocation APIs, enabling injection of additional commands

Why this happens

The underlying bug is a classic OS command injection issue.

The M.get_system_log function appears to construct shell commands by embedding the module parameter directly into a command string.

Without rigorous input neutralization, quoting, or use of safe process-spawning APIs that avoid the shell, the router interprets attacker-supplied metacharacters (such as command separators or redirection operators) as part of the command syntax.

This behavior aligns with CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), where untrusted input is allowed to alter the structure of an executed command instead of being treated as pure data.

Potential impact

  • Execution of arbitrary OS commands with the privileges of the web/management service
  • Complete takeover of the router, including persistent malware installation
  • Interception, modification, or redirection of network traffic through the device
  • Extraction of configuration data, including Wi-Fi credentials and VPN keys
  • Use of the router as a pivot point for attacks against internal network hosts
  • Enrollment of the device into botnets for DDoS or other malicious activity

General mitigation guidance

Effective mitigation focuses on preventing untrusted input from influencing shell command structure and reducing the privileges of components that must run commands:

  • Replace shell-based command construction with safe process invocation APIs (e.g., exec family with argument arrays, libraries that bypass the shell).
  • Treat all external parameters (like module) as untrusted and enforce strict allowlists of expected values instead of passing arbitrary strings to commands.
  • Apply rigorous input validation that rejects characters and patterns that are not valid in log module identifiers, combined with robust encoding/quoting when interaction with the shell is unavoidable.
  • Design the logging and diagnostic subsystem so that user-selectable options map to predefined internal actions rather than free-form commands.
  • Run the management interface and any helper processes with the least privileges required and restrict filesystem and network capabilities to limit impact if compromise occurs.

How teams detect issues like this

Organizations can detect and manage command injection risks in embedded firmware and web management interfaces using a combination of static and dynamic approaches:

  • Static analysis: Configure rules to flag dynamic shell command construction, such as string concatenation passed to system(), popen(), backticks, or similar APIs, especially when parameters derive from HTTP/query inputs.
  • Code review: Treat any shell invocation in request-handling paths as a high-risk pattern; reviewers should verify the presence of strict validation and the use of argument arrays instead of shell strings.
  • Firmware and configuration scanning: Use automated tools to inspect router firmware for common command execution APIs and map them back to externally reachable endpoints.
  • Runtime monitoring: Where possible, monitor router logs for anomalous command execution, unexpected process spawning, or unusual outbound connections that may indicate exploitation attempts.

Sources

SourceLink
github.comgithub.com/sezangel/IOT-vul/tree/main/GL-iNet/GL-AR300M16/logread--get_system_log

Frequently asked

questions

It can be, if the router's management interface or associated APIs are exposed to the internet or reachable via remote access (e.g., port forwarding, cloud management, or VPN). If management is restricted to a trusted LAN and well-protected, exploitation is typically limited to local or already-compromised clients.

That depends on the specific deployment and configuration. If the vulnerable function requires authentication and strong credentials are enforced, an attacker would generally need to obtain or bypass those credentials. Misconfigurations, default passwords, or other flaws can reduce or eliminate this barrier.

Remove shell-based command construction from request-handling code and replace it with fixed, predefined operations implemented via safe APIs. When commands are unavoidable, use argument-based process execution (no shell), strict allowlists for user-selectable options, and avoid passing user-controlled strings into the shell.

Adopt secure coding guidelines that prohibit direct shell invocation with untrusted data, enforce input validation and allowlists at API boundaries, include targeted static analysis rules in the development pipeline, and require security-focused reviews for any code that interacts with the operating system or external processes.

Find out what's already
exploitable in your codebase.