/

CVE-2026-30635

Severity:

HIGH RISK

(8.1)

Command Injection in automagik-genie MCP Server

CVE-2026-30635

Deferred

Vulnerability type

Category:

Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution via Command Injection

Severity:

HIGH RISK

(8.1)

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 flaw in the automagik-genie 2.5.27 MCP Server allows arbitrary OS commands to be executed when handling the view_task (aka view) operation in the readTranscriptFromCommit function.

If an attacker can control or influence the external FORGE_BASE_URL or related input consumed by this path, they may execute system commands with the privileges of the MCP server process.

Affected context

This vulnerability occurs in deployments of automagik-genie MCP Server (version 2.5.27) where:

  • The view_task / view functionality is exposed and used to call readTranscriptFromCommit in dist/mcp/server.js
  • The server reaches out to an external location derived from FORGE_BASE_URL or similar configuration/input
  • User-provided or environment-controlled values are used to construct command-line invocations without strict validation or isolation

The issue is most relevant when FORGE_BASE_URL or parameters used with it can be influenced by a less-trusted user, external service, or CI/automation pipeline.

Exploit preconditions

  • Attack surface: MCP server endpoint or workflow that invokes the view_task (aka view) operation.
  • Required access: Ability to supply or influence data that flows into readTranscriptFromCommit, especially values derived from FORGE_BASE_URL or related URL/path parameters.
  • Trigger point: Execution of the view_task operation that causes the server to build and run a system command (e.g., via shell or process-spawning APIs).
  • Why exploitation is possible: Untrusted input is incorporated into command strings or arguments without robust sanitization, strict whitelisting, or safe process spawning, enabling injection of additional shell metacharacters or commands.

Why this happens

The root cause is the construction of system-level commands using unvalidated input associated with FORGE_BASE_URL and the view_task request handling.

This aligns with CWE-78: Improper Neutralization of Special Elements used in an OS Command, where application logic builds a shell or OS command line by concatenating or interpolating user-controlled data.

When a command is formed as a single string or passed through a shell interpreter, special characters (such as separators, redirection operators, or subshell syntax) are interpreted as additional commands or arguments, enabling unintended execution.

Secure design would treat all external URLs and parameters as untrusted, validate them against strict patterns, and avoid passing them through shell parsing at all.

Potential impact

  • Execution of arbitrary OS commands with the privileges of the MCP server process
  • Reading, modifying, or deleting local files accessible to the server
  • Pivoting to other internal services or hosts reachable from the server environment
  • Exfiltration of sensitive information (credentials, tokens, configuration)
  • Disruption of service availability through destructive or resource-exhausting commands

General mitigation guidance

Defensive measures focus on eliminating direct command construction and reducing trust in external configuration and URLs:

  • Replace shell-based command execution with safe process APIs that accept argument arrays and do not invoke a shell.
  • Apply strict input validation and whitelisting for any data used in command parameters (e.g., allowlisted domains, repository names, or paths).
  • Avoid embedding untrusted data directly into command strings; if commands are unavoidable, use parameterized invocation and reject special characters.
  • Treat FORGE_BASE_URL and similar configuration values as untrusted unless they are hardcoded or strongly controlled, and validate them against a fixed set of allowed patterns.
  • Run the MCP server under a least-privilege account with minimal filesystem and network permissions so that impact is constrained if command execution occurs.

How teams detect issues like this

Organizations can identify this class of flaw using a combination of code analysis and operational monitoring:

  • Static analysis rules that flag use of shell-executing APIs (e.g., exec, spawn with shell enabled, or similar wrappers) where arguments include request data, environment variables, or configuration derived from user-controlled sources.
  • Code review checklists emphasizing the separation of command logic from untrusted inputs and requiring justification for any shell invocation.
  • Security linters or automated review tools configured to highlight string concatenation used to build commands, especially in network- or user-facing code paths like MCP handlers.
  • Runtime monitoring for anomalous command patterns, such as unexpected utilities being run by the MCP server process or unusual outbound network connections originating from that process.

Sources

SourceLink
gist.github.comgist.github.com/spdc-elm/3ddecd10ffa85c5963ab7fe531619875

Frequently asked

questions

It can be, depending on how the MCP server is exposed and how FORGE_BASE_URL and related inputs are sourced. If an attacker can influence those values through a network-exposed interface or integrated service, remote exploitation is plausible.

An attacker needs the ability to control or meaningfully influence the data that flows into the readTranscriptFromCommit function (for example, request parameters, environment configuration, or external service responses tied to FORGE_BASE_URL).

The most robust fix is to eliminate shell-based command construction entirely: use safe process execution APIs with argument arrays, apply strict whitelisting/validation on all inputs used as command arguments, and disallow special shell metacharacters in these fields.

Establish development practices that forbid direct shell command construction with variable interpolation, enforce security-focused code review around all process execution paths, and integrate static analysis tools that detect OS command injection patterns before code is merged.

Find out what's already
exploitable in your codebase.