CVE-2025-61589
Executive Summary
CVE-2025-61589 is a medium-severity (CVSS 5.9) prompt injection vulnerability in Cursor, an AI-powered code editor. The flaw resides in the Mermaid diagram rendering engine integrated into Cursor's chat box. An attacker can craft a malicious prompt that, when processed by the AI model, injects an image tag pointing to an attacker-controlled server. When the Mermaid renderer processes this injected image, the victim's browser or Cursor client fetches the image, exfiltrating sensitive data (e.g., session tokens, API keys, or source code snippets) to the attacker. The attack requires user interaction (e.g., opening a malicious file, viewing a compromised web page, or uploading an image) to trigger the prompt injection. The vulnerability is patched in Cursor version 1.7, but additional bypasses were discovered post-fix (see GHSA-43wj-mwcc-x93p).
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
Cursor is a proprietary application, not an open-source package. However, the Mermaid library used for diagram rendering is an open-source JavaScript library. The vulnerability is not in Mermaid itself but in how Cursor integrates and renders Mermaid output without proper sanitization. Users should ensure they are using the latest Cursor version and monitor for updates to the Mermaid library if used in other contexts.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The attack is initiated via network-delivered malicious content.
- Attack Complexity (AC): Low (L) – No special conditions required beyond user interaction.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): Required (R) – Victim must open malicious content.
- Scope (S): Unchanged (U) – The vulnerable component and the impacted component are the same.
- Confidentiality (C): High (H) – Sensitive data can be exfiltrated.
- Integrity (I): None (N) – No data modification.
- Availability (A): None (N) – No denial of service.
Threat Level: Medium. The attack requires user interaction, but the potential for data exfiltration (session tokens, API keys) makes it dangerous in targeted attacks.
Deep Dive & Mechanics
The vulnerability exploits Cursor's integration of Mermaid for rendering diagrams in the chat box. Mermaid supports embedding images via  syntax. When a user interacts with malicious content (e.g., a poisoned source code file, a compromised web page, or an uploaded image), the AI model may generate a Mermaid diagram containing an image tag pointing to an attacker-controlled server. The Cursor client then fetches this image, sending sensitive data (e.g., cookies, local storage, or environment variables) as part of the request (e.g., via URL parameters or headers).
Attack Flow:
- Attacker crafts a malicious prompt or file containing a Mermaid diagram with an embedded image URL (e.g.,
). - Victim opens the malicious content in Cursor, triggering the AI model to process the prompt.
- The AI model generates a response containing the injected Mermaid diagram.
- Cursor's Mermaid renderer processes the diagram and fetches the image from the attacker's server.
- The attacker captures the request, extracting any sensitive data appended to the URL.
Bypass Details (GHSA-43wj-mwcc-x93p): The initial fix in version 1.7 was incomplete. Attackers found ways to bypass sanitization using alternative Mermaid syntax (e.g., using img tags in HTML blocks, or exploiting Mermaid's click event handlers to trigger image loads). These bypasses are documented in the referenced GitHub Security Advisory.
Vulnerable vs. Patched Code
Vulnerable (Cursor < 1.7):
The Mermaid renderer does not sanitize image URLs. Any  in the Mermaid output is rendered as an <img> tag, allowing arbitrary image fetches.
// Vulnerable rendering logic (simplified)
function renderMermaid(diagram) {
// No sanitization of image URLs
const html = mermaid.render(diagram);
chatBox.innerHTML = html; // Direct injection
}
Patched (Cursor >= 1.7): The patched version sanitizes image URLs by stripping or blocking external image fetches. It may also use a Content Security Policy (CSP) to restrict image sources.
// Patched rendering logic (simplified)
function renderMermaid(diagram) {
const html = mermaid.render(diagram);
// Sanitize: remove all image tags or use a CSP
const sanitized = sanitizeHtml(html, {
allowedTags: ['svg', 'div', 'span'],
allowedAttributes: {}
});
chatBox.innerHTML = sanitized;
}
Exploitation & Lab Setup
Red Team (Attacker)
Prerequisites:
- A publicly accessible HTTP server to receive exfiltrated data.
- A malicious file or web page containing a prompt injection payload.
Step 1: Set up listener
# Start a simple HTTP server to capture requests
nc -lvnp 8080
Step 2: Craft malicious payload
Create a file (e.g., malicious.py) containing a prompt injection that forces the AI to generate a Mermaid diagram with an image tag.
# malicious.py
# This code, when opened in Cursor, triggers prompt injection
import os
# The AI model will see this comment and generate a Mermaid diagram
# with an embedded image pointing to attacker's server
# 
Step 3: Deliver payload
- Send the file to the victim via email, chat, or upload to a code repository.
- Alternatively, host a web page that the victim views in Cursor's web view.
Step 4: Capture exfiltrated data Monitor your listener for incoming requests containing sensitive data.
Blue Team (Defender)
Detection:
- Monitor network traffic for unexpected outbound connections to unknown IPs/domains, especially on port 80/443.
- Look for requests containing suspicious URL parameters (e.g.,
?token=,?data=,?session=). - Use endpoint detection to flag Cursor processes making unusual HTTP requests.
Prevention:
- Update Cursor to version 1.7 or later.
- Implement a web proxy that blocks outbound connections to untrusted destinations.
- Educate users not to open untrusted files in Cursor.
Indicators of Compromise (IOCs)
- Network: Outbound HTTP/HTTPS requests to attacker-controlled servers with URL parameters containing sensitive data.
- File: Files containing Mermaid diagram syntax with external image URLs (e.g.,
. - Process: Cursor process (
Cursor.exeorcursor) making unexpected network connections. - Registry/Config: No known registry changes.
Detection Engineering
YARA Rule
rule CVE_2025_61589_Cursor_Mermaid_Exfil {
meta:
description = "Detects files containing Mermaid image injection patterns used in CVE-2025-61589"
author = "Valters IT"
date = "2025-04-10"
severity = "medium"
strings:
$mermaid_img = /!\[.*\]\(https?:\/\/[^\)]+\)/
$mermaid_html_img = /<img[^>]+src=["']https?:\/\/[^"']+["']/
condition:
any of them
}
Sigma Rule
title: Cursor Mermaid Image Exfiltration Attempt
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects outbound HTTP requests from Cursor processes to external servers with suspicious URL parameters
author: Valters IT
date: 2025-04-10
logsource:
category: network_connection
product: windows
detection:
selection:
Image|endswith: '\Cursor.exe'
DestinationPort: 80
DestinationHostname: '*'
UrlParameters|contains:
- '?token='
- '?data='
- '?session='
condition: selection
falsepositives:
- Legitimate use of Mermaid diagrams with external images (rare)
level: medium
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-61589 Cursor Mermaid Image Exfiltration"; flow:to_server,established; content:"GET"; http_method; content:"?token="; http_uri; nocase; content:"User-Agent: Cursor"; http_header; nocase; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate:
- Update Cursor to version 1.7 or later.
- Apply any additional patches from GHSA-43wj-mwcc-x93p.
Long-term:
- Implement a Content Security Policy (CSP) in Cursor to restrict image sources to
'self'or trusted domains. - Sanitize all Mermaid output before rendering, stripping any HTML tags or attributes that could load external resources.
- Conduct a security review of all third-party library integrations.
Workaround:
- Disable Mermaid rendering in Cursor settings if not needed.
- Use a web application firewall (WAF) or proxy to block outbound connections to unknown IPs.
Valters IT
Securing Digital Frontiers