Arbitrary file write from Cursor Agent through a prompt injection from malicious @Docs
Summary
A recent change in the Cursor app introduced a regression affecting the set of file paths the Cursor Agent is permitted to modify automatically. Under specific conditions, the agent could be prompted, either directly by the user or via maliciously crafted context, to automatically write to files outside of the opened workspace.
This behavior required deliberate prompting, making successful exploitation highly impractical in real-world scenarios. Furthermore, the edited file was still displayed in the UI as usual for user review, making it unlikely for the edit to go unnoticed by the user.
Remediation
Agent now requires explicit user confirmation before writing to out-of-workspace files.
Separately, we recommend as best practice to only include trusted pieces of context in your prompts, as well as to always review the edits made by the agent.
Affected versions
| Package | Affected | Fixed in |
|---|---|---|
| Cursor Product | < 0.48.7+ | 0.48.7+ |
Details and references
- CVSS 3.1
- CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:H
- Severity from
- GitHub (reviewed advisory)
- Weakness
- CWE-20