Severity:

CRITICAL RISK

(9.8)

OS Command Injection in Totolink A7100RU CGI Handler

CVE-2026-6156

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-77, CWE-78

Impact:

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

Totolink A7100RU firmware 7.4cu.2313_b20191024 contains an OS command injection vulnerability in the setIpQosRules function of /cgi-bin/cstecgi.cgi, where the Comment parameter is unsafely passed to the underlying system.

A remote attacker can craft HTTP requests that inject arbitrary shell commands, potentially gaining full control over the affected router when the vulnerable CGI endpoint is reachable.

Affected context

The vulnerability occurs within the web-based management interface of Totolink A7100RU routers running firmware 7.4cu.2313_b20191024.

It specifically affects the CGI handler /cgi-bin/cstecgi.cgi, in the setIpQosRules functionality, when it processes the Comment argument as part of Quality of Service (QoS) configuration.

The issue is relevant in deployments where:

  • The router's web interface is exposed to untrusted networks (e.g., WAN or guest LAN), or
  • An attacker has network access to the management interface and can send crafted HTTP requests to the CGI endpoint.

Exploit preconditions

  • Attack surface: HTTP interface of the embedded web server on the router, targeting /cgi-bin/cstecgi.cgi.
  • Required access: Network-level access to the router's management interface; authentication requirements depend on configuration but should not be assumed as a defense.
  • Trigger point: Submission of a request that invokes setIpQosRules and passes a malicious payload in the Comment parameter.
  • Why exploitation is possible: User-supplied data in Comment is incorporated into OS-level commands without robust validation, encoding, or argument separation, allowing shell metacharacters to alter command structure and inject additional commands.

Why this happens

This vulnerability is rooted in insecure command construction patterns inside the CGI handler.

The setIpQosRules function appears to concatenate the untrusted Comment parameter directly into a shell command string that is executed by the operating system.

Because the input is not strictly validated, sanitized, or treated as a separate command argument, shell metacharacters and injected tokens are interpreted as part of the command itself.

This behavior maps to:

  • CWE-78: Improper Neutralization of Special Elements used in an OS Command, where external input is used to build a command line, and
  • CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), representing the broader class of command injection issues.

In abstract terms, the code trusts UI or HTTP parameters to be benign comments, but passes them into a command execution API in string form, effectively granting the requester partial control over the shell.

Potential impact

  • Remote execution of arbitrary OS commands with the privileges of the web server or underlying system user
  • Full compromise of the router, including configuration manipulation and traffic redirection
  • Installation of persistent malware or botnet agents on the device
  • Interception, modification, or logging of network traffic routed through the device
  • Use of the compromised router as a pivot point for attacking internal network hosts
  • Participation of the device in distributed denial-of-service (DDoS) attacks

General mitigation guidance

Effective mitigation focuses on eliminating direct command construction with untrusted data and tightening privilege boundaries:

  • Prefer higher-level system APIs or libraries (e.g., native QoS configuration interfaces) instead of shelling out to OS commands.
  • If command execution is unavoidable, construct commands using parameterized execution APIs that separate executable paths and arguments, avoiding shell interpretation.
  • Strictly validate and constrain the Comment parameter to an allowed character set and length, rejecting or normalizing any shell-special characters.
  • Introduce centralized input-handling routines for CGI parameters, with consistent validation and encoding policies.
  • Run the web server and related CGI handlers with least privilege, minimizing file system and network capabilities to reduce post-exploitation impact.
  • Restrict external exposure of the management interface (e.g., disable WAN access to admin UI, use management VLANs, require VPN for administration).

How teams detect issues like this

Detection can combine code-level review with runtime monitoring:

  • Static analysis: Configure rules or queries to flag any use of shell execution functions (e.g., system, popen, exec*, backticks) where user-controlled CGI parameters are passed directly into command strings.
  • Code review: Examine CGI handlers for string concatenation patterns involving HTTP parameters such as Comment, particularly in configuration or management functions.
  • Configuration audits: Identify devices with management interfaces exposed to the internet or untrusted networks, as these significantly expand the exploit surface.
  • Runtime monitoring: Monitor router logs, if available, for unusual command invocations or repeated malformed requests to /cgi-bin/cstecgi.cgi.
  • Automated tooling: Use SAST/IAST tools capable of modeling taint flow from HTTP parameters through to command execution sinks, and enforce policies blocking merges of new uses of shell APIs without proper sanitization.

Sources

SourceLink
github.comgithub.com/Litengzheng/vuldb_new/blob/main/A7100RU/vul_197/README.md
vuldb.comvuldb.com/submit/793681
vuldb.comvuldb.com/vuln/357036
vuldb.comvuldb.com/vuln/357036/cti
totolink.nettotolink.net/

Frequently asked

questions

It can be, if the router's web management interface or the /cgi-bin/cstecgi.cgi endpoint is exposed to the internet or any untrusted network. Otherwise, exploitation is typically limited to attackers with local network access.

That depends on how the device is configured. Some deployments may require authentication to reach setIpQosRules, while others may have weaker or misconfigured access controls. The core issue is that the parameter is not safely handled once an attacker can hit the endpoint.

Remove reliance on shell commands for configuration changes and instead call internal APIs or system libraries. If command execution must remain, use APIs that pass arguments as arrays (no shell parsing), apply strict input validation, and centralize sanitization logic.

Establish secure coding standards that prohibit direct concatenation of user input into command strings, mandate the use of safe wrappers for system calls, and require security-focused code reviews. Combine these with automated static analysis rules that flag tainted input reaching command execution functions.

Find out what's already
exploitable in your codebase.