Get a Demo

Let's Patch It!

Book a short call with one our specialists, we'll walk you through how Endor Patches work, and ask you a few questions about your environment (like your primary programming languages and repository management). We'll also send you an email right after you fill out the form, feel free to reply with any questions you have in advance!

CVE

GHSA-26gq-grmh-6xm6

Gogs vulnerable to Stored XSS via Mermaid diagrams
Back to all
CVE

GHSA-26gq-grmh-6xm6

Gogs vulnerable to Stored XSS via Mermaid diagrams

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:

https://github.com/mermaid-js/mermaid/security/advisories/GHSA-7rqq-prvp-x9jh

https://github.com/mermaid-js/mermaid/security/advisories/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

  1. 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

Package Versions Affected

Package Version
patch Availability
No items found.

Automatically patch vulnerabilities without upgrading

Fix Without Upgrading
Detect compatible fix
Apply safe remediation
Fix with a single pull request

CVSS Version

Severity
Base Score
CVSS Version
Score Vector
C
H
U
-
C
H
U
0
-
3.1
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N
C
H
U
7.3
-
3.1
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N

Related Resources

No items found.

References

https://github.com/gogs/gogs/security/advisories/GHSA-26gq-grmh-6xm6, https://github.com/mermaid-js/mermaid/security/advisories/GHSA-7rqq-prvp-x9jh, https://github.com/mermaid-js/mermaid/security/advisories/GHSA-8gwm-58g9-j8pw, https://github.com/gogs/gogs/commit/71a72a72ad1c8cea7940c9d7e4cbdfbc0fc3d401, https://github.com/gogs/gogs

Severity

7.3

CVSS Score
0
10

Basic Information

Ecosystem
Base CVSS
7.3
EPSS Probability
0%
EPSS Percentile
0%
Introduced Version
0,v0.0.0-20220305112308-7c893a58da40,v0.13.0-rc.1
Fix Available
0.13.4,v0.0.0-20251204055806-2c88cd4d9fdc,v0.13.4-rc.1

Fix Critical Vulnerabilities Instantly

Secure your app without upgrading.
Fix Without Upgrading