Summary
A code injection vulnerability in marimo's notebook configuration handler allows attacker-controlled MCP server command values embedded in a notebook to be executed as local subprocesses. The command may run when the notebook is opened in edit mode, before any notebook cell is executed and without requiring authentication.
Affected context
The vulnerability may affect marimo deployments that open notebooks containing crafted MCP server configuration entries and process those entries while entering edit mode. Risk is highest when notebooks originate from untrusted sources or when the marimo process has access to sensitive files, credentials, or other local services.
Exploit preconditions
- Attack surface: Notebook configuration processing during notebook opening
- Required access: Ability to provide or cause a victim to open a crafted notebook; authentication is not generally required
- Trigger point: Opening the notebook in edit mode
- Why exploitation is possible: An attacker-controlled command value is passed to local subprocess execution before notebook cell execution or equivalent safety validation
Why this happens
The underlying flaw is the failure to treat command values in notebook configuration as untrusted data. A configuration handler accepts an attacker-controlled MCP server entry and uses its command field to launch a local process without sufficiently restricting or validating executable content. This behavior maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), because data supplied through a notebook can influence executable behavior.
Potential impact
- An attacker may execute arbitrary commands with the privileges of the marimo process.
- The vulnerability could expose local files, environment variables, or service credentials.
- A compromised process may alter notebooks, project files, or other accessible data.
- The issue can enable follow-on compromise of connected services or development environments.
General mitigation guidance
Mitigation generally focuses on removing implicit command execution from notebook configuration handling and reducing trust in notebook-supplied values.
Common defensive patterns include:
- Treating MCP server command fields as data unless explicit, user-reviewed execution is required.
- Allowing only narrowly defined executable identifiers and arguments through an application-controlled policy.
- Requiring clear user confirmation before launching locally sourced commands.
- Separating notebook parsing from process creation and applying validation before any subprocess is started.
- Running marimo with least privilege, restricted filesystem access, and minimal environment credentials.
- Prefering managed integrations or declarative configurations that do not permit arbitrary command strings.
How teams detect issues like this
Organizations can look for this vulnerability class through:
- Static analysis for configuration values flowing into subprocess, shell, or process-spawning APIs.
- Code review checks for notebook or project metadata that directly controls executable paths or arguments.
- Tests that open untrusted notebooks and verify that parsing does not launch processes without an explicit approval boundary.
- Policy enforcement that restricts command-bearing configuration fields and blocks shell interpretation where it is unnecessary.
- Runtime monitoring for unexpected child processes launched by notebook servers or development tools.
Neutral automated code review and software composition tools may help identify command-injection data flows early.

