CVE-2026-0752 Overview
CVE-2026-0752 is a Cross-Site Scripting (XSS) vulnerability affecting GitLab Community Edition (CE) and Enterprise Edition (EE). The vulnerability exists in the Mermaid diagram rendering sandbox UI, where under certain circumstances, an unauthenticated attacker could inject arbitrary scripts. This flaw affects all GitLab versions from 16.2 before 18.7.5, 18.8 before 18.8.5, and 18.9 before 18.9.1.
Critical Impact
Unauthenticated attackers can inject malicious scripts into the Mermaid sandbox UI, potentially leading to session hijacking, credential theft, or unauthorized actions performed on behalf of authenticated users.
Affected Products
- GitLab CE/EE versions from 16.2 to 18.7.4
- GitLab CE/EE versions 18.8.0 to 18.8.4
- GitLab CE/EE versions 18.9.0 before 18.9.1
Discovery Timeline
- 2026-02-25 - CVE-2026-0752 published to NVD
- 2026-02-25 - Last updated in NVD database
Technical Details for CVE-2026-0752
Vulnerability Analysis
This vulnerability is classified as CWE-79 (Improper Neutralization of Input During Web Page Generation), commonly known as Cross-Site Scripting. The flaw resides in GitLab's Mermaid diagram rendering functionality, which provides a sandbox environment for displaying flowcharts, sequence diagrams, and other visual representations within GitLab issues, merge requests, and wiki pages.
The vulnerability allows unauthenticated users to craft malicious input that bypasses the Mermaid sandbox's input sanitization mechanisms. When this malicious content is rendered in a victim's browser, arbitrary JavaScript code executes within the context of the GitLab application. This can lead to session token theft, phishing attacks via UI manipulation, or performing actions as the authenticated user.
The network-based attack vector requires user interaction—a victim must view the page containing the malicious Mermaid diagram. However, the scope is changed, meaning the vulnerability can impact resources beyond the vulnerable component itself, potentially affecting other web origins or user sessions.
Root Cause
The root cause stems from insufficient input validation and output encoding within the Mermaid sandbox rendering component. The sandbox environment, designed to safely render user-supplied diagram markup, failed to properly sanitize certain character sequences or escape sequences under specific conditions. This allowed specially crafted Mermaid diagram syntax to break out of the sandbox context and inject executable script content into the rendered page.
Attack Vector
The attack leverages the network-accessible Mermaid diagram rendering feature in GitLab. An attacker can exploit this vulnerability by:
- Creating a GitLab issue, merge request comment, or wiki page containing a malicious Mermaid diagram
- The diagram syntax contains specially crafted escape sequences that bypass sanitization
- When another user views the content, the malicious script executes in their browser context
- The script can steal session cookies, redirect users to phishing pages, or perform actions on behalf of the victim
The vulnerability is particularly concerning because it can be exploited by unauthenticated users on GitLab instances that allow public access to certain projects or repositories. For detailed technical information, see the HackerOne Security Report.
Detection Methods for CVE-2026-0752
Indicators of Compromise
- Unusual or obfuscated content within Mermaid diagram blocks in issues, merge requests, or wikis
- JavaScript errors or unexpected script execution when viewing GitLab pages containing diagrams
- Reports from users of unexpected browser behavior or redirects when viewing GitLab content
- Suspicious session activity following user interaction with diagram-containing pages
Detection Strategies
- Monitor GitLab application logs for unusual patterns in diagram rendering requests
- Implement Content Security Policy (CSP) violation reporting to detect script injection attempts
- Review recently created or modified issues and merge requests containing Mermaid diagrams for suspicious content
- Deploy web application firewall (WAF) rules to detect common XSS payloads in request bodies
Monitoring Recommendations
- Enable and review GitLab audit logs for unusual content creation patterns
- Configure browser-side CSP reporting to capture attempted XSS exploitation
- Monitor for abnormal user session behavior that may indicate session hijacking
- Set up alerts for bulk creation of issues or comments containing diagram syntax
How to Mitigate CVE-2026-0752
Immediate Actions Required
- Upgrade GitLab CE/EE to version 18.9.1, 18.8.5, or 18.7.5 depending on your release track
- Review Content Security Policy headers to ensure script-src restrictions are properly configured
- Audit existing issues, merge requests, and wiki pages for potentially malicious Mermaid diagrams
- Consider temporarily restricting public access to projects until patching is complete
Patch Information
GitLab has released patched versions addressing this vulnerability. Organizations should upgrade to the following versions:
- GitLab 18.9 track: Upgrade to 18.9.1 or later
- GitLab 18.8 track: Upgrade to 18.8.5 or later
- GitLab 18.7 track: Upgrade to 18.7.5 or later
For detailed patch information and upgrade instructions, refer to the GitLab Patch Release Notes. Additional technical details are available in the GitLab Issue Tracker Entry.
Workarounds
- Implement strict Content Security Policy headers with restrictive script-src directives as a defense-in-depth measure
- Temporarily disable Mermaid diagram rendering if the feature is not business-critical
- Restrict project visibility to authenticated users only until patches can be applied
- Deploy a web application firewall with XSS detection rules in front of GitLab instances
# Example: Configure nginx to add CSP headers for GitLab
# Add to your GitLab nginx configuration
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; object-src 'none'; frame-ancestors 'self';" always;
# Verify current GitLab version
gitlab-rake gitlab:env:info
# Upgrade GitLab (Omnibus installation)
apt-get update && apt-get install gitlab-ee=18.9.1-ee.0
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


