/

CVE-2026-120338

Severity:

CRITICAL RISK

(10.0)

Code Injection (CWE-94) in Prefab UI Generative Sandbox

CVE-2026-120338

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94, CWE-269, CWE-693

Impact:

Server-side code execution and unauthorized file access

Severity:

CRITICAL RISK

(10.0)

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

Prefab UI's Generative UI sandbox runs caller-supplied Python in Pyodide, but affected configurations expose Deno APIs with broad file and network permissions. A caller who can submit code to the sandbox may read or modify files as the server's OS user and could potentially establish persistent code execution.

Affected context

The issue affects Prefab UI's Generative UI sandbox in versions 0.14.0 through 0.20.2 when Deno is installed and the opt-in feature is enabled. The runner leaves Deno APIs accessible to sandboxed Python through Pyodide's JavaScript interface while the Deno process has read, write, and network permissions.

A common remote exposure path is a FastMCP server that registers the generate_prefab_ui tool and forwards its code argument to the sandbox. Whether an unauthenticated client can reach that path depends on the server's authentication configuration.

Exploit preconditions

  • Attack surface: The opt-in Prefab UI Generative UI sandbox, directly or through a service such as FastMCP.
  • Required access: Ability to supply code to the sandbox; this may mean network access to an unauthenticated server or permission to call tools on an authenticated server.
  • Trigger point: The server executes caller-supplied Python in Pyodide.
  • Why exploitation is possible: The Python code can access Deno APIs through Pyodide's JavaScript proxy, and the Deno process retains broad file and network permissions.

Why this happens

The sandbox boundary does not sufficiently restrict the capabilities available to untrusted code. The runner exposes the Deno API on the JavaScript global object and starts Deno with broad permissions; Pyodide's js module makes that global accessible from Python. This is primarily CWE-94: Improper Control of Generation of Code, because caller-supplied code can perform actions beyond the intended sandbox. It also relates to CWE-269: Improper Privilege Management and CWE-693: Protection Mechanism Failure.

Potential impact

  • An attacker may read files accessible to the server's OS user.
  • An attacker may modify or create files with that user's permissions.
  • An attacker could potentially write a .pth file into the server virtual environment to enable persistent code execution.
  • Network access and the server's privileges could be abused to affect other systems or data.

General mitigation guidance

Reduce the capabilities available to untrusted code rather than relying on the sandbox language boundary alone.

  • Revoke file and network permissions after trusted runtime and application initialization but before accepting caller-supplied code.
  • Use least-privilege process permissions and restrict filesystem access to only what is necessary.
  • Keep Deno APIs and other host capabilities inaccessible to untrusted code.
  • Prevent permission prompts or other mechanisms from restoring revoked capabilities at runtime.
  • Restrict bootstrap network access to explicitly required, trusted sources.
  • Treat generated or user-supplied code as untrusted, and limit who can submit it through the application or tool interface.

How teams detect issues like this

  • Review launch configurations for broad Deno permissions and check whether permission revocation happens before untrusted code is accepted.
  • Use static analysis and code review to identify exposed host APIs, JavaScript globals accessible from Pyodide, and paths that forward caller-controlled code into the sandbox.
  • Audit FastMCP tool registration and access policies to determine who can invoke generate_prefab_ui.
  • Monitor for unexpected reads or writes by the server process, changes to virtual-environment site-packages, and outbound network activity from the sandbox process.
  • Enforce runtime policies that restrict filesystem and network access for code-execution workers.

Sources

SourceLink
github.comgithub.com/PrefectHQ/prefab
github.comgithub.com/PrefectHQ/prefab/commit/030f074f85e0b1be0dd44b0283185aecb26337a2
github.comgithub.com/PrefectHQ/prefab/pull/538
github.comgithub.com/PrefectHQ/prefab/releases/tag/v0.14.0
github.comgithub.com/PrefectHQ/prefab/releases/tag/v0.20.2
github.comgithub.com/PrefectHQ/prefab/releases/tag/v0.21.0
github.comgithub.com/PrefectHQ/prefab/security/advisories/GHSA-595q-jv4r-q7j9
pypi.orgpypi.org/project/prefab-ui/
pypi.orgpypi.org/project/prefab-ui/0.21.0/

Frequently asked

questions

Potentially. A remote path exists when a reachable FastMCP server exposes the Generative UI tool and forwards caller-supplied code to the sandbox. The feature must be enabled, and access depends on the server's authentication and tool authorization settings.

The attacker needs permission to submit code to the sandbox. On a server without authentication, that may be any client able to reach the tool; on an authenticated server, the attacker must be allowed to call it.

Revoke unnecessary Deno permissions before untrusted code runs, prevent those permissions from being restored, and keep host APIs unavailable to sandboxed code.

Treat sandboxed code as untrusted, apply least privilege to its process, minimize exposed host capabilities, and enforce filesystem and network restrictions through runtime policy.

Find out what's already
exploitable in your codebase.