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
.pthfile 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.

