Skip to content
Fencer Intel
high 7.3

GHSA-26gq-grmh-6xm6 json

Gogs vulnerable to Stored XSS via Mermaid diagrams

published 9mo ago modified 8mo ago also GO-2026-4454

cvss
7.3
version 3.1, GitHub
cisa kev
Not listed
not in CISA's catalog
epss
—
no score, EPSS covers CVEs only
public exploits
0
none known

Summary

### 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.](https://github.com/gogs/gogs/releases/tag/v0.13.0)

Currently used version of the library [mermaid 11.9.0](https://github.com/gogs/gogs/tree/main/public/plugins/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](https://github.com/mermaid-js/mermaid/security/advisories/GHSA-8gwm-58g9-j8pw)) ``` architecture-beta group api(cloud)[API] service db "<img src=x onerror=\"alert(document.domain)\">" [Database] in api ``` 2. 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

Patch / fix

  • go gogs.io/gogs 0.13.4

Is GHSA-26gq-grmh-6xm6 in your dependencies? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.

Check with Fencer

CVSS scores

assigned by version score vector
GitHub 3.1 7.3 CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N

Affected packages

ecosystem package affected fixed in
go gogs.io/gogs
<0.13.4
all versions
0.13.4

Classification

Weakness
  • CWE-1395 Dependency on Vulnerable Third-Party Component
  • CWE-79 Improper Neutralization of Input During Web Page Generation

References

Sources

Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.