Severity:

CRITICAL RISK

(9.8)

OS Command Injection in Totolink A7100RU CGI Handler

CVE-2026-6138

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-77, CWE-78

Impact:

Remote Code Execution on the 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

Totolink A7100RU routers contain an OS command injection flaw in the CGI handler function setAccessDeviceCfg, where the mac parameter is passed to the operating system without proper sanitization.

A remote attacker who can reach the router's web interface can craft malicious requests that execute arbitrary commands on the device, leading to full takeover of the router.

Affected context

This vulnerability affects Totolink A7100RU devices running firmware 7.4cu.2313_b20191024 that expose the /cgi-bin/cstecgi.cgi endpoint.

The issue resides in the setAccessDeviceCfg CGI handler, which processes a mac parameter from HTTP requests and uses it in backend system calls.

The risk is highest when the router's management interface is accessible from untrusted networks (e.g., WAN exposure, insecure Wi‑Fi, or bridged management VLANs).

Exploit preconditions

  • Attack surface: HTTP(S) interface to /cgi-bin/cstecgi.cgi on the Totolink A7100RU router.
  • Required access: Network-level access to the router's web management service; authentication may or may not be required depending on configuration and other weaknesses.
  • Trigger point: Submission of a crafted request to the setAccessDeviceCfg handler with a specially formed mac argument.
  • Why exploitation is possible: The mac parameter is concatenated or interpolated into a shell command without strict validation, quoting, or safe command-building APIs, enabling injection of additional shell metacharacters and commands.

Why this happens

The core issue is improper handling of user-controlled input in OS command construction, aligning with CWE-78: Improper Neutralization of Special Elements used in an OS Command.

The CGI handler setAccessDeviceCfg appears to treat the mac parameter as trusted and passes it directly into a shell command context, likely through APIs such as system(), popen(), or equivalent wrappers.

Without robust input validation, escaping, or safer execution primitives (e.g., argument-vector based exec calls), shell metacharacters embedded in the mac value are interpreted by the shell, allowing the attacker to execute arbitrary commands with the privileges of the web/CGI process.

This pattern reflects a broader bug class where configuration or management inputs are mixed into shell commands rather than being modeled as data and handled by dedicated APIs.

Potential impact

  • Remote execution of arbitrary OS commands on the router.
  • Full compromise of router configuration, including DNS, routing, and firewall rules.
  • Installation of persistent malware or backdoors on the device.
  • Interception, modification, or redirection of network traffic passing through the router.
  • Use of the compromised device as part of a botnet or as a pivot into the internal network.
  • Extraction of sensitive information such as Wi‑Fi credentials or administrative passwords stored on the router.

General mitigation guidance

Effective mitigation focuses on eliminating command injection sinks and reducing trust in management inputs:

  • Replace shell-based command construction with direct system APIs that accept structured arguments (e.g., APIs that do not invoke a shell).
  • Treat all HTTP parameters, including those that "look like" MAC addresses, as untrusted input and validate them against strict allowlists (e.g., canonical MAC address format).
  • Avoid passing user-supplied values into command strings; if external tools must be invoked, use argument arrays and avoid shell interpretation.
  • Enforce least-privilege execution for the web/CGI process so that, if compromised, it has minimal access to the underlying system.
  • Limit management interface exposure to trusted networks only, and disable WAN management by default.
  • Adopt secure-by-default firmware design practices, such as central input validation layers for all CGI handlers.

How teams detect issues like this

Detection typically combines code-centric review and runtime monitoring:

  • Static analysis: Define rules to flag uses of system, popen, exec*, or similar APIs where arguments contain HTTP parameters like mac or other CGI variables; check for string concatenation or formatting that mixes user input with shell metacharacters.
  • Code review: During manual review, inspect CGI handlers and router management endpoints for:
  • Direct construction of shell commands using request parameters.
  • Lack of centralized validation for configuration inputs.
  • Assumptions that certain parameters (e.g., MAC addresses) are inherently safe.
  • Policy enforcement: Introduce secure coding guidelines that prohibit shell invocation with raw user input in firmware code and enforce these via pre-commit hooks or CI checks.
  • Runtime monitoring: Where feasible, log and monitor unusual command execution patterns or anomalous HTTP requests targeting /cgi-bin/cstecgi.cgi with unexpected mac values.

Sources

SourceLink
github.comgithub.com/Litengzheng/vuldb_new/blob/main/A7100RU/vul_191/README.md
vuldb.comvuldb.com/submit/792980
vuldb.comvuldb.com/vuln/357002
vuldb.comvuldb.com/vuln/357002/cti
totolink.nettotolink.net/

Frequently asked

questions

It can be, if the router's web management interface (especially /cgi-bin/cstecgi.cgi) is exposed to the internet or accessible from an attacker-controlled network segment. If management access is restricted to an internal network, exploitation is limited to attackers with internal access.

That depends on the router's configuration and any additional weaknesses. If the vulnerable CGI endpoint is accessible without authentication or if credentials can be obtained or bypassed through other flaws, an attacker can exploit the command injection remotely.

The safest pattern is to remove shell-dependent logic from management handlers entirely. Use dedicated system APIs that accept structured parameters, apply strict input validation (e.g., for MAC address format), and ensure no user input is ever interpolated into shell command strings.

Prevention involves adopting defensive design practices: treat all external input as untrusted, centralize validation, avoid shell invocation in web handlers, enforce least-privilege for management services, and integrate static analysis plus security-focused code review into the firmware development lifecycle.

Find out what's already
exploitable in your codebase.