Severity:

HIGH RISK

(7.3)

OS Command Injection in FastlyMCP fastly_cli Tool

CVE-2026-7220

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-77, CWE-78

Impact:

Arbitrary Command Execution on the Host System

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

FastlyMCP's fastly_cli tool contains an OS command injection issue in fastly-mcp.mjs, where a user-controlled command argument is passed into system-level execution without adequate sanitization.

A remote attacker who can influence this argument may execute arbitrary commands on the host running the CLI, depending on how and where the tool is invoked.

Affected context

The vulnerability exists within the FastlyMCP fastly_cli tool, specifically in the fastly-mcp.mjs module where external commands are constructed and executed.

It is relevant in environments where:

  • The CLI is exposed via services (e.g., wrappers, automation jobs, CI/CD tasks, or web hooks) that accept remote input, and
  • User-supplied or remotely influenced data can flow into the command argument.

The risk is higher when the CLI process runs with elevated permissions or has access to sensitive configuration, credentials, or deployment pipelines.

Exploit preconditions

  • Attack surface: Any workflow, service, or automation that accepts external input and passes it to the fastly_cli tool (directly or indirectly).
  • Required access: Ability to supply or influence the command argument, such as via API parameters, configuration values, environment variables, or script arguments.
  • Trigger point: Execution of fastly-mcp.mjs where the untrusted command value is interpolated into a shell/system command and executed.
  • Why exploitation is possible: The implementation constructs OS-level commands by concatenating or interpolating untrusted input into shell command strings, instead of using safe parameterized process execution APIs, enabling injection of additional commands or arguments.

Why this happens

This issue stems from constructing shell commands using untrusted input and executing them through generic OS command facilities (e.g., child_process.exec, shell invocation, or equivalent).

Instead of treating the input as data-only arguments, the code appears to embed the command parameter directly in a command string that is interpreted by a shell, allowing metacharacters, separators, or subshell syntax to alter control flow.

Conceptually, this maps to:

  • CWE-78: Improper Neutralization of Special Elements used in an OS Command, where attacker-controlled data can inject or modify executed commands.
  • Related CWE-77 patterns where shell metacharacters are not properly sanitized or where shell interpretation is unnecessarily invoked.

Potential impact

  • Execution of arbitrary OS commands with the privileges of the fastly_cli process
  • Reading, modifying, or deleting files accessible to the CLI's runtime user
  • Theft of API tokens, credentials, or configuration used by FastlyMCP or adjacent tooling
  • Tampering with Fastly configurations, deployments, or traffic policies via compromised automation
  • Lateral movement into CI/CD runners or build agents if the tool is used in pipelines
  • Use of the compromised host as a pivot point for further network attacks

General mitigation guidance

Mitigations focus on eliminating direct shell interpretation of untrusted input and constraining what commands can be executed:

  • Prefer parameterized process execution APIs (e.g., spawning a process with an argument array) instead of passing concatenated strings to a shell.
  • Implement strict allowlists for permissible commands and arguments, rejecting or ignoring anything outside expected patterns.
  • Normalize and validate input at the boundary, rejecting values containing shell metacharacters, control operators, or unexpected whitespace patterns.
  • Introduce privilege separation, running the CLI with the least necessary system permissions and restricted filesystem access.
  • Isolate automation that invokes the CLI (e.g., in containers or dedicated service accounts) to limit blast radius if command execution is compromised.
  • Treat all remotely influenced configuration as untrusted and avoid feeding it directly into command construction logic.

How teams detect issues like this

Detection is typically achieved through a combination of code-centric and operational controls:

  • Static analysis: Enable rules that flag usage of shell-executing APIs (exec, spawn with shell: true, or similar) where untrusted variables flow into the command string.
  • Code review: Look for string concatenation or template literals used to build commands, especially where parameters named command, cmd, args, or user input are included.
  • Secure coding policies: Enforce guidelines that prohibit shell invocation with untrusted data and require parameterized process calls and allowlists.
  • Runtime monitoring: Use OS-level logging or EDR solutions to monitor unusual child process trees, suspicious shell invocations, or anomalous command patterns originating from fastly_cli processes.
  • CI integration: Integrate automated code scanning tools into pull requests, focusing on command construction logic and data flow from external inputs.

Sources

SourceLink
github.comgithub.com/jackwrichards/FastlyMCP/
github.comgithub.com/jackwrichards/FastlyMCP/issues/3
vuldb.comvuldb.com/submit/802138
vuldb.comvuldb.com/vuln/359820
vuldb.comvuldb.com/vuln/359820/cti

Frequently asked

questions

Yes, but only when the fastly_cli tool is invoked in a context where remote users or systems can influence the command argument (for example, through APIs, web dashboards, or CI jobs that pass user-controlled values to the CLI). If the CLI is used only locally by trusted operators without untrusted input, the practical risk is reduced.

An attacker needs the ability to supply or control the data that becomes the command argument to fastly-mcp.mjs. This might involve access to configuration files, environment variables, wrapper scripts, or service endpoints that indirectly construct or forward this value.

Replace any shell-based command construction with parameterized process execution APIs that separate the executable from its arguments, enforce a strict allowlist of supported commands and flags, and validate input against expected formats before passing it to the OS.

Adopt a secure coding standard that bans interpolating untrusted input into shell command strings, enforce static analysis checks for such patterns, and design CLI and automation interfaces around structured parameters and fixed workflows rather than free-form command text. Regular security reviews of tooling and scripts that interact with external services help catch injection risks early.

Find out what's already
exploitable in your codebase.