Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2025-57731 Overview
CVE-2025-57731 is a stored cross-site scripting (XSS) vulnerability in JetBrains YouTrack versions prior to 2025.2.92387. The flaw resides in how YouTrack renders Mermaid diagram content, allowing an authenticated attacker to inject persistent script payloads. When another user views the affected issue or page, the injected script executes in their browser session under the YouTrack origin.
The weakness is classified as [CWE-79] Improper Neutralization of Input During Web Page Generation.
Critical Impact
Authenticated attackers can store malicious scripts inside Mermaid diagrams that execute in the context of any user who views the content, enabling session hijacking, data theft, and unauthorized actions within YouTrack.
Affected Products
- JetBrains YouTrack versions prior to 2025.2.92387
- Self-hosted YouTrack Server instances using vulnerable builds
- YouTrack InCloud instances prior to the fixed release
Discovery Timeline
- 2025-08-20 - CVE-2025-57731 published to the National Vulnerability Database
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2025-57731
Vulnerability Analysis
YouTrack supports Mermaid, a markdown-style syntax for rendering diagrams such as flowcharts, sequence diagrams, and Gantt charts. The rendering pipeline converts Mermaid source into inline SVG and HTML inside the user's browser. Prior to version 2025.2.92387, YouTrack did not fully sanitize diagram labels, node text, or embedded HTML elements before injecting the generated markup into the DOM.
An authenticated user can submit a crafted Mermaid block inside an issue description, comment, article, or wiki page. Once the content is saved, the payload persists in the YouTrack database. Any subsequent viewer triggers execution of the attacker-controlled JavaScript in their browser session.
Because YouTrack is a collaboration platform, stored content is frequently viewed by project leads, administrators, and integration accounts. Successful exploitation can lead to session token theft, forced actions against the YouTrack REST API, or pivoting into integrated tools such as source control and CI/CD systems.
Root Cause
The root cause is insufficient output encoding in the Mermaid rendering component. User-supplied diagram syntax is rendered into HTML/SVG without stripping or escaping active script constructs such as event handlers and <script> nodes injected through label fields.
Attack Vector
Exploitation requires network access to the YouTrack instance, a low-privileged authenticated account, and interaction from a victim user who opens the affected content. The vulnerability has a changed scope because scripts execute in the browser origin rather than only within the attacker-controlled resource.
See the JetBrains Security Issues Fixed advisory for additional context.
Detection Methods for CVE-2025-57731
Indicators of Compromise
- Mermaid code blocks inside YouTrack issues, comments, or articles containing HTML tags, event handler attributes such as onclick or onerror, or javascript: URIs
- Unexpected outbound requests from authenticated user browsers to attacker-controlled domains after viewing specific YouTrack pages
- YouTrack audit log entries showing API calls from user accounts correlated with page views rather than deliberate user activity
Detection Strategies
- Audit stored content in the YouTrack database for Mermaid blocks containing script tags, event attributes, or encoded payloads
- Monitor browser Content Security Policy (CSP) violation reports originating from YouTrack pages
- Review YouTrack access logs for anomalous session activity following rendering of modified issues or wiki pages
Monitoring Recommendations
- Enable and centralize YouTrack audit logging to correlate content edits with downstream API activity
- Forward web proxy logs to a SIEM to detect token exfiltration or callbacks to unknown hosts from browsers viewing YouTrack
- Alert on YouTrack version strings in HTTP responses that remain below 2025.2.92387 after the maintenance window
How to Mitigate CVE-2025-57731
Immediate Actions Required
- Upgrade all YouTrack Server and InCloud instances to version 2025.2.92387 or later
- Invalidate active user sessions and rotate YouTrack API tokens following the upgrade
- Review recently created or edited issues, articles, and comments for Mermaid blocks containing suspicious markup
Patch Information
JetBrains addressed the issue in YouTrack 2025.2.92387 by hardening the Mermaid diagram renderer to sanitize user-supplied content before DOM insertion. Patch availability is tracked on the JetBrains Security Issues Fixed page.
Workarounds
- Restrict issue, article, and comment creation privileges to trusted users until patching is complete
- Disable or remove Mermaid diagram usage in project templates and workflows where feasible
- Enforce a strict Content Security Policy at the reverse proxy to limit inline script execution in YouTrack responses
# Example reverse-proxy CSP header to limit inline script execution
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'self'";
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

