/

CVE-2026-31177

Severity:

CRITICAL RISK

(9.8)

OS Command Injection in ToToLink A3300R STUN Configuration

CVE-2026-31177

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution on Router Firmware

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 vulnerability in ToToLink A3300R firmware v17.0.0cu.557_B20221024 allows arbitrary operating system commands to be executed via the stunMinAlive parameter in the /cgi-bin/cstecgi.cgi endpoint.

When exposed to untrusted networks or weakly protected interfaces, an attacker can remotely run system-level commands on the router with high impact on confidentiality, integrity, and availability.

Affected context

The vulnerability occurs in the web management interface of ToToLink A3300R routers running firmware v17.0.0cu.557_B20221024.

It specifically affects requests sent to /cgi-bin/cstecgi.cgi that process the stunMinAlive parameter, likely as part of STUN or NAT traversal configuration.

The risk is highest when:

  • The management interface is reachable from the internet or untrusted internal networks, and/or
  • Authentication or access control is weak, misconfigured, or bypassable.

Exploit preconditions

  • Attack surface: HTTP(S) interface exposed by the router at /cgi-bin/cstecgi.cgi.
  • Required access: Ability to send crafted requests to the management interface; depending on deployment, this may require local network access, authenticated access, or just raw network reachability if protections are weak.
  • Trigger point: Submission of a malicious value in the stunMinAlive parameter that is later passed to an OS-level command interpreter.
  • Why exploitation is possible: The parameter is incorporated into a system command without strict validation, sanitization, or safe API usage, allowing attacker-controlled data to alter the command executed by the underlying shell.

Why this happens

This is a classic OS command injection issue where untrusted input is used to build or influence shell commands.

The handler behind /cgi-bin/cstecgi.cgi appears to concatenate or interpolate the stunMinAlive parameter into a command string that is executed by the operating system, rather than using parameterized, non-shell APIs.

Under CWE-78, the core bug class is trusting user-controlled input within command lines without robust validation, encoding, or separation between data and executable instruction, enabling attackers to inject additional shell metacharacters and commands.

Potential impact

  • Remote execution of arbitrary system commands on the router.
  • Complete compromise of router configuration and management plane.
  • Interception, redirection, or disruption of network traffic routed through the device.
  • Deployment of malware or persistent backdoors on the router.
  • Use of the compromised router as a pivot point to attack internal network hosts.
  • Participation of the router in botnets, DDoS attacks, or other large-scale abuse.

General mitigation guidance

Mitigation typically focuses on removing the ability of user input to influence shell commands and on tightening exposure of the management interface.

Recommended patterns include:

  • Replace shell command construction with direct, parameterized system APIs that do not invoke a shell.
  • Strictly validate and constrain input such as stunMinAlive to expected numeric ranges or enumerated values before use.
  • Apply robust input normalization and reject any values containing shell metacharacters or unexpected syntax.
  • Run web management components with least privilege, separating them from critical system services where possible.
  • Restrict external exposure of the management interface using firewall rules, VPN-only access, and strong authentication to reduce attack surface.

How teams detect issues like this

Detection can be approached at both code and operational levels:

  • Static analysis: Search firmware or CGI sources for uses of system, popen, shell backticks, or similar APIs where request parameters (e.g., stunMinAlive) are concatenated into command strings.
  • Code review: Flag any logic in CGI scripts that:
  • Builds shell commands using string concatenation or formatting with HTTP parameters.
  • Lacks input validation or relies solely on client-side checks for configuration values.
  • Dynamic and runtime monitoring: Inspect HTTP access logs for unusual or malformed values in stunMinAlive and related parameters.
  • Firmware security testing: Use automated web scanners and firmware analysis tools to identify command injection patterns and verify they are blocked by validation and safe APIs.

Sources

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

Frequently asked

questions

It can be, if the router's management interface is exposed to the internet or reachable from an untrusted network segment and no additional access controls effectively block requests to /cgi-bin/cstecgi.cgi.

The attacker needs the ability to send HTTP requests to the vulnerable endpoint. Depending on how the device is deployed, this might require only being on the same local network, or in poorly configured cases, no authentication at all.

Avoid invoking shell commands with user-controlled input. Where system interactions are necessary, use parameterized APIs that bypass the shell entirely and enforce strict input validation on all configuration parameters.

Adopt secure coding standards that forbid direct shell invocation with request data, introduce centralized validation routines for all user input, apply defense-in-depth with least-privilege execution, and incorporate security-focused code review and automated analysis into the development lifecycle.

Find out what's already
exploitable in your codebase.