Severity:

CRITICAL RISK

(9.8)

OS Command Injection in Totolink A7100RU setUPnPCfg CGI

CVE-2026-5851

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-77, CWE-78

Impact:

Remote Code Execution on Network 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 firmware 7.4cu.2313_b20191024 contains an OS command injection vulnerability in the setUPnPCfg handler of /cgi-bin/cstecgi.cgi, where the enable parameter is insufficiently sanitized before being passed to the system shell.

A remote attacker can exploit this flaw to execute arbitrary system commands on the router, potentially taking full control of the device when the vulnerable CGI endpoint is exposed to the network.

Affected context

The vulnerability appears in the web-based management interface of Totolink A7100RU devices running firmware 7.4cu.2313_b20191024.

It is associated with the CGI handler at /cgi-bin/cstecgi.cgi, specifically in the setUPnPCfg functionality that configures UPnP settings.

The issue arises when user-supplied data in the enable parameter is incorporated into shell commands without robust validation or escaping.

The risk is most pronounced when the administration interface is reachable over WAN or untrusted LAN segments, or when router credentials are weak or reused.

Exploit preconditions

  • Attack surface: HTTP(S) interface exposed by the router's web management panel (/cgi-bin/cstecgi.cgi).
  • Required access: Ability to send crafted HTTP requests to the vulnerable CGI endpoint; depending on deployment, this may require admin credentials or may be possible from any host that can reach the interface.
  • Trigger point: Invocation of the setUPnPCfg function with a malicious enable argument that is later interpolated into a shell command.
  • Why exploitation is possible: The handler constructs or passes command-line parameters directly to the OS shell without strict validation, canonicalization, or escaping, allowing injected metacharacters to alter the intended command.

Why this happens

This vulnerability stems from constructing operating system commands using untrusted input in the CGI handler.

The setUPnPCfg implementation likely concatenates the enable parameter into a command string passed to a shell (e.g., via system, popen, or similar APIs) without enforcing a strict value set or removing shell metacharacters.

This matches CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') and is closely related to CWE-77: Command Injection.

At an abstract level, application logic treats external configuration parameters as trusted and mixes them into command lines, giving attackers control over the structure and behavior of the executed command rather than just its data.

Potential impact

  • Remote execution of arbitrary system commands on the router.
  • Full compromise of the router, including persistent configuration changes and firmware tampering.
  • Interception, redirection, or manipulation of network traffic passing through the device.
  • Use of the router as a foothold for lateral movement within the local network.
  • Enrollment of the router into botnets or participation in DDoS and other large-scale attacks.
  • Extraction of sensitive configuration data such as Wi-Fi credentials or VPN settings.

General mitigation guidance

Effective mitigation usually focuses on removing the ability for untrusted input to influence shell command structure and reducing the exposure of management interfaces:

  • Replace shell-based configuration calls with direct API or system library calls that do not rely on command-line parsing.
  • Enforce strict whitelisting on parameters like enable, limiting values to a small, validated set (e.g., 0 or 1).
  • Avoid string concatenation into shell commands; where shell invocation is unavoidable, use argument-based APIs that avoid parsing by the shell.
  • Apply strong input validation and canonicalization at the boundary of CGI handlers, rejecting any input containing shell metacharacters or unexpected tokens.
  • Run web management processes with least privilege and constrained capabilities, so that a compromise has limited impact.
  • Restrict access to the web management interface to trusted networks, and encourage users to disable remote administration when not needed.

How teams detect issues like this

Detection approaches can combine code-centric and operational perspectives:

  • Static analysis: Configure rules to flag uses of shell-executing APIs (system, popen, backticks, etc.) where any part of the command originates from HTTP parameters or other external input without strict sanitization.
  • Code review: During manual reviews, pay attention to CGI handlers and configuration endpoints that build command strings; verify that parameters like enable are constrained to known-safe values.
  • Configuration and policy checks: Enforce secure coding guidelines requiring parameter whitelisting and forbidding direct shell use when safer APIs exist.
  • Runtime monitoring: Use network IDS/IPS or WAF-like signatures to detect suspicious payloads targeting /cgi-bin/cstecgi.cgi, particularly requests containing shell metacharacters in query parameters or form fields.

Sources

SourceLink
github.comgithub.com/Litengzheng/vuldb_new/blob/main/A7100RU/vul_157/README.md
vuldb.comvuldb.com/submit/791271
vuldb.comvuldb.com/vuln/356377
vuldb.comvuldb.com/vuln/356377/cti
totolink.nettotolink.net/

Frequently asked

questions

Public exploit code is available, and exploitation is straightforward once an attacker can reach the router's management interface, making this a high-risk issue for exposed devices.

It depends on how the endpoint is implemented and configured; in some deployments the vulnerable CGI may require authentication, while in others weak or default credentials or misconfigurations may effectively make it accessible.

The most robust fix is to eliminate shell command construction from CGI handlers, use dedicated system APIs for configuration changes, and strictly whitelist allowed parameter values instead of trying to filter out bad characters.

Adopt secure coding practices that forbid direct shell invocation with user-controlled data, enforce thorough input validation at trust boundaries, integrate static analysis for command injection patterns into the build pipeline, and limit the exposure of administrative interfaces by default.

Find out what's already
exploitable in your codebase.