Critical · CVSS 10.0 November 1, 2026 · JFrog Security Research (JFSA-2026-001699278)

Prefab UI Pyodide-to-Deno Sandbox Escape

Host File Read/Write and Persistence Through FastMCP's generate_prefab_ui Tool

prefab-ui 0.14.0 through 0.20.2 runs generated Python in a Pyodide sandbox inside a Deno subprocess launched with unrestricted --allow-read, --allow-write and --allow-net, and it leaves the Deno API on the JavaScript global object. Through Pyodide's js module, sandboxed code can call Deno's file APIs directly. On a FastMCP server exposing the GenerativeUI provider, any caller of generate_prefab_ui can read secrets, write files as the server's OS user, and persist code through a .pth file. Upgrade to prefab-ui 0.21.0 or later.

1 CVE
10.0 CVSS Score
Escape Sandbox Escape
No-Auth Default FastMCP Server

Technical Breakdown

CVE-2026-120338 Critical · CVSS 10.0 Sandbox Escape → Host File Write

Prefab UI Generative UI Sandbox Escape via Exposed Deno Global and Unrestricted Deno Permissions

prefab-ui's Generative UI feature executes model- or caller-supplied Python inside Pyodide, hosted by a Deno subprocess. Since PR #334 (commit fc4362f3, 2026-03-24, first released in 0.14.0) the launcher started Deno with unrestricted read, write and network permissions, and the runner never removed the Deno object from the global scope. Pyodide's js module proxies that global scope into Python, so code inside the "sandbox" can call Deno.readTextFileSync and Deno.writeTextFileSync against the real host filesystem with the server process's privileges. Version 0.20.2's own security documentation described the sandbox as read-only with no write access. The launch flags said otherwise. Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H (10.0) on a FastMCP server without authentication; 9.9 (PR:L) when authentication is configured. NVD status is Deferred. Scoring is from the CNA (JFrog).

CWE: CWE-94 — Code Injection · CWE-269 — Improper Privilege Management · CWE-693 — Protection Mechanism Failure  |  Affected: prefab-ui ≥ 0.14.0, < 0.21.0  |  Fixed in: 0.21.0 (2026-10-26). Use 0.21.1 or newer.

Root Cause

Two failures stacked. The Deno host process held full filesystem and network permissions, and the bridge between the WebAssembly Python runtime and its JavaScript host was left open. Pyodide is only a sandbox if the host it calls into is locked down. Here, the host was the server's own OS user with every Deno permission granted, reachable from Python in a single import.

Vulnerable Pattern

A Pyodide-in-Deno runner treats the WebAssembly boundary as the security boundary, while the outer runtime keeps --allow-read / --allow-write / --allow-net for its own bootstrap and never drops them. Any JS global that survives into code execution, including Deno itself, is reachable from Python through the js FFI module.

Why AI Services Are High-Value

Generative UI exists so that a model, or any MCP client, can send code to the server to render. The input to generate_prefab_ui is untrusted code by design, and there is no model in the exploit path to refuse it. FastMCP hosts typically hold LLM provider keys, OAuth tokens for downstream tools, and cloud credentials in their environment and config files. Because FastMCP installs Deno automatically on first use, "requires Deno" is not a meaningful precondition.

The Fix

