Severity:

HIGH RISK

(7.3)

OS Command Injection in node-sonos-http-api TTS Provider

CVE-2026-2629

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-77, CWE-78

Impact:

Remote Code Execution on the Server Host

Severity:

HIGH RISK

(7.3)

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 macOS TTS provider of node-sonos-http-api allows attacker-controlled text-to-speech phrases to be passed directly into operating system commands.

When an attacker can trigger TTS requests remotely, they may inject arbitrary shell metacharacters into the phrase argument and execute commands on the underlying host running the API.

Affected context

This vulnerability appears in deployments of jishi/node-sonos-http-api that:

  • Enable and use the macOS TTS provider (lib/tts-providers/mac-os.js)
  • Accept text-to-speech (TTS) phrases from network-accessible clients
  • Construct shell commands using the phrase argument without robust sanitization or safe APIs

It is most relevant when the API is exposed beyond a fully trusted internal network or when untrusted users can issue TTS requests.

Exploit preconditions

  • Attack surface: HTTP endpoints or API methods that trigger the macOS TTS provider.
  • Required access: Ability to send requests to the node-sonos-http-api service (typically remote network access to the API port).
  • Trigger point: Invocation of the Promise function in lib/tts-providers/mac-os.js with attacker-controlled phrase input.
  • Why exploitation is possible: The phrase argument is incorporated into an OS command in a shell context without proper escaping, validation, or use of safer process-spawning APIs, allowing shell metacharacters to alter the intended command.

Why this happens

The root cause is the construction of shell commands using unsanitized, user-controllable input in the macOS TTS provider.

Instead of treating the phrase purely as data, the code interpolates it into a command string executed via the operating system shell.

This pattern corresponds to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), and is closely related to CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection').

By failing to neutralize shell metacharacters or avoid the shell entirely, the implementation allows user data to influence command structure rather than just command parameters.

Potential impact

  • Execution of arbitrary OS commands under the privileges of the node-sonos-http-api process
  • Reading, modifying, or deleting files accessible to the service account
  • Pivoting further into the host system or local network
  • Installation of malware, cryptominers, or backdoors on the affected host
  • Disruption of the Sonos control service or the underlying macOS system

General mitigation guidance

Effective mitigation focuses on eliminating direct shell command composition and reducing trust in user-provided phrases:

  • Use parameterized process-execution APIs (e.g., spawn/execFile equivalents) that do not invoke a shell or require manual quoting.
  • Strictly validate or constrain the phrase input to an expected character set (e.g., alphanumeric and basic punctuation) and length before passing it to any system utility.
  • Avoid constructing commands through string concatenation or template literals; treat all user input as untrusted data.
  • Run the node-sonos-http-api service under a dedicated, least-privileged user account with limited filesystem and system access.
  • Restrict network exposure of the API (e.g., bind to localhost, use reverse proxies, IP allowlists, or authentication) so only trusted clients can issue TTS requests.

How teams detect issues like this

Detection can focus on both code-level patterns and runtime behavior:

  • Static analysis: Search for use of shell-executing APIs (e.g., child_process.exec/execSync or similar) where arguments include user-controllable data such as TTS phrases; flag string concatenation or interpolation into command strings.
  • Code review: Examine TTS provider modules and integration points for any use of OS commands; verify that all user inputs are validated and that shell invocation is avoided where possible.
  • Security policies: Enforce internal coding standards that prohibit unescaped user input in shell commands, or mandate safer execution primitives.
  • Runtime monitoring: Use host-based intrusion detection or logging to spot anomalous command patterns originating from the node-sonos-http-api process, such as unexpected utilities or network-related commands.

Sources

SourceLink
github.comgithub.com/XavLimSG/Vulnerability-Research/blob/main/CVE-2026-2629/CVE-2026-2629.md
github.comgithub.com/jishi/node-sonos-http-api/
github.comgithub.com/jishi/node-sonos-http-api/issues/915
vuldb.comvuldb.com/?ctiid.346280
vuldb.comvuldb.com/?id.346280
vuldb.comvuldb.com/?submit.752762

Frequently asked

questions

Yes. If the node-sonos-http-api service is accessible over the network and accepts TTS requests using the macOS provider, an attacker can exploit the vulnerability remotely by sending crafted phrase values.

The attacker needs the ability to send requests to the vulnerable TTS endpoints. No local shell access is required, but network reachability to the API and the ability to control the phrase parameter are necessary.

Replace shell-based command execution with safer process-spawning APIs that accept argument arrays, avoid the shell entirely, and ensure input validation. Treat phrases as data only and never interpolate them directly into shell command strings.

Adopt a defensive coding standard that forbids passing raw user input into shell commands, requires strict input validation for all externally sourced data, and encourages regular security reviews and automated static analysis to detect command construction patterns early in development.

Find out what's already
exploitable in your codebase.