←新闻详情

Johann Rehberger / Embrace The Red更新于 10月14日 12:43

Cursor IDE 通过 Mermaid 渲染任意外泄数据(CVE-2025-54132)

Cursor IDE: Arbitrary Data Exfiltration Via Mermaid (CVE-2025-54132) · Embrace The Red

AI 导读

安全研究者 Johann Rehberger 披露 Cursor IDE 存在任意数据外泄漏洞 CVE-2025-54132:Cursor 渲染 Mermaid 图表时会向外部服务器发起请求,攻击者可借间接提示词注入把用户记忆或配置文件中的 API key 嵌入图片 URL 外泄,且图表渲染过程不会明显暴露大量数据外传。作者向 Cursor 团队提交了两个演示利用,漏洞于 2025 年 6 月 30 日报告、7 月 7 日修复,随 7 月 29 日起可用的 v1.3 版本发布。

推荐理由

AI 评分 60

作者以第一手漏洞挖掘披露 Cursor 通过 Mermaid 渲染外泄数据的攻击链,并给出两个可复现演示。

主题

标签

正文

当前显示原文,中文全文译文尚未就绪。

Cursor is a popular AI code editor. In this post I want to share how I found an interesting data exfiltration issue, the demo exploits built and how it got fixed.

When using Cursor I noticed that it can render Mermaid diagrams.

Cursor Renders Mermaid Diagrams

If you are not familiar with Mermaid, it has a simple syntax:

This will create a diagram as follows:

Pretty cool and useful.

Can It Also Render Images?

Naturally I was wondering if Mermaid could issue requests to external servers, like including an image in a diagram. So, I decided to issue the following prompt to check:

This means Cursor allows requests that go outside its sandbox to leak data without human confirmation, which means during an indirect prompt injection an attacker can exfiltrate data.

Data Exfiltration via Mermaid Diagrams

An attacker can use Mermaid to exfiltrate sensitive information to a third-party attacker controlled server when performing a prompt injection. A malicious model (or hallucination/backdoor) might also trigger this exploit at will.

To demonstrate the vulnerability, I shared two exploits with the Cursor team:

Exfiltration of all user memories, and; Exfiltration of API keys stored in a configuration file

However, any other information that an attacker can pull into chat context can be exfiltrated, e.g consider Jira tickets or Slack messages from MCP servers, etc.

Here is a brief end-to-end screenshot that explains it for the busy reader:

The indirect prompt injection can come from various sources, like source code, web requests, MCP servers and so forth.

Repro Steps and Demo Exploits

Below are the high level steps to explain the attack chain.

POC that when analyzed with Cursor will hijack it to execute malicious instructions:

Ask Cursor to explain the file (I used agent mode), this is the query I used:

explain the file #mermaid-demo.c; Observe prompt injection and data exfiltration. The result was that Cursor retrieved the memories and then rendered the mermaid diagram including the link and data (the user’s memories) in the URL

As a demonstration I prepared two examples. First, we’ll show an exploit that searches the project for secret API keys and leaks them to the attacker. Second we exfiltrate any memories the Cursor might have stored about the developer.

Demo 1: Stealing Developer Secrets!

Let’s say you have a .NET application with this app.config file:

Now, imagine you use Cursor to analyze a source code file that contains malicious instructions as a comment. The attack will hijack cursor, grep for keys and then render the Mermaid diagram with the image and the keys embedded as URL query parameters.

As you can see, as a result the attacker retrieved the API key!

Demo 2: Exfiltraing Stored Memories

Here is another example broken down in a little bit more detail.

First, some user memories are set up for the demo, which we will attempt to exfiltrate

This is the file containing the prompt injection, the payload can also be delivered via other means, like web search, other tool invocations or image upload

When Cursor processes the file, it gets hijacked and renders the diagram:; Attacker receives the user’s memories

What is interesting compared to some other image rendering attacks is that the diagram just appears. There is no opportunity to see a large amount of data being exfiltrated visually while it is happening.

Video Walkthrough

Here’s a video walkthrough that shows how I found it and the two demos:

Let me know if you like videos like this, and I’ll try to create them more often.

Impact

Prompt injection from untrusted data (web, image upload, source code) or just the model itself (if there is a backdoor or hallucination) can send sensitive information, like the user’s memories or secret API keys to an external server.

Responsible Disclosure and Fix

This information was disclosed to Cursor on June 30, 2025, investigated and resolved on July 7, 2025 for rollout in the next major release v1.3 - which has been available since July 29.

The bug also got a CVE assigned CVE-2025-54132 and I got the official credits.

Thanks to the Cursor team for addressing this issue promptly.

Conclusion

We have seen many such high severity remotely exploitable zero-click data exfiltration attacks that leverage image rendering over the last 2+ years in AI applications.

Rendering images within Mermaid diagrams is a new variant to be aware of.

来源

Johann Rehberger / Embrace The Red