CVE-2026-31854
Received Received - Intake
Indirect Prompt Injection in Cursor Editor Enables Unauthorized Command Execution

Publication date: 2026-03-11

Last updated on: 2026-03-20

Assigner: GitHub, Inc.

Description
Cursor is a code editor built for programming with AI. Prior to 2.0 ,if a visited website contains maliciously crafted instructions, the model may attempt to follow them in order to β€œassist” the user. When combined with a bypass of the command whitelist mechanism, such indirect prompt injections could result in commands being executed automatically, without the user’s explicit intent, thereby posing a significant security risk. This vulnerability is fixed in 2.0.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-03-11
Last Modified
2026-03-20
Generated
2026-05-07
AI Q&A
2026-03-11
EPSS Evaluated
2026-05-05
NVD
EUVD
Affected Vendors & Products
Showing 1 associated CPE
Vendor Product Version / Range
anysphere cursor to 2.0 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-78 The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

[{'type': 'paragraph', 'content': 'CVE-2026-31854 is a high-severity vulnerability in Cursor, a code editor that uses AI assistance. The vulnerability occurs because Cursor can access and process instructions from arbitrary websites. If a visited website contains maliciously crafted prompt-injection content, the Cursor model may try to follow these instructions to "assist" the user.'}, {'type': 'paragraph', 'content': "This behavior, combined with a bypass of the command whitelist mechanism, allows attackers to execute arbitrary commands automatically on the user's system without their explicit consent. This happens even when Auto-Run Mode is set to use an allowlist, meaning the whitelist checks can be circumvented."}, {'type': 'paragraph', 'content': 'The root cause is an OS command injection issue (CWE-78), where Cursor constructs OS commands using externally influenced input without properly neutralizing special elements that could change the intended command execution. This vulnerability was fixed in Cursor version 2.0.'}] [1]


How can this vulnerability impact me? :

This vulnerability can lead to arbitrary command execution on your system without your explicit intent. An attacker can exploit this by serving malicious prompt-injection content through websites accessed by Cursor.

As a result, your system could be compromised, potentially allowing attackers to execute harmful commands, access sensitive data, or take control of your environment.


How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:

I don't know


How can this vulnerability be detected on my network or system? Can you suggest some commands?

[{'type': 'paragraph', 'content': 'This vulnerability involves Cursor automatically executing arbitrary commands from maliciously crafted prompt-injection content on visited websites, bypassing the command whitelist mechanism.'}, {'type': 'paragraph', 'content': 'Detection on your system or network would involve monitoring for unexpected or unauthorized command executions initiated by the Cursor Agent, especially commands triggered without explicit user consent.'}, {'type': 'paragraph', 'content': "Since the vulnerability exploits OS command injection via Cursor's processing of external input, you can look for suspicious Cursor Agent activity or unusual command executions in system logs."}, {'type': 'list_item', 'content': 'Check running processes for Cursor Agent activity: e.g., on Linux, use `ps aux | grep cursor`.'}, {'type': 'list_item', 'content': 'Monitor system logs for unexpected commands or errors related to Cursor: e.g., `journalctl -xe` or check application-specific logs.'}, {'type': 'list_item', 'content': 'Use network monitoring tools to detect Cursor accessing untrusted or suspicious websites.'}, {'type': 'list_item', 'content': 'If possible, enable verbose or debug logging in Cursor to capture command execution attempts.'}] [1]


What immediate steps should I take to mitigate this vulnerability?

The primary mitigation is to upgrade Cursor to version 2.0 or later, where this vulnerability has been fixed.

Until the upgrade is applied, avoid visiting untrusted or suspicious websites through the Cursor Agent to reduce the risk of prompt-injection attacks.

Disable or restrict Auto-Run Mode features in Cursor to prevent automatic execution of commands without explicit user consent.

Review and tighten any command whitelist or allowlist configurations, although the vulnerability bypasses these, so this is only a partial mitigation.

Monitor system and application logs for suspicious activity related to Cursor and respond promptly to any anomalies.


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart