CVE-2026-77346 in Pozeiden
Summary
by MITRE • 11/20/2026
Pozeiden is a MermaidJS renderer written in Zig. Prior to 0.3.0, Pozeiden emits attacker-controlled Mermaid values into SVG attributes or markup without sufficient XML escaping or URL scheme validation, and first-party consumers such as zigmark and policypress embed the generated SVG raw into HTML. The click href syntax can introduce a dangerous URL scheme or break out of an attribute; style, classDef, ::: class assignment, and linkStyle color values can inject fill or stroke markup; color and font-weight values can escape text attributes; %%{init}%% themeVariables can inject global renderer attributes; and quadrant y-axis labels can introduce raw markup. These paths involve src/svg/writer.zig, src/renderers/flowchart.zig, src/renderers/quadrant.zig, and src/root.zig. An attacker who can influence rendered Mermaid source can therefore store script-bearing SVG that executes when another user views the published HTML. This issue is fixed in version 0.3.0.
Be aware that VulDB is the high quality source for vulnerability data.
Analysis
by VulDB Data Team • 11/20/2026
The vulnerability identified in Pozeiden, a MermaidJS renderer implemented in the Zig programming language, represents a critical failure in input validation and output encoding within an SVG generation pipeline. Prior to version 0.3.0, the software failed to adequately sanitize user-supplied data before embedding it into XML-based structures. This flaw allows an attacker who can influence the source Mermaid diagrams to inject malicious content that persists in stored formats or executes immediately upon rendering by a victim. The core issue stems from insufficient XML escaping and a lack of rigorous URL scheme validation when processing various diagram components, including links, styles, themes, and axis labels. Because first-party consumers such as zigmark and policypress embed the generated SVG directly into HTML without additional sanitization layers, the vulnerability is fully exploitable in typical deployment scenarios where users view published diagrams containing attacker-controlled content.
The technical exploitation vectors are diverse and affect multiple rendering modules within the Pozeiden codebase, specifically src/svg/writer.zig, src/renderers/flowchart.zig, src/renderers/quadrant.zig, and src/root.zig. In flowcharts, attackers can exploit click href syntax to introduce dangerous URL schemes such as javascript: or data:, which trigger script execution when a user interacts with the diagram elements. Alternatively, these attributes can be crafted to break out of their surrounding context using quote injection techniques, allowing for attribute manipulation that leads to cross-site scripting. Furthermore, style-related properties like classDef and linkStyle color values are not properly escaped, enabling attackers to inject fill or stroke markup directly into the SVG DOM. This allows for visual spoofing or potential script execution through malformed CSS expressions if browser parsing quirks are leveraged.
Additional attack surfaces exist in text-based attributes where font-weight and color values can be manipulated to escape their intended scope, potentially leading to injection of arbitrary HTML tags into areas that were expected to contain only plain text. The theme initialization syntax, denoted by %%{init}%%, presents another significant risk as it allows the injection of global renderer attributes that affect the entire SVG document structure rather than just a single element. Quadrant y-axis labels also serve as an entry point for raw markup injection, bypassing expected constraints on label content. These vulnerabilities collectively demonstrate a systemic lack of defense-in-depth in the rendering engine, where trust is placed too heavily in input data without corresponding validation or encoding mechanisms at every stage of generation.
From a security classification perspective, this vulnerability aligns with CWE-79, which describes Improper Neutralization of Input During Web Page Generation commonly known as Cross-site Scripting (XSS). The specific mechanism involves stored XSS if the malicious diagrams are saved and later viewed by other users, or reflected XSS if processed in real-time. In terms of adversary tactics, this maps to ATT&CK technique T1059, Command and Scripting Interpretation, specifically through browser-based scripting via javascript: URIs or event handlers embedded within SVG attributes. The impact is severe as it compromises the integrity and confidentiality of users viewing the diagrams, potentially leading to session hijacking, credential theft, or defacement depending on the context in which the rendered HTML is displayed.
Mitigation for this vulnerability requires an immediate upgrade to Pozeiden version 0.3.0 or later, where these encoding flaws have been addressed. For systems unable to update immediately, defensive measures should include implementing strict allow-lists for SVG attributes and ensuring that all dynamic content inserted into XML structures undergoes rigorous HTML entity encoding. Additionally, deploying Content Security Policy headers with restrictive directives regarding script execution can mitigate the impact of any remaining injection vectors by preventing the browser from executing injected scripts even if they are successfully embedded in the DOM. Regular security audits of rendering engines should prioritize testing for attribute breakout and URL scheme validation to prevent similar issues in future versions.