Understanding Cursor security risks: editor flaws, agent risks and code defences

Cursor can work across a whole codebase, rather than just suggest text. Its agent can run tasks and shell commands. Its built-in controls reduce risk but do not remove it.1
How Cursor changes development security
Cursor indexes your whole codebase and edits files across its folder tree. It can generate code faster than a person can review it.1
The agent also runs tasks and shell commands. These powers create risks that its built-in controls cannot fully close.1
A code diff can become a record of choices already made. A control that acts only at a pull request then reviews history, rather than preventing those choices.1
Safe use still depends on permissions, isolation and human review. It also needs separate checks across code, packages, secrets and build pipelines.1
SOC 2 covers how Cursor runs its service. It does not prove that Cursor behaves safely on your machine.1
Generated code still needs a security review before you accept it. A sound privacy stance does not make unreviewed output safe.2
Editor flaws and documented CVEs
Workspace Trust was off for much of Cursor's history. The control only protects you when it is on.1
A malicious .vscode/tasks.json file can run code as soon as you open a cloned folder. That path can run without a click to approve it.3
CVE-2025-54135, known as CurXecute, involved indirect prompt injection. Malicious input could create an MCP settings file without approval and run commands.3
MCP means Model Context Protocol.2, 3, 4 CVE-2025-54136, known as MCPoison, affected shared codebase settings. An already trusted MCP setup could be swapped for a malicious command.3
Shared settings made this a risk for the whole team. The flaw was fixed after version 1.2.4.3
CVE-2025-59944 involved file checks that treated upper and lower case differently. Prompt injection could then change protected settings files; the flaw was fixed after version 1.6.23.3
Other disclosed editor flaws involved hidden Git hooks and bypasses of trust checks. MCP trust bypasses also allowed code execution to persist.1
Rules files, context and MCP risks
Malicious .cursor/rules files can run when untrusted projects are opened. Hidden code in rules files can create backdoors or keep access open.2, 5
Hostile prompts can also make the agent run unwanted commands or alter key project files. These actions can change code or compromise the whole work environment.5
A compromised MCP server can hide instructions in tool descriptions and responses. A connected server can steer the agent before it calls a tool.1
Review MCP server origins and avoid untrusted links to these services. Watch for suspicious tool calls, since malicious responses can run commands.2
Cursor keeps chat and code context to improve its suggestions. Misleading snippets or instructions from one project can carry into unrelated work.5
That polluted context can cause logic errors or introduce security flaws. It can also leak sensitive data; secrets in AI output or logs can lead to account takeover.5
An agent can invent a package name that sounds real. Attackers can register that name and fill the package with malicious code.1
The agent may approve an install because the name looks right. Verify that suggested packages exist, and check their reputation before installing.1, 2
Flaws in AI-generated code
NYU's Asleep at the Keyboard study found 40% of AI-generated code vulnerable across MITRE Top-25 security scenarios.1 A Stanford University study by Perry and colleagues in 2022 found that AI-assisted developers wrote less secure code. They were also more likely to believe their code was secure.3
Generated routes can omit checks on which records a caller may read. IDOR, short for Insecure Direct Object Reference, includes access flaws involving sequential IDs.3
A logged-in user can then read another user's data by changing a number in the URL. Review each code path that handles sign-in and access checks by hand.3
Generated code can put admin checks only in a React component. Sensitive operations need server-only imports, and each access-related code path needs manual review.3
API keys pasted into prompts or context can end up in source files. Once committed, those secrets stay in Git history.3
Keep secrets out of Git by using environment variables and a secrets manager. Exposed keys for third-party APIs can lead to abuse and charges.2, 3
Hardening your Cursor workflow
Enable Workspace Trust in settings.1, 2 Keep agent automation off until you have verified the command's origin and purpose. Auto-run can execute AI-written commands without manual review.5
An incomplete or stale deny list can let unsafe operations through. Auto-run may also fetch malicious code from untrusted places.5
Enable Privacy Mode and use .cursorignore for sensitive files. Code sent to AI servers may expose private logic or secrets.2
These controls reduce risk rather than remove it. Review .cursor/ files before opening projects.1, 2
Add security instructions to .cursor/rules and keep rules files in version control. Use integrity checks to detect changes before the rules run.3, 5
Review every sign-in and access-related code path by hand. Keep Cursor updated and run a security scan before each deploy.3
Validating projects with SimplyScan
SimplyScan offers web app security scans for exposed API keys, secrets and leaked .env files. The checks also cover missing RLS, unprotected database tables, and sign-in or session settings.6
SimplyScan offers an MCP server at https://api.simplyscan.io/mcp for scans and free checks within Cursor. The setup uses your account API key in the x-simplyscan-key header. Tools include scan_website for deployed apps and check_security_headers for header checks.4
SimplyScan offers a copy-paste fix prompt for your AI editor with every finding. Its GitHub repo scan offer includes exact fixes and code examples.6
Sources
Frequently asked questions
Is your app secure? Run a free security scan in 30 seconds · free account required.
Scan your app free →