INCIDENT MAP

Browse / MCP and Tool Server Flaws / AML.CS0045

Data Exfiltration via an MCP Server used by Cursor

AML.CS0045 · 2025-06-24 case study

Class
MCP and Tool Server Flaws
Technique
Credentials from AI Agent Configuration
Also involves
Jailbreak and Guardrail Bypass, Tool and Agent Misuse, Direct Prompt Injection
Target
Cursor (Exercise)

How it worked

  1. AI Attack Adaptation · LLM Prompt Crafting

    The researchers crafted a malicious prompt containing an instruction to execute the malicious shell command to exfiltrate the victim's AI agent credentials.

  2. Resource Development · Stage Capabilities

    The researchers created a malicious web site containing the malicious prompt.

  3. Defense Evasion · LLM Prompt Obfuscation

    The malicious prompt was hidden in the title tag of the webpage.

  4. Resource Development · Stage Capabilities

    The researchers launched a web server to receive data exfiltrated from the victim.

  5. Initial Access · Drive-by Compromise

    When a user asked Cursor to use an MCP tool to scrape the malicious website, the contents of the malicious prompt was retrieved and ingested into Cursor's context window.

  6. Execution · LLM Prompt Injection: Indirect

    When the MCP server scraped the malicious web site, it returned the injected prompt to the MCP client and poisoned the context of the Cursor LLM. Cursor executed the malicious prompt embedded in the website scraped by the MCP tool.

  7. Privilege Escalation · AI Agent Tool Invocation

    The prompt injection invoked Cursor's ability to call command line tools via the run_terminal_cmd tool.

    Cursor prompted the user before executing a shell command, potentially mitigating this attack.

  8. Defense Evasion · LLM Prompt Obfuscation

    When the MCP server scraped the malicious web site, it returned the injected prompt to the MCP client and poisoned the context of the Cursor LLM. The shell command in the malicious prompt was obscured via base64 encoding, making it less clear to the user that something malicious may be executed.

  9. Credential Access · Credentials from AI Agent Configuration

    The shell command located the .openapi.apiKey and .cursor/mcp.json credentials files that were part of the Cursor's configuration.

  10. Exfiltration · Exfiltration via AI Agent Tool Invocation

    The credentials files were exfiltrated to the researcher's server via a curl command invoked by Cursor's run_terminal_cmd tool.

  11. Impact · External Harms: Financial Harm

    A bad actor could use the stolen credentials to cause financial damage and could also steal other sensitive information from the victim user.

Summary

The Backslash Security Research Team demonstrated that a Model Context Protocol (MCP) tool can be used as a vector for an indirect prompt injection attack on Cursor, potentially leading to the execution of malicious shell commands.

The Backslash Security Research Team created a proof-of-concept MCP server capable of scraping webpages. When a user asks Cursor to use the tool to scrape a site containing a malicious prompt, the prompt is injected into Cursor's context. The prompt instructs Cursor to execute a shell command to exfiltrate the victim's AI agent configuration files containing credentials. Cursor does prompt the user before executing the malicious command, potentially mitigating the attack.

References

Source: MITRE ATLAS case studies, used under Apache 2.0.