Skip to content

Gogs vulnerable to Stored XSS via Mermaid diagrams

High severity GitHub Reviewed Published Feb 6, 2026 in gogs/gogs

Package

gomod gogs.io/gogs (Go)

Affected versions

<= 0.13.3

Patched versions

0.13.4

Description

Summary

Stored XSS via mermaid diagrams due to usage of vulnerable renderer library

Details

Gogs introduced support for rendering mermaid diagrams in version 0.13.0.

Currently used version of the library mermaid 11.9.0 is vulnerable to at least two XSS scenarios with publicly available payloads

Resources:
GHSA-7rqq-prvp-x9jh
GHSA-8gwm-58g9-j8pw

PoC

  1. Create a markdown file eg. README.md containing following malicious mermaid diagram (payload based on CVE-2025-54880)
architecture-beta
    group api(cloud)[API]
    service db "<img src=x onerror=\"alert(document.domain)\">" [Database] in api
  1. The XSS should pop whenever either repository or file is viewed

Demo

https://github.com/user-attachments/assets/98320f62-6c1c-4254-aa61-95598c725235

Impact

The attacker can potentially achieve account takeover
In a worst case scenario if the victim were an instance admin this could lead to a compromise of the entire deployment

Proposed remediation steps

  1. Upgrade to a patched version of the third party library
    https://github.com/mermaid-js/mermaid/releases/tag/v10.9.5
  2. Consider running mermaid using sandbox level which would mitigate impact of future potential cross-site scripting issues
    https://mermaid.js.org/config/usage.html#securitylevel

References

@unknwon unknwon published to gogs/gogs Feb 6, 2026
Published to the GitHub Advisory Database Feb 6, 2026
Reviewed Feb 6, 2026

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N

EPSS score

Weaknesses

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. Learn more on MITRE.

Dependency on Vulnerable Third-Party Component

The product has a dependency on a third-party component that contains one or more known vulnerabilities. Learn more on MITRE.

CVE ID

No known CVE

GHSA ID

GHSA-26gq-grmh-6xm6

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.