prefab-ui 0.21.0 (PR #538, commit 030f074, merged 2026-10-25) limits bootstrap network access to cdn.jsdelivr.net. Once bootstrap finishes, the runner revokes Deno's read, write and net permissions before it accepts any code, and Deno runs with --no-prompt so sandboxed code cannot request them back. The release shipped without vendor advisory text, so many operators upgraded, or didn't, without knowing it was a security fix.

Attack Chain

1

Discover an Exposed generate_prefab_ui Tool

The attacker connects to a network-reachable FastMCP server and lists its tools. A server that registers the GenerativeUI provider advertises generate_prefab_ui. With no authentication configured, the attacker needs no credentials at all.

Defenders: inventory every FastMCP deployment that lists generate_prefab_ui in tools/list, and confirm each one requires authentication.

2

Submit Code That Reaches the Deno Global

The attacker calls the tool directly with Python that uses Pyodide's js module to reach the host's Deno object. No prompt injection is needed. The MCP call itself is the delivery mechanism.

Defenders: log full generate_prefab_ui arguments. Legitimate UI code has no reason to reference Deno or import js.

3

Read Host Secrets

Deno's synchronous file APIs run with the server's OS user permissions, so the attacker can read environment files, provider API keys, OAuth token caches, cloud credentials and source code, then return them in the tool output.

Defenders: run the server as a dedicated low-privilege user with no access to unrelated home directories or credential stores. If a host ran a vulnerable version with the tool exposed to untrusted callers, treat every secret that user could read as exposed.

4

Write Files Outside the Sandbox

With write access, the attacker can modify application code, configuration, or startup scripts anywhere the server user can write, all through a sandbox the vendor described as read-only.

Defenders: mount application code and the virtualenv read-only (container read-only root filesystem, or files owned by a different user). File-integrity monitoring on the install directory catches this step.

5

Persist via a .pth File

JFrog describes persistence by writing a .pth file into the server virtualenv's site-packages. Python processes .pth files at every interpreter start, so the attacker's code runs natively, outside Pyodide entirely, on the next restart. That includes the restart that applies the fix.

Defenders: upgrading prefab-ui does not remove a planted .pth file. Audit site-packages before you trust an upgraded host, or rebuild the environment from scratch.

Impact

MCP servers are credential hubs. They hold the keys for every tool they front. A sandbox escape that needs no model and no credentials turns a UI-rendering feature into an unauthenticated foothold. The persistence it enables also survives the patch.

MCP Server Hosts

  • Arbitrary file read as the server's OS user: .env files, LLM provider keys, OAuth tokens
  • Arbitrary file write to application code and config
  • Native code execution on next restart via .pth persistence
  • Unrestricted network access from the Deno process enables exfiltration and internal pivoting

Downstream Systems

  • Stolen tool credentials grant access to every SaaS, database and API the MCP server brokers
  • Cloud credentials on the host extend the compromise into the hosting account
  • Scope change (S:C): impact reaches well beyond the sandbox component
  • Agents that trust the server's tool output can be fed tampered results

Exposure & Detection

  • Pulled in transitively by fastmcp[apps], so many operators don't know they run it
  • Deno auto-installs on first use. There is no manual install step to act as a gate
  • 0.21.0 shipped without advisory text, so silent upgrade gaps are likely
  • Not in CISA KEV and no confirmed public exploit as of publication, but the patch diff is public

Defensive Tutorial

IMMEDIATE · 0–24 HRS

Pin prefab-ui>=0.21.0 Explicitly

Immediate

prefab-ui usually arrives transitively through fastmcp[apps], so upgrading FastMCP alone may leave it on a vulnerable version. Check what is actually installed: python -m pip show prefab-ui | grep -i ^version. Then upgrade and pin it as a direct dependency: python -m pip install --upgrade "prefab-ui>=0.21.1" (or uv add "prefab-ui>=0.21.1"), and add prefab-ui>=0.21.0 to requirements.txt / pyproject.toml so a lockfile refresh can't roll it back. Use the latest release (0.21.1 or newer). Rebuild container images rather than patching running ones.

IMMEDIATE · 0–24 HRS

Require Authentication and Restrict generate_prefab_ui

Immediate

An unauthenticated FastMCP server scores 10.0. Configure an auth provider on the server (the auth= argument to FastMCP(...)) before it is reachable from any network you don't fully trust. Even with auth, any authenticated caller can still exploit an unpatched host (9.9). Restrict generate_prefab_ui to trusted callers, and remove the GenerativeUI provider from any server that doesn't need it. Removing Deno is not a mitigation, because FastMCP reinstalls it on first use.

IMMEDIATE · 0–24 HRS

Audit site-packages for Unexpected .pth Files

Immediate

Do this before you trust an upgraded host, because the upgrade does not remove planted files. Find the server virtualenv's directory with SP=$(python -c 'import sysconfig;print(sysconfig.get_paths()["purelib"])'), list .pth files written since the vulnerable code shipped with find "$SP" -maxdepth 1 -name '*.pth' -newermt 2026-03-24 -ls, and flag any not owned by an installed package: for f in "$SP"/*.pth; do grep -qF "$(basename "$f")" "$SP"/*.dist-info/RECORD || echo "UNOWNED: $f"; done. Lines beginning with import execute at interpreter start, so review them with grep -n '^import' "$SP"/*.pth. If anything is unexplained, rebuild the environment from a clean image and handle the host as compromised.

IMMEDIATE · 0–24 HRS

Search Tool-Call Logs for Exploitation Attempts

Immediate

Search logged generate_prefab_ui arguments for references to the Deno API or the Pyodide JS bridge, for example grep -rnE 'Deno|import js|from js import' /path/to/mcp-logs/. Any hit is a strong indicator of an exploitation attempt. If you ran an exposed, vulnerable server, meaning prefab-ui 0.14.0–0.20.2 with generate_prefab_ui reachable by untrusted callers, rotate every credential that server's OS user could read (.env files, LLM provider and other API keys, OAuth tokens, cloud credentials, SSH keys). Servers that never ran an affected version, or never exposed the tool, don't need this step.

SHORT-TERM · 1–7 DAYS

Make the Install Directory Read-Only to the Server

Important

Run the FastMCP process as a dedicated unprivileged user that does not own its virtualenv or application code. In containers, set read_only: true with a narrow writable tmpfs for scratch space. That alone blocks .pth persistence, both for this bug and the next sandbox escape.

SHORT-TERM · 1–7 DAYS

Restrict Egress From MCP Hosts

Important

The patched runner needs network access only to cdn.jsdelivr.net during bootstrap. Apply an egress allowlist at the host or network layer that permits only that and the APIs the server legitimately calls. Alert on outbound connections from the Deno child process to anything else.

SHORT-TERM · 1–7 DAYS

Enable File-Integrity Monitoring on site-packages

Important

Watch the virtualenv for writes outside deploy windows, for example an auditd rule -w /path/to/venv/lib/ -p wa -k mcp_venv or your EDR's equivalent. Any write by the server's runtime user, as opposed to your deploy user, deserves an alert.

LONG-TERM

Track Transitive AI Dependencies, Not Just Direct Ones

Important

This fix shipped with no vendor advisory, and the vulnerable package usually came in through an extra. Generate an SBOM for each MCP server image (syft <image> -o cyclonedx-json), scan it against OSV/GHSA (grype sbom:./sbom.json), and pin security-relevant transitive packages directly.

LONG-TERM

Treat In-Process Code Sandboxes as Defense in Depth Only

Important

Any feature that executes caller- or model-supplied code should run in an isolation boundary you control: a separate container or microVM with no credentials, no write access to the host, and default-deny egress. Then a sandbox escape inside the library lands somewhere worthless. Don't rely on vendor descriptions of sandbox guarantees. Verify the actual runtime flags, which in this case contradicted the docs.

References

  • CVE Record — Authoritative Source CVE.org — CVE-2026-120338 — The authoritative record. JFrog is the CNA, and with NVD status Deferred, this record is the source for the CVSS 10.0 vector, affected range and CWE assignments. Published 2026-11-01.
  • Researcher Advisory JFrog JFSA-2026-001699278: Prefab UI is vulnerable to Remote Code Execution via a Pyodide js Bridge to Deno — Original disclosure by Yuval Moravchick, covering the exposed Deno global, unrestricted permissions and .pth persistence.
  • NVD NVD — CVE-2026-120338 — Status Deferred. No NVD CVSS or CPE assigned.
  • GitHub Advisory Database GHSA-3g72-rrqc-f76c — The entry in GitHub's advisory database for prefab-ui.
  • GHSA Cited by JFrog GHSA-595q-jv4r-q7j9 — The GHSA ID cited in JFrog's advisory. It returned 404 on 2026-11-02.
  • Upstream Fix PR PrefectHQ/prefab#538 — Commit 030f074, merged 2026-10-25. Revokes Deno permissions after bootstrap, adds --no-prompt, and limits bootstrap network to cdn.jsdelivr.net.
  • Releases v0.21.0 (fixed, 2026-10-26) · v0.20.2 (last vulnerable, confirmed affected) · v0.14.0 (first vulnerable, 2026-03-27). The sandbox was introduced in PR #334 (commit fc4362f3).
  • FastMCP Documentation FastMCP — Generative UI — Documents the GenerativeUI provider, the generate_prefab_ui tool, and automatic Deno installation on first use.
  • Disclosure Timeline Sandbox added with unrestricted Deno flags 2026-03-24 · 0.14.0 released 2026-03-27 · Reported 2026-08-05 · Fix merged 2026-10-25 · 0.21.0 released 2026-10-26 (no vendor advisory text) · CVE published 2026-11-01. Not in CISA KEV and no confirmed public exploit as of publication.
  • CWE Reference CWE-94 — Improper Control of Generation of Code ('Code Injection') · CWE-269 — Improper Privilege Management · CWE-693 — Protection Mechanism Failure
Advisory analysis by Spectreworks AI. Original research by Yuval Moravchick, JFrog Security Research. All defensive recommendations are based on publicly available disclosure information. Verify patch applicability against your specific deployment before production changes.