Severity:

HIGH RISK

(7.3)

OS Command Injection in Totolink A7100RU setFirewallType

CVE-2026-5691

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-77, CWE-78

Impact:

Remote Code Execution on Router Firmware

Severity:

HIGH RISK

(7.3)

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

A command injection vulnerability in the setFirewallType function of /cgi-bin/cstecgi.cgi on Totolink A7100RU routers allows crafted input in the firewallType parameter to be interpreted as operating system commands.

When reachable over the network, an attacker can remotely execute arbitrary commands on the device, potentially taking full control of the router and its traffic.

Affected context

The issue occurs in the web management interface of Totolink A7100RU firmware version 7.4cu.2313_b20191024, specifically in the setFirewallType functionality exposed via /cgi-bin/cstecgi.cgi.

The vulnerability is relevant when:

  • The web interface is reachable over the local network or WAN (e.g., misconfigured remote management)
  • The firewallType parameter is processed server-side to configure firewall behavior
  • Input received via HTTP requests is passed into OS-level commands without sufficient sanitization or isolation

Exploit preconditions

  • Attack surface: HTTP(S) interface of the router at /cgi-bin/cstecgi.cgi
  • Required access: Ability to send crafted requests to the router (typically LAN access; WAN if remote management is exposed)
  • Trigger point: Invocation of the setFirewallType handler where user-controlled firewallType is consumed
  • Why exploitation is possible: The application constructs or passes shell commands using unsanitized user input, allowing attackers to inject additional command syntax that the underlying OS shell executes

Why this happens

This vulnerability stems from direct or concatenated use of user-supplied data (firewallType) in command-line invocations within the router's backend logic.

Instead of treating the parameter as pure data, the implementation appears to embed it in shell commands or invoke it through APIs that rely on shell parsing, without proper escaping, validation, or use of safe execution primitives.

This aligns with CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') and CWE-77: Improper Neutralization of Special Elements used in a Command, where special characters (such as separators, redirection operators, or metacharacters) are not filtered, enabling arbitrary command chaining.

Potential impact

  • Remote execution of arbitrary OS commands on the router
  • Complete compromise of router configuration (DNS, routing, firewall rules)
  • Traffic interception, redirection, or man-in-the-middle attacks on connected clients
  • Use of the router as a pivot point for attacks against internal network devices
  • Enrollment of the router into botnets for DDoS or other malicious campaigns

General mitigation guidance

Effective mitigation focuses on treating all web-facing parameters as untrusted and isolating them from command execution layers:

  • Replace shell-based command construction with direct system APIs or libraries that do not invoke a shell and accept only structured arguments
  • Enforce strict allowlists for firewallType and similar parameters, accepting only known-good values and rejecting or ignoring anything outside the expected set
  • Normalize and validate inputs at the boundary of the web handler, stripping or rejecting characters with special meaning to shells (e.g., ;, &, |, backticks)
  • Run web and configuration services under least-privilege accounts with minimal system capabilities, reducing the blast radius if input validation fails
  • Design configuration flows so that user data never directly influences command strings, but instead maps to internal enumerations or configuration flags

How teams detect issues like this

High-level strategies to detect similar command injection issues include:

  • Static analysis checks for dangerous APIs (e.g., system, popen, backtick execution, shell-based wrappers) where arguments contain HTTP parameter values or other user input
  • Code review patterns focused on:
  • String concatenation or formatting used to build command lines
  • Lack of centralized input validation/whitelisting around configuration parameters
  • Use of shell interpreters or command-line utilities in request handlers
  • Security testing and fuzzing of CGI endpoints with payloads containing shell metacharacters to identify anomalous behavior
  • CI-integrated security scanners that flag command construction involving variables sourced from HTTP requests, query strings, or form data

Sources

SourceLink
github.comgithub.com/Litengzheng/vuldb_new/blob/main/A7100RU/vul_189/README.md
vuldb.comvuldb.com/submit/792962
vuldb.comvuldb.com/vuln/355518
vuldb.comvuldb.com/vuln/355518/cti
totolink.nettotolink.net/

Frequently asked

questions

It can be, but only if the router's management interface or the vulnerable CGI endpoint is exposed beyond the local network (for example, via remote management features, port forwarding, or misconfiguration). Otherwise, exploitation typically requires local network access.

The attacker needs network-level access to send HTTP requests to the router's web interface. No additional local code execution is required; command execution happens on the router itself if the crafted firewallType parameter is processed.

The safest pattern is to remove shell invocation from configuration paths entirely and use safe, parameterized system APIs instead. Where system calls are unavoidable, enforce strict allowlists for parameters, avoid string concatenation for commands, and ensure that user input never reaches the shell parser unchecked.

Adopt a secure coding standard that bans direct shell command construction with user input, mandate centralized input validation and allowlisting for all web parameters, and integrate static analysis and security reviews into the development lifecycle. Designing management interfaces around structured configuration models (enums, flags, schemas) rather than command strings also significantly reduces the risk of command injection.

Find out what's already
exploitable in your codebase.