Summary
OneUptime's Markdown viewer rendered Mermaid diagrams with a permissive securityLevel: "loose" setting and injected the generated SVG via innerHTML, allowing interactive event bindings.
When an attacker controls markdown content (for example in incident descriptions, status page announcements, or monitor notes), they can abuse Mermaid's click directive to execute arbitrary JavaScript in the victim's browser.
Affected context
The vulnerability affects any OneUptime deployment where:
- Markdown rendering is enabled in user-visible fields, and
- Mermaid diagrams are supported in the Markdown viewer, and
- The Mermaid renderer uses
securityLevel: "loose"and injects SVG output withinnerHTML.
Typical contexts include incident descriptions, status page announcements, monitor notes, and any other fields that accept markdown content and are displayed in a browser without sufficient script interaction restrictions.
Exploit preconditions
- Attack surface: Web UI where markdown with Mermaid diagrams is rendered.
- Required access: Ability to create or modify markdown content that will be rendered for other users (e.g., incident editors, status page maintainers, or any account with markdown input privileges).
- Trigger point: A victim user views a page where the crafted Mermaid diagram is rendered by the Markdown viewer.
- Why exploitation is possible: The Mermaid renderer is configured with
securityLevel: "loose"and its SVG output is inserted viainnerHTML, which allows event handlers and interactive directives (such as Mermaid'sclickdirective) to bind JavaScript execution in the rendered page context.
Why this happens
This issue stems from a combination of permissive client-side rendering configuration and unsafe DOM injection practices.
Mermaid's securityLevel: "loose" explicitly allows interactive event bindings, including the click directive that can trigger JavaScript actions.
The Markdown viewer then injects the generated Mermaid SVG into the DOM using innerHTML, a sink that can introduce script-capable markup when not carefully constrained.
Together, these behaviors map to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting), where untrusted content is allowed to influence active browser-side behavior without robust sanitization or isolation.
Potential impact
- Execution of arbitrary JavaScript in the context of the affected OneUptime domain
- Theft of session tokens or other sensitive data accessible via the browser (subject to cookie and CSP configuration)
- Unauthorized actions performed on behalf of the victim user (e.g., account changes, configuration updates)
- Manipulation or falsification of monitoring data, incident descriptions, or status announcements
- Use of the application as a pivot to deliver further phishing or social engineering attacks
General mitigation guidance
Effective mitigation focuses on treating all user-controlled markdown and diagram content as untrusted and minimizing its ability to create active behaviors in the browser:
- Prefer Mermaid's restricted security modes (e.g.,
securityLevel: "strict"or an equivalent) that disable interactive directives and event handlers. - Avoid injecting diagram output with
innerHTML; instead, use safer DOM APIs that do not interpret markup as executable behavior, or apply robust, allowlist-based SVG sanitization before insertion. - Restrict or fully disable high-risk features in diagram syntax (like
clickhandlers or other scripting hooks) when content originates from users. - Apply Content Security Policy (CSP) rules that reduce the impact of any residual XSS (e.g., disallow inline scripts and restrict script sources).
- Separate trusted and untrusted content paths: administrative or system-generated diagrams can be rendered with more capabilities, while user-generated content uses hardened rendering paths.
How teams detect issues like this
Detection should focus on identifying unsafe rendering patterns and interactive diagram usage:
- Static analysis / code scanning:
- Flag client-side code that sets Mermaid
securityLevelto"loose"or other permissive modes for untrusted content. - Detect uses of
innerHTML,outerHTML, or similar APIs where the source data originates from markdown or other user-controlled content. - Code review signals:
- Pay special attention to UI components that render markdown, diagrams, or rich text, verifying that they apply strict configuration and sanitization.
- Review any integrations with diagramming libraries (like Mermaid) to ensure interactive features are disabled for user input.
- Runtime / policy enforcement:
- Deploy CSP with reporting enabled to capture and investigate script execution attempts that originate from rendered diagrams.
- Use security testing tools or browser-based scanners to exercise markdown fields with synthetic Mermaid payloads and observe for active script behavior.
- Automated tooling:
- Integrate SAST/DAST tools into CI/CD pipelines to flag unsafe DOM sinks and permissive client configuration patterns before deployment.

