Skip to main content
Menu
Advisories

Unauthenticated remote code execution via live coding agent replay (shell=True)

GHSA-CM4P-5RFV-X252Published Updated GitHub

Description

When a task configuration declares a live_coding_agent instance display field, Potato registers a blueprint whose endpoints had no authentication check. The application's global session gate does not cover them: it exempts the /api/ prefix, so it never ran for any route in that blueprint.

POST /api/live_coding_agent/replay/<session_id> accepted an edited_actions list of tool calls supplied by the caller and executed each one. The Bash tool was implemented with subprocess.run(..., shell=True) on the host, and the Read, Write and Edit tools honoured absolute paths, so they reached any file readable or writable by the Potato process.

The sandbox intended to contain this did not. sandbox_mode: docker was not implemented and fell back to executing tools directly on the host with only a log warning. The default mode, worktree, creates a git worktree on the same host, as the same user, with the same network, and does not constrain command execution.

Together this allowed an unauthenticated remote attacker to execute arbitrary commands on the Potato host whenever the live coding agent display type was configured.

Affected: 2.8.0 and earlier, only when a config declares a live_coding_agent display field. Fixed in: 2.8.1.

Workaround for anyone who cannot upgrade: remove live_coding_agent display fields from your configs, which unregisters the blueprint.

Affected versions

References

GitHub · davidjurgens/potato