# Cursor before 3.0: prompt-injected agent could escape its sandbox and run code as the user

Source: https://botpassword.com/incidents/2026-06-cursor-agent-sandbox-escape
Disclosed: 2026-06-05 · Type: AI agent · Status: Resolved · Updated: 2026-10-25

Cursor published two critical advisories on 5 June 2026 for flaws, fixed in Cursor 3.0, that let an agent steered by malicious instructions write files outside the workspace and break out of the terminal sandbox. One abused the agent-controlled `working_directory` parameter, the other a symlink and failed path check. Either allowed unsandboxed code execution with the user's privileges, which exposes every key, token and credential file the user can read. Update to Cursor 3.0 or later.

Identifiers: CVE-2026-50548, CVE-2026-50549, GHSA-3p48-7v9f-v5cw, GHSA-3v8f-48vw-3mjx

## What was exposed

Anything the user account can access. Cursor runs agent terminal commands in a sandbox that may write only to the command's working directory. In CVE-2026-50548 the agent could set `working_directory` to a sensitive location, so the sandbox granted write access outside the workspace. In CVE-2026-50549, when path canonicalization failed (because the target did not exist or read permission was removed), Cursor fell back to the original path and wrote through an in-workspace symlink without approval. Cursor says both enable non-sandboxed remote code execution, for example by overwriting the `cursorsandbox` helper so later commands run unsandboxed, with no user interaction beyond a benign prompt. Once outside the sandbox, code can read model provider API keys, `~/.ssh`, cloud CLI credentials, Git credential stores and `.env` files. The advisories credit Cato AI Labs, whose write-up calls the pair DuneSlide, and frame the attacker as a malicious agent, that is, an agent following instructions an attacker managed to feed it. The advisories do not report exploitation in the wild.

## Who is affected

You are affected if you used Cursor's agent on a version below 3.0, particularly with MCP servers, web content or repositories you do not control, since those are paths by which instructions can reach the agent. Check your version under Cursor's About dialog. There are no published indicators of past exploitation; a modified `cursorsandbox` helper or files written outside your projects by the agent would be a sign worth investigating.

## What to do

1. Update Cursor to 3.0 or later.
2. If you used the agent on untrusted repositories or MCP servers on an older version, rotate the provider API keys, GitHub tokens and cloud credentials stored on that machine.
3. Remove MCP servers you do not need, and review what each remaining one can return to the agent.
4. Keep long-lived credentials out of plain files the agent's user account can read.

## Keys to rotate

- [OpenAI](https://botpassword.com/keys/openai)
- [Anthropic](https://botpassword.com/keys/anthropic)
- [GitHub](https://botpassword.com/keys/github)

## Timeline

- 2026-06-05: Cursor publishes GHSA-3p48-7v9f-v5cw and GHSA-3v8f-48vw-3mjx (critical), crediting Cato AI Labs; both are fixed in Cursor 3.0. ([source](https://github.com/cursor/cursor/security/advisories/GHSA-3p48-7v9f-v5cw))
- 2026-06-25: NVD publishes CVE-2026-50548 and CVE-2026-50549. ([source](https://nvd.nist.gov/vuln/detail/CVE-2026-50548))

## Indicators

- Cursor versions below 3.0.
- Unexpected changes to the `cursorsandbox` helper or files written outside the workspace during agent sessions.

## Sources

- https://github.com/cursor/cursor/security/advisories/GHSA-3p48-7v9f-v5cw
- https://github.com/cursor/cursor/security/advisories/GHSA-3v8f-48vw-3mjx
- https://nvd.nist.gov/vuln/detail/CVE-2026-50548
- https://nvd.nist.gov/vuln/detail/CVE-2026-50549
- https://www.catonetworks.com/blog/duneslide-two-critical-rce-vulnerabilities/
