/

CVE-2026-31175

Severity:

CRITICAL RISK

(9.8)

OS Command Injection in ToToLink A3300R STUN Configuration

CVE-2026-31175

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-77

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

A command injection flaw in the ToToLink A3300R router firmware allows arbitrary OS commands to be executed via the stunEnable parameter in the /cgi-bin/cstecgi.cgi endpoint.

When exposed to untrusted networks or reachable by a compromised client, this issue can give attackers full control over the device operating system with no user interaction.

Affected context

This vulnerability occurs in ToToLink A3300R devices running firmware v17.0.0cu.557_B20221024, specifically in the web management interface handling STUN (Session Traversal Utilities for NAT) configuration.

The CGI handler at /cgi-bin/cstecgi.cgi processes the stunEnable parameter in a way that is susceptible to command injection.

The risk is highest when:

  • The router's web administration interface is accessible from the WAN or untrusted internal networks
  • Default or weak credentials are used, or other flaws allow bypassing authentication
  • Scripts or integrations automatically call the STUN-related functionality without validation

Exploit preconditions

  • Attack surface: HTTP(S) interface of the router, via /cgi-bin/cstecgi.cgi
  • Required access: Ability to send crafted HTTP requests to the management interface (often authenticated, but may vary by configuration or other weaknesses)
  • Trigger point: Submission of a specially crafted stunEnable parameter value during STUN configuration handling
  • Why exploitation is possible: User-controlled input from stunEnable is incorporated into underlying command execution without proper sanitization, encoding, or safe API usage, allowing shell metacharacters to be interpreted by the OS.

Why this happens

The underlying issue is an OS command injection vulnerability as described in CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection').

The application appears to pass the stunEnable parameter directly into a system-level command or shell invocation, either via functions such as system(), popen(), or equivalent mechanisms, without:

  • Validating that the input is strictly constrained to expected values (e.g., boolean flags)
  • Neutralizing shell metacharacters and control operators
  • Using parameterized, non-shell-based APIs to perform configuration changes

As a result, attacker-controlled input can break out of the intended command context and inject additional commands to be executed with the router's process privileges.

Potential impact

  • Full remote code execution on the router's underlying operating system
  • Installation of persistent malware or botnet agents on the device
  • Modification of DNS or routing settings to intercept, redirect, or surveil user traffic
  • Use of the compromised router as a pivot point to attack internal network hosts
  • Participation in large-scale DDoS campaigns or other abusive activity
  • Loss of integrity and confidentiality of network traffic that traverses the device

General mitigation guidance

Mitigations should focus on eliminating the ability of attacker-controlled input to reach command interpreters and on reducing the device's exposure:

  • Replace any shell-based command construction with safer, parameterized APIs that do not involve a command interpreter.
  • Treat configuration fields like stunEnable as strictly typed values (e.g., true/false or enumerations) and reject anything outside a small, well-defined set.
  • Apply robust input validation at the server side, including whitelisting acceptable characters and formats for all CGI parameters.
  • Avoid composing shell commands by string concatenation or interpolation; if a shell is unavoidable, rigorously escape and sanitize all arguments before execution.
  • Run web management and CGI handlers with least-privilege accounts and restrict access to only necessary system resources.
  • Limit remote access to the management interface by:
  • Disabling WAN administration where not strictly required
  • Restricting management to trusted internal networks or dedicated management VLANs
  • Using strong authentication and avoiding default credentials

How teams detect issues like this

Detection efforts can combine code-level analysis with runtime monitoring:

  • Static analysis: Scan firmware code (or extracted CGI binaries/scripts) for patterns such as:
  • Direct use of system(), popen(), exec*(), or shell invocations that include unsanitized request parameters
  • Command strings built via concatenation of environment variables, query parameters, or POST data
  • Code review signals:
  • CGI handlers reading parameters like stunEnable and passing them directly into shell commands or configuration scripts
  • Lack of strict type checking or bounds checking on configuration parameters before use in system calls
  • Policy enforcement:
  • Development standards that prohibit shell-based command execution for web-facing code
  • CI/CD checks or firmware build-time gates that fail builds if unsafe command construction patterns are detected
  • Runtime and network monitoring:
  • Logging and analyzing requests to /cgi-bin/cstecgi.cgi for anomalous payloads, such as shell metacharacters or unusual parameter values
  • Behavioral monitoring of routers (where feasible) for unexpected outbound connections, spikes in traffic, or suspicious processes that could indicate exploitation

Sources

SourceLink
github.comgithub.com/Svigo-o/TOTOLINK-Vul/tree/main/totolink-a3300r-stun-enable-cmd-injection

Frequently asked

questions

It can be, if the router's management interface is exposed to the WAN or reachable from an attacker-controlled network segment. Where management is restricted to internal networks, the attacker would need access to that internal environment or a compromised internal host.

Often, exploitation requires the ability to interact with the configuration functionality, which may be protected by authentication. However, the practical requirement depends on the router's configuration, the presence of default/weak credentials, and whether other flaws allow bypassing authentication. Administrators should assume that if an attacker can reach the endpoint and control stunEnable, exploitation is possible.

The safest approach is to eliminate shell-based command execution for user-supplied data entirely. Use dedicated system APIs or libraries for configuration changes, treat all inputs as untrusted, strictly constrain them to expected types and values, and enforce rigorous validation before they reach any privileged operation.

Adopt secure coding practices that forbid direct concatenation of user input into command strings, enforce strict input validation and whitelisting, and include security-focused code reviews and automated static analysis in the development lifecycle. For device deployments, reduce exposure of management interfaces and enforce strong authentication to limit opportunities for exploitation.

Find out what's already
exploitable in your codebase.