Summary
When Grist is configured to use the pyodide sandbox flavor, Python formulas from untrusted spreadsheets may execute without an effective isolation barrier.
A malicious document opened under this configuration can run arbitrary processes on the server hosting Grist, leading to full server compromise.
Affected context
This vulnerability affects Grist deployments that:
- Use Python formulas in spreadsheets, and
- Are configured with
GRIST_SANDBOX_FLAVOR=pyodide, and - Allow users to open or import documents that may not be fully trusted.
Under these conditions, formulas intended to run in a sandbox are instead executed in an environment (pyodide on Node) that lacks a strong isolation barrier from the host, exposing the server to arbitrary command execution initiated by spreadsheet content.
Exploit preconditions
- Attack surface: Grist application endpoint where users open or import spreadsheets.
- Required access: Ability to cause a Grist instance configured with
GRIST_SANDBOX_FLAVOR=pyodideto open a crafted, malicious document (e.g., as an authenticated user or via shared workspace rules). - Trigger point: Evaluation of Python formulas contained in the malicious spreadsheet under the pyodide-based sandbox.
- Why exploitation is possible: The pyodide-on-Node environment does not provide a robust sandbox boundary, so formula code that should be contained can instead interact with the underlying runtime and spawn arbitrary processes on the host.
Why this happens
The core issue stems from relying on a sandboxing mechanism (pyodide on Node) that does not enforce strong isolation between user-supplied formula code and the hosting server environment.
Conceptually, Grist treats spreadsheet formulas—even from untrusted documents—as data meant to be confined to a sandbox. However, the chosen execution flavor (pyodide) allows formula code to reach beyond that boundary and influence the host process.
This maps to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component, where attacker-controlled content (formulas in spreadsheets) is propagated into a downstream execution environment without sufficient neutralization or containment, effectively becoming executable commands against the server.
Potential impact
- Arbitrary process execution on the Grist server.
- Full takeover of the Grist application runtime and its data.
- Theft, modification, or deletion of documents and configuration stored on the server.
- Use of the compromised server as a pivot point for lateral movement within the hosting infrastructure.
- Service disruption or denial of service through destructive payloads.
General mitigation guidance
Effective mitigation focuses on enforcing a robust isolation boundary and treating spreadsheet formulas from untrusted sources as untrusted code:
- Prefer sandbox flavors that provide kernel-level or process-level isolation for untrusted code execution, reducing the blast radius if formulas are abused.
- Configure the application so that the default sandbox option is the most isolated mode (e.g., gVisor-like sandboxes) rather than more permissive environments.
- Minimize the privileges of the process or container that runs formula evaluations: restrict filesystem, network, and process capabilities.
- Separate formula-execution components from the main application using process separation or containerization, ensuring that a compromise of the formula runtime does not directly expose core services or secrets.
- Treat any configuration flag controlling sandbox behavior as security-sensitive, and restrict who can modify it via operational controls and configuration management policies.
- Apply defense-in-depth controls such as OS-level mandatory access control (e.g., seccomp, AppArmor, SELinux profiles) around components executing user-supplied formulas.
How teams detect issues like this
To identify and monitor this class of vulnerability:
- Review configuration management and deployment manifests for uses of insecure sandbox flavors, especially any environment variables or flags that weaken isolation (e.g.,
GRIST_SANDBOX_FLAVOR=pyodide). - Incorporate static and configuration analysis into CI/CD pipelines to flag deployments that route untrusted formulas to runtimes without strong sandboxing.
- During code review, highlight any design where user-supplied formulas or scripts are executed in the same trust domain as the main application process.
- Use host-level monitoring and EDR tools to detect abnormal child processes or command executions originating from the Grist server process or its runtime container.
- Implement application-level logging of formula evaluation contexts and correlate suspicious activity (unexpected process spawns, escalated file access) with specific documents or users.

