/

CVE-2026-26791

Severity:

CRITICAL RISK

(9.8)

OS Command Injection in GL-iNet GL-AR300M16 Echo Server

CVE-2026-26791

Modified

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-77

Impact:

Remote Code Execution on Embedded Network Device

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 firmware v4.3.11 contains an OS command injection flaw in the enable_echo_server function, where the string port parameter is used unsafely in shell commands.

An attacker who can supply crafted input to this parameter may execute arbitrary system commands on the device with the privileges of the underlying service, leading to full compromise of the router.

Affected context

The vulnerability occurs in the router firmware of the GL-iNet GL-AR300M16 (version 4.3.11), specifically in logic that enables or configures an echo server.

The issue is present when user-controllable data (the port parameter) is passed to command-line utilities or shell execution routines without strict validation or escaping.

It is most relevant in deployments where management interfaces or APIs exposing the echo server functionality are reachable from untrusted networks, or where untrusted users can invoke the relevant configuration endpoint.

Exploit preconditions

  • Attack surface: Network-accessible management interface, web UI, or API that invokes enable_echo_server.
  • Required access: Ability to submit or influence the string port parameter (e.g., via HTTP request, RPC call, or configuration field).
  • Trigger point: Invocation of enable_echo_server that builds and executes a shell command using the untrusted port input.
  • Why exploitation is possible: The port parameter is treated as a trusted string and concatenated into a shell command without adequate sanitization, quoting, or use of safe command execution APIs, enabling injection of additional shell metacharacters and commands.

Why this happens

This issue is a classic OS Command Injection vulnerability as described by CWE-77.

The firmware code behind enable_echo_server appears to construct shell commands by directly concatenating the port parameter into a command string, which is then executed by a shell interpreter.

Because the input is not constrained to numeric port values and is not safely encoded or validated, an attacker can inject shell metacharacters (such as separators or redirection operators) that the shell interprets as additional commands.

The abstract insecure pattern is: untrusted input → interpolated into command string → executed by shell, rather than using strict parameterization or non-shell APIs.

Potential impact

  • Execution of arbitrary system commands on the GL-AR300M16 device
  • Installation of persistent malware or backdoors on the router
  • Full compromise of router configuration, including network credentials and keys
  • Interception, modification, or redirection of user traffic passing through the device
  • Use of the device as a pivot point for attacks against internal networks
  • Enrollment of the router into botnets or participation in distributed attacks

General mitigation guidance

Effective mitigation focuses on removing the dependency on shell-based command construction and constraining input to safe, expected formats:

  • Replace shell command construction with direct API calls or system libraries that configure services without invoking a shell.
  • Treat the port parameter as strictly numeric: enforce type checks, range checks, and reject any non-digit input before use.
  • Where invoking external programs is unavoidable, use system calls that separate command and arguments into arrays (no shell) and avoid passing composite strings to a shell interpreter.
  • Apply least-privilege principles so that services handling user input run with minimal permissions and limited access to the broader system.
  • Harden management interfaces by restricting exposure to trusted networks, using strong authentication, and optionally isolating administrative functions from general user traffic.

How teams detect issues like this

Detection can combine code-centric and runtime approaches:

  • Static analysis: Configure rules that flag calls to system(), popen(), exec*, or similar APIs where arguments contain user-controllable variables such as port, query, or parameter fields.
  • Code review: Look for patterns where string concatenation or formatting is used to build shell commands, especially in request-handling or configuration code paths.
  • Firmware and configuration audits: Regularly review router firmware code and scripts for shell invocations that rely on unvalidated input.
  • Runtime monitoring: Enable logging for management interfaces and watch for anomalous port values or suspicious characters in parameters; network IDS/IPS signatures can help identify common command injection patterns.
  • Automated SAST and firmware analysis platforms can be integrated into build pipelines to highlight command injection patterns early in development.

Sources

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

Frequently asked

questions

Exploitability depends on how the echo server functionality is exposed. If the interface that accepts the port parameter is reachable from untrusted networks (for example, if the router's management interface is accessible from the WAN), remote attackers may exploit it without prior compromise. If exposure is limited to the LAN, attackers must first gain access to the local network or a position where they can send requests to the device.

Not necessarily. If the endpoint that triggers enable_echo_server is unauthenticated or weakly protected, an attacker can abuse it directly. If it sits behind authentication, an attacker would need to obtain valid credentials or exploit another weakness to reach the vulnerable code path.

The most robust fix is to eliminate shell-based command construction entirely. Use system libraries or APIs that configure the echo server directly or invoke external programs via parameterized exec-style calls, never interpolating untrusted strings into shell commands. Combine this with strict validation that only allows expected numeric port values.

Adopt secure coding guidelines for command execution: never pass untrusted input to a shell, enforce strict validation on all externally sourced parameters, and implement regular security review of management-plane features. Integrate static analysis and security-focused code review into the development lifecycle so command injection patterns are detected before release.

Find out what's already
exploitable in your codebase.