/

CVE-2026-59800

Severity:

CRITICAL RISK

(9.8)

OS Command Injection (CWE-78) in 9Router Tailscale API

CVE-2026-59800

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution with potential full system compromise

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

9Router exposes an unauthenticated API endpoint that passes user-controlled input directly into a sudo -S sh shell, leading to OS command injection.

When sudo does not actually require a password, the supplied sudoPassword value is executed as shell commands, enabling remote attackers to run arbitrary system commands without prior access.

Affected context

This vulnerability appears in 9Router deployments that expose the /api/tunnel/tailscale-install endpoint without additional authentication or network-layer protections.

It is most relevant when:

  • The 9Router process is running with elevated privileges (e.g., root), or
  • Sudo is configured with NOPASSWD for the invoked command, or
  • A valid sudo timestamp cache makes sudo skip password prompts.

Under these circumstances, the sudoPassword field in the HTTP POST body may be interpreted as shell input rather than as an authentication credential.

Exploit preconditions

  • Attack surface: HTTP POST requests to /api/tunnel/tailscale-install on a reachable 9Router instance.
  • Required access: Network access to the router's API endpoint; no authentication is enforced by the dashboard middleware on this route.
  • Trigger point: Sending crafted data in the sudoPassword field, which is piped to the stdin of a sudo -S sh child process.
  • Why exploitation is possible: When sudo does not prompt for a password (due to root execution, NOPASSWD rules, or cached credentials), the shell interprets the stdin contents as commands, turning a supposed password field into arbitrary command input.

Why this happens

The core issue is direct concatenation of untrusted request data into a shell execution context, mapping to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

The implementation uses sudo -S sh with stdin sourced from user input, assuming it will be treated purely as a password.

In cases where sudo bypasses password verification, the input stream is no longer constrained to authentication data and instead becomes executable shell script, creating a classic command injection scenario.

Potential impact

  • Remote attackers may execute arbitrary OS commands on the 9Router host.
  • Attackers could install persistent malware or backdoors on the device.
  • System configuration and routing policies can be modified or disabled.
  • Sensitive data traversing the router (logs, keys, configuration) may be accessed or exfiltrated.
  • The compromised router can be used as a pivot for further attacks inside the connected networks.

General mitigation guidance

Effective mitigation focuses on eliminating untrusted data flows into shell processes and enforcing strict access control on administrative endpoints.

Recommended patterns include:

  • Avoid invoking generic shells (e.g., sh) with user-supplied stdin; instead, implement controlled command execution using parameterized APIs or well-defined binaries.
  • Treat all HTTP request fields as untrusted and avoid reusing them in authentication channels that can silently bypass prompts.
  • Introduce authentication and authorization checks for all administrative or installation endpoints, ensuring they are covered by middleware and policy enforcement.
  • Run router services with least-privilege accounts that do not rely on broad sudo permissions, thereby reducing the blast radius of any execution path.
  • Implement strict allowlists for system operations initiated via APIs, validating intent rather than passing raw command strings.

How teams detect issues like this

Detection is typically achieved through a combination of code-level analysis and operational monitoring:

  • Static analysis can flag patterns where web request parameters are passed to shell execution functions, system calls, or sudo without sanitization or command separation.
  • Code reviews should pay special attention to routes that bypass standard middleware, checking that authentication and authorization are consistently applied.
  • Runtime monitoring and logging of command executions initiated by application processes can surface suspicious patterns, such as unexpected sudo -S sh invocations or unusual arguments.
  • Security policies in CI/CD pipelines can enforce rules against generic shell usage in backend services, and automated tools can scan for CWE-78 style command injection risks.

Sources

SourceLink
github.comgithub.com/decolua/9router/security/advisories/GHSA-g6g7-pvmx-m74p
vulncheck.comvulncheck.com/advisories/9router-os-command-injection-via-sudopassword-parameter-in-tailscale-install-endpoint

Frequently asked

questions

It is broadly exploitable wherever the vulnerable API endpoint is exposed over the network and sudo does not require an interactive password. In such configurations, unauthenticated remote attackers can issue arbitrary commands.

No application-level credentials are required for this specific route, as it bypasses dashboard middleware checks. Only network reachability to the device and the endpoint is needed.

The safest approach is to remove direct shell execution for administrative tasks and instead use tightly scoped, parameterized operations that do not rely on user-provided stdin. Additionally, ensure that all administrative endpoints are authenticated and authorized.

Avoid designs that send untrusted data to shells or sudo, enforce uniform middleware-based access control on all sensitive routes, and incorporate security-focused code reviews and static analysis into the development lifecycle to catch command injection patterns early.

Find out what's already
exploitable in your codebase.