/

CVE-2026-36841

Severity:

CRITICAL RISK

(9.8)

OS Command Injection in TOTOLINK N200RE V5 formMapDelDevice

CVE-2026-36841

Deferred

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 vulnerability in the TOTOLINK N200RE V5 router allows attacker-controlled data in the macstr and bandstr parameters to be executed as operating system commands.

When these parameters are processed by the formMapDelDevice function without proper sanitization, a remote attacker can execute arbitrary commands on the device, leading to full compromise of the router.

Affected context

This vulnerability affects TOTOLINK N200RE V5 devices that expose the web management interface where the formMapDelDevice function is reachable.

The issue occurs when user-supplied values in macstr and bandstr are passed into command-line contexts on the router without robust validation or escaping.

It is most relevant when the interface is accessible from untrusted networks, either directly from the internet or from untrusted clients on the local LAN.

Exploit preconditions

  • Attack surface: HTTP/S interface of the router's web management panel.
  • Required access: Ability to send crafted requests to the endpoint invoking formMapDelDevice with attacker-controlled macstr and bandstr parameters. In many deployments this may require at least network proximity to the router, and potentially access to the management session depending on configuration.
  • Trigger point: Submission of a malicious request that injects shell metacharacters or command fragments via macstr or bandstr, which are then incorporated into an OS command.
  • Why exploitation is possible: The application constructs shell commands using untrusted input from these parameters without rigorous input validation, canonicalization, or proper escaping, allowing the shell to interpret injected tokens as separate commands.

Why this happens

The root cause aligns with CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection').

The formMapDelDevice function appears to build or invoke operating system command lines using the macstr and bandstr parameters directly or via string concatenation.

Because these parameters are treated as trusted when composing shell commands, special characters such as ;, &&, |, or backticks can break out of the intended command structure.

This insecure pattern—embedding unvalidated external input into command interpreters—allows attackers to inject and run arbitrary commands with the privileges of the router's web service process.

Potential impact

  • Remote execution of arbitrary OS commands on the router.
  • Complete takeover of the router, including altering configuration, DNS settings, or routing rules.
  • Deployment of persistent backdoors or malware on the device.
  • Interception, modification, or redirection of user traffic passing through the router.
  • Use of the compromised router as a pivot point for further attacks inside the local network.
  • Enlistment of the device into botnets for DDoS or other coordinated attacks.

General mitigation guidance

Effective mitigation focuses on eliminating direct command interpreter usage for handling user-controlled data and enforcing strict input validation:

  • Replace shell-based command construction with direct API calls, system libraries, or built-in OS functions that avoid invoking a shell.
  • If invoking external commands is unavoidable, pass user input as data arguments to process APIs that do not use a command shell and do not interpret shell metacharacters.
  • Apply rigorous allowlist validation on macstr and bandstr, restricting them to expected formats (e.g., validated MAC address format and controlled band identifiers) and rejecting any unexpected characters or patterns.
  • Neutralize or escape all potentially dangerous shell metacharacters if there is any residual interaction with command interpreters.
  • Run the web management service and related processes with the minimum privileges needed, reducing the blast radius if command injection occurs.
  • Limit exposure of the management interface by placing it on trusted internal networks only and disabling remote administration from the internet by default.

How teams detect issues like this

Detection can leverage both code-centric and behavior-centric approaches:

  • Static analysis: Scan firmware and web application code for patterns where user-supplied parameters (such as macstr and bandstr) flow into command execution functions or shell invocation APIs, especially via string concatenation.
  • Code review: Examine request handlers like formMapDelDevice for any usage of system(), popen(), backticks, or equivalent functions where parameters are not strictly validated against expected formats.
  • Firmware analysis: Decompile or extract router firmware images and inspect CGI binaries, scripts, or configuration utilities for dangerous shell construction patterns.
  • Runtime monitoring: Where possible, monitor the router or similar devices for anomalous command executions or unexpected network connections that might indicate exploitation.
  • Policy enforcement: Incorporate security checks in the development pipeline requiring explicit justification for any shell invocation, paired with automated reviews focusing on input validation boundaries.

Sources

SourceLink
github.comgithub.com/0xmania/cve/tree/main/TOTOLINK-N200RE_V5-cstecgi-formMapDelDevice-CommandInjection

Frequently asked

questions

It can be, depending on how the router is deployed. If the web management interface is exposed directly to the internet or reachable via port forwarding, an external attacker may be able to exploit the command injection remotely. If access is limited to the local network, an attacker must first gain local network access.

That depends on whether the vulnerable endpoint is protected by authentication on a given device configuration. In some embedded web interfaces, certain handlers are insufficiently protected or reachable before authentication. Even when authentication is required, weak or default credentials can make exploitation easier.

The safest pattern is to remove all shell-based command construction from request handling code and instead use direct system APIs that treat inputs purely as data. In addition, enforce strict, allowlist-based validation for all parameters that influence system behavior, including format and length checks.

Preventive practices include designing components to avoid shell invocation entirely in web handlers, adopting secure coding guidelines for embedded systems, using automated static analysis to flag unsafe command construction, and performing targeted security reviews on all code that bridges user input with OS-level operations. Limiting management interface exposure and enforcing strong authentication also reduces the risk of exploitation in deployed devices.

Find out what's already
exploitable in your codebase.