CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-39H7-PWV7-RC3X

GHSA-39H7-PWV7-RC3X: DOM-based XSS in Excalidraw via Mermaid Diagram Rendering

Amit Schendel
Amit Schendel
Senior Security Researcher

Apr 25, 2026·4 min read·22 visits

Executive Summary (TL;DR)

DOM-based XSS in Excalidraw resulting from un-sanitized KaTeX label rendering in the upstream Mermaid engine.

Excalidraw suffers from a DOM-based Cross-Site Scripting (XSS) vulnerability caused by an upstream flaw in the Mermaid diagramming library. The issue occurs during the dimension calculation of KaTeX-rendered labels, leading to arbitrary JavaScript execution when a malicious diagram is rendered in the browser.

Vulnerability Overview

The @excalidraw/excalidraw library contains a DOM-based Cross-Site Scripting (XSS) vulnerability. This flaw allows an attacker to execute arbitrary JavaScript in the context of the application hosting the Excalidraw component.

The vulnerability originates from an upstream dependency flaw tracked as CVE-2025-54881 and GHSA-7rqq-prvp-x9jh. Excalidraw uses the @excalidraw/mermaid-to-excalidraw package to parse and render Mermaid diagram definitions.

Because Excalidraw relies on the Mermaid engine to calculate element dimensions during this conversion process, it inherits the insecure rendering pipeline present in vulnerable versions of Mermaid. This chain of trust allows malicious diagram definitions to compromise the host application.

Root Cause Analysis

The root cause of this vulnerability lies in the calculateMathMLDimensions function within the Mermaid engine. This function resides in the packages/mermaid/src/diagrams/common/common.ts file and is responsible for measuring the physical dimensions of text labels containing mathematical expressions.

The function receives raw text input from the diagram definition and passes it to the renderKatex function. The renderKatex function processes LaTeX delimiters but fails to sanitize the surrounding HTML context.

The resulting string is directly assigned to the innerHTML property of a dynamically created div element. This element is subsequently appended to the document.body to calculate its rendered size. This specific sequence of operations creates a classic DOM-based XSS sink.

Code Analysis

The vulnerable implementation processes untrusted input directly into a DOM sink without prior sanitization. The innerHTML assignment forces the browser to parse and execute any malicious payload embedded in the diagram label.

export const calculateMathMLDimensions = (text: string, config: MermaidConfig) => {
  text = renderKatex(text, config); // Processes math but does not sanitize HTML
  const divElem = document.createElement('div');
  divElem.innerHTML = text; // DANGEROUS SINK
  divElem.id = 'katex-temp';
  document.body.appendChild(divElem); // Browser executes the payload here
  // Measurement logic follows
};

The upstream patch addresses this by refactoring the rendering pipeline to be asynchronous and introducing strict sanitization. The sanitization step uses DOMPurify to strip dangerous HTML tags and attributes before the string reaches the DOM sink.

// Patched implementation uses an asynchronous pipeline and DOMPurify
export const calculateMathMLDimensions = async (text: string, config: MermaidConfig) => {
  text = await renderKatexSanitized(text, config); // Input is now sanitized
  const divElem = document.createElement('div');
  divElem.innerHTML = text; // SAFE SINK
  // ...
};

Exploitation

Exploitation requires the attacker to supply a crafted Mermaid diagram definition to an application utilizing the vulnerable Excalidraw component. The payload must include valid KaTeX delimiters to trigger the vulnerable code path.

The attacker constructs a label within a supported diagram type, such as a sequence diagram, containing a malicious HTML element. An image tag with an onerror event handler is highly reliable for this purpose.

When the victim attempts to view or convert the diagram, Excalidraw invokes the Mermaid parsing engine. The engine processes the label, reaches the innerHTML assignment, and executes the embedded JavaScript within the victim's browser session.

Impact Assessment

Successful exploitation grants the attacker the ability to execute arbitrary JavaScript within the security context of the victim's browser session. The severity of this execution depends entirely on the privileges and data accessible to the hosting application.

An attacker can access sensitive data stored in localStorage, sessionStorage, or non-HttpOnly cookies. This access frequently leads to session hijacking and unauthorized account access.

Furthermore, the injected script can perform arbitrary actions on behalf of the user by interacting with the application's APIs. In a collaborative environment like Excalidraw, the attacker could silently modify diagrams, exfiltrate proprietary designs, or pivot to attack other users viewing the same document.

Remediation

Remediation requires updating the @excalidraw/excalidraw dependency to version 0.18.1 or later. This release updates the @excalidraw/mermaid-to-excalidraw package to version 1.1.1, which contains the secure upstream Mermaid implementation.

If the application uses @excalidraw/mermaid-to-excalidraw independently of the main Excalidraw package, developers must ensure it is updated to at least version 1.1.1 or the 2.0.0 branch.

Applications should also enforce strict Content Security Policy (CSP) headers to restrict script execution and limit the impact of potential XSS vulnerabilities. Disabling inline scripts prevents the execution of event handler payloads used in this exploit.

Fix Analysis (2)

Technical Appendix

CVSS Score
7.5/ 10

Affected Systems

@excalidraw/excalidraw@excalidraw/mermaid-to-excalidrawmermaid

Affected Versions Detail

Product
Affected Versions
Fixed Version
@excalidraw/excalidraw
Excalidraw
<= 0.18.00.18.1
@excalidraw/mermaid-to-excalidraw
Excalidraw
< 1.1.11.1.1
mermaid
Mermaid
< 10.9.410.9.4
AttributeDetail
CWE IDCWE-79
Attack VectorNetwork / Client-Side
Vulnerability TypeDOM-based Cross-Site Scripting (XSS)
Exploit StatusProof of Concept Available
Upstream Root CauseCVE-2025-54881
Affected SinkinnerHTML within calculateMathMLDimensions

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1059.007Command and Scripting Interpreter: JavaScript
Execution
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Vulnerability Timeline

Upstream fix merged into Mermaid engine
2025-08-01
Upstream advisory GHSA-7rqq-prvp-x9jh published
2025-08-19
Excalidraw advisory GHSA-39H7-PWV7-RC3X published and fix released
2025-08-19

References & Sources

  • [1]CWE-79
  • [2]CVE-2025-54881 (NVD Detail)
  • [3]Mermaid Security Advisory GHSA-7rqq-prvp-x9jh
  • [4]GitHub Advisory GHSA-39H7-PWV7-RC3X
  • [5]Excalidraw Security Advisory
  • [6]Excalidraw v0.18.1 Release Notes

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 5 hours ago•GHSA-X445-F3H2-J279
7.5

GHSA-X445-F3H2-J279: OAuth Provider Confusion in Auth.js and NextAuth.js

A critical logical security flaw exists in Auth.js (formerly NextAuth.js) where signed anti-CSRF check cookies (state, nonce, and PKCE code_verifier) are not bound to the specific Identity Provider that initiated the authorization flow. In multi-provider environments, this allows an attacker to replay valid, cryptographically signed cookies minted during a flow with one provider against a callback handling a different provider. This vulnerability can lead to session hijacking, identity theft, or unauthorized account linking.

Alon Barad
Alon Barad
4 views•7 min read
•about 6 hours ago•GHSA-7RQJ-J65F-68WH
8.1

GHSA-7RQJ-J65F-68WH: Account Takeover via Homoglyph Bypass in NextAuth.js Email Normalization

A security vulnerability in the email normalization logic of NextAuth.js and Auth.js allows remote attackers to bypass email validation constraints and achieve Account Takeover (ATO) through Unicode homoglyph smuggling. Under standard conditions, Unicode compatibility characters represent visually similar symbols that are normalized downstream to ASCII equivalents, facilitating structural validation bypasses. This issue specifically affects passwordless email authentication flows.

Alon Barad
Alon Barad
5 views•6 min read
•about 7 hours ago•GHSA-XMF8-CVQR-RFGJ
7.5

GHSA-XMF8-CVQR-RFGJ: Denial of Service via Uncaught Exception and Session Confusion in Auth.js

Auth.js (formerly NextAuth.js) contains a denial of service vulnerability due to an uncaught URIError in the getToken() token parser when processing malformed percent-encoded sequences in bearer tokens. Additionally, the library was vulnerable to session state confusion and replay attacks because OAuth check cookies (state, nonce, and PKCE) were not properly bound to specific providers, permitting cross-provider token reuse.

Amit Schendel
Amit Schendel
5 views•6 min read
•about 8 hours ago•CVE-2026-53467
5.3

CVE-2026-53467: Heap Information Disclosure via Uninitialized Pixel Cache in ImageMagick MNG Decoder

CVE-2026-53467 is a heap information disclosure vulnerability in the Multiple-image Network Graphics (MNG) decoder of ImageMagick. The vulnerability arises from a failure to zero-initialize newly allocated pixel cache memory buffers. A remote attacker can exploit this by submitting a crafted sparse MNG image file to trigger uninitialized memory preservation. The resulting output contains residual heap bytes, potentially leaking sensitive process memory or assisting in ASLR bypass.

Amit Schendel
Amit Schendel
7 views•6 min read
•about 9 hours ago•CVE-2026-55223
6.3

CVE-2026-55223: Remote Code Execution via Deserialization Gadget Chain in c3p0 Connection Pooling Library

An untrusted deserialization vulnerability exists in the c3p0 JDBC connection pooling library before version 0.14.0. Standard JDBC getter methods conform to the JavaBean property getter pattern, allowing introspection libraries like Apache Commons BeanUtils to evaluate connection properties dynamically during deserialization, leading to arbitrary code execution when chained with a vulnerable database driver or JNDI sink.

Alon Barad
Alon Barad
6 views•6 min read
•about 10 hours ago•CVE-2026-54696
3.7

CVE-2026-54696: Heap-based Buffer Overflow in Ruby json Gem Native C Extension

A heap-based buffer overflow vulnerability exists in the native C extension of the Ruby json gem (versions 2.9.0 through 2.19.8) during IO-based streaming serialization. An incorrect buffer size calculation can lead to memory corruption and process termination when processing large strings.

Alon Barad
Alon Barad
8 views•6 min read