/

CVE-2026-118238

Severity:

HIGH RISK

(7.2)

OS Command Injection (CWE-78) in Tenda W18E Diagnose

CVE-2026-118238

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Root-Level Command Execution

Severity:

HIGH RISK

(7.2)

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 high-severity OS command injection vulnerability in the Tenda W18E web management server allows shell commands to be incorporated into packet-capture operations. An authenticated user may exploit improperly validated JSON fields, while devices in a factory-reset state may expose the same risk without authentication.

A high-severity OS command injection vulnerability in the Tenda W18E web management server allows shell commands to be incorporated into packet-capture operations. An authenticated user may exploit improperly validated JSON fields, while devices in a factory-reset state may expose the same risk without authentication.

Affected context

The vulnerability occurs in the Tenda W18E web management server's authenticated

"diagnose" packet-capture feature. It is present when values from JSON fields such

as protocol or targetDevice are insufficiently validated before being incorporated

into a tcpdump command. The exposure may be broader when the device is operating

in a factory-reset state.

The vulnerability occurs in the Tenda W18E web management server's authenticated

"diagnose" packet-capture feature. It is present when values from JSON fields such

as protocol or targetDevice are insufficiently validated before being incorporated

into a tcpdump command. The exposure may be broader when the device is operating

in a factory-reset state.

Exploit preconditions

  • Attack surface: Web management server and its packet-capture diagnostic feature
  • Required access: Normally authenticated web-management access; factory-reset devices may not require authentication
  • Trigger point: Processing a diagnostic request containing attacker-controlled JSON field values
  • Why exploitation is possible: Input is incorporated into a shell command without adequate separation from command syntax, and the resulting process runs with root privileges
  • Attack surface: Web management server and its packet-capture diagnostic feature
  • Required access: Normally authenticated web-management access; factory-reset devices may not require authentication
  • Trigger point: Processing a diagnostic request containing attacker-controlled JSON field values
  • Why exploitation is possible: Input is incorporated into a shell command without adequate separation from command syntax, and the resulting process runs with root privileges

Why this happens

The underlying defect is command construction from insufficiently trusted input.

Values from JSON fields are concatenated into a shell command rather than being treated

strictly as data or passed through a safe argument-handling interface. This permits

command syntax to influence execution, mapping to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

The underlying defect is command construction from insufficiently trusted input.

Values from JSON fields are concatenated into a shell command rather than being treated

strictly as data or passed through a safe argument-handling interface. This permits

command syntax to influence execution, mapping to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

Potential impact

  • An attacker may execute arbitrary operating-system commands
  • Device configuration, credentials, or network settings could be accessed or altered
  • The router may be fully compromised because the command executes with root privileges
  • Network traffic could be monitored, disrupted, or redirected
  • The device could be used to affect connected systems or participate in further attacks
  • An attacker may execute arbitrary operating-system commands
  • Device configuration, credentials, or network settings could be accessed or altered
  • The router may be fully compromised because the command executes with root privileges
  • Network traffic could be monitored, disrupted, or redirected
  • The device could be used to affect connected systems or participate in further attacks

General mitigation guidance

Mitigation generally focuses on removing shell interpretation from diagnostic workflows

and reducing the trust placed in management requests.

Common defensive patterns include:

  • Invoke diagnostic utilities through a process API that passes fixed argument arrays rather than constructing shell command strings
  • Apply strict allowlists and type validation to protocol, device, and interface-related fields
  • Reject unexpected characters, delimiters, and values before command construction
  • Require authentication and authorization for diagnostic operations in every device state
  • Run diagnostic processes with the lowest practical privileges and restrict their capabilities
  • Separate management-plane input handling from privileged system operations
  • Use secure-by-default factory-reset behavior that does not expose administrative functionality

Mitigation generally focuses on removing shell interpretation from diagnostic workflows

and reducing the trust placed in management requests.

Common defensive patterns include:

  • Invoke diagnostic utilities through a process API that passes fixed argument arrays rather than constructing shell command strings
  • Apply strict allowlists and type validation to protocol, device, and interface-related fields
  • Reject unexpected characters, delimiters, and values before command construction
  • Require authentication and authorization for diagnostic operations in every device state
  • Run diagnostic processes with the lowest practical privileges and restrict their capabilities
  • Separate management-plane input handling from privileged system operations
  • Use secure-by-default factory-reset behavior that does not expose administrative functionality

How teams detect issues like this

Detection approaches may include:

  • Static analysis rules for shell execution APIs, command-string concatenation, and user-controlled values reaching process invocation
  • Code review checks for JSON fields used in diagnostic, networking, or system utility commands
  • Runtime monitoring for unusual management requests and unexpected child processes launched by the web server
  • Policy enforcement requiring allowlisted command arguments and non-shell process execution
  • Automated security review tools that trace request parameters into privileged command execution

Detection approaches may include:

  • Static analysis rules for shell execution APIs, command-string concatenation, and user-controlled values reaching process invocation
  • Code review checks for JSON fields used in diagnostic, networking, or system utility commands
  • Runtime monitoring for unusual management requests and unexpected child processes launched by the web server
  • Policy enforcement requiring allowlisted command arguments and non-shell process execution
  • Automated security review tools that trace request parameters into privileged command execution

Sources

SourceLink
cushz.github.iocushz.github.io/en/exploit-development/2026/10/27/hacking-routers-for-fun-and-not-profit.html

Frequently asked

questions

It may be exploitable through the device's web management interface. Authentication is

generally required, but a factory-reset state may broaden exposure by allowing access

without authentication.

Under normal conditions, an attacker needs authenticated access to the web management

server and the packet-capture diagnostic feature. The required access may be reduced

when the device is in its factory-reset state.

Avoid shell-based command construction. Use fixed executable paths, structured argument

arrays, strict allowlists, and least-privilege execution for diagnostic operations.

Treat all management-plane input as untrusted, validate fields against explicit schemas,

enforce authentication in every operating state, and use static analysis and runtime

monitoring to identify data flows into privileged process execution.

It may be exploitable through the device's web management interface. Authentication is

generally required, but a factory-reset state may broaden exposure by allowing access

without authentication.

Under normal conditions, an attacker needs authenticated access to the web management

server and the packet-capture diagnostic feature. The required access may be reduced

when the device is in its factory-reset state.

Avoid shell-based command construction. Use fixed executable paths, structured argument

arrays, strict allowlists, and least-privilege execution for diagnostic operations.

Treat all management-plane input as untrusted, validate fields against explicit schemas,

enforce authentication in every operating state, and use static analysis and runtime

monitoring to identify data flows into privileged process execution.

Find out what's already
exploitable in your codebase.