8.7high
Gogs: Stored XSS via data URI in issue comments
- Severity
- 8.7high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.53% (higher than 39% of CVEs)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-xrcr-gmf5-2r8jGO-2026-4620
Description
Gogs is an open source self-hosted Git service. Prior to version 0.14.2, a stored cross-site scripting (XSS) vulnerability exists in the comment and issue description functionality. The application's HTML sanitizer explicitly allows data: URI schemes, enabling authenticated users to inject arbitrary JavaScript execution via malicious links. This issue has been patched in version 0.14.2.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| gogs gogs | < 0.14.2, before 0.14.2 | CVE List, NVD |
| gogs.io/gogs (Go) | before 0.14.2, all versions | GitHub Advisory Database, Go Vulnerability Database |
All scores
| GitHub_M | 8.7high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N |
| GitHub | 8.7high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N |
| NVD | 5.4medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total.
What each source says
CVE List
Gogs is an open source self-hosted Git service. Prior to version 0.14.2, a stored cross-site scripting (XSS) vulnerability exists in the comment and issue description functionality. The application's HTML sanitizer explicitly allows data: URI schemes, enabling authenticated users to inject arbitrary JavaScript execution via malicious links. This issue has been patched in version 0.14.2.
GitHub Advisory Database
Summary
A Stored Cross-site Scripting (XSS) vulnerability exists in the comment and issue description functionality. The application's HTML sanitizer explicitly allows data: URI schemes, enabling authenticated users to inject arbitrary JavaScript execution via malicious links.
Details
The vulnerability is located in internal/markup/sanitizer.go. The application uses the bluemonday HTML sanitizer but explicitly weakens the security policy by allowing the data URL scheme:
// internal/markup/sanitizer.go
func NewSanitizer() {
sanitizer.init.Do(func() {
// ...
// Data URLs
sanitizer.policy.AllowURLSchemes("data")
// ...
})
}
While the Markdown renderer rewrites relative links (mitigating standard Markdown [link](data:...) attacks), Gogs supports Raw HTML input. Raw HTML anchor tags bypass the Markdown parser's link rewriting and are processed directly by the sanitizer. Since the sanitizer is configured to allow data: URIs, payloads like <a href="data:text/html..."> are rendered as-is.
PoC
- Create a file named
exploit.mdin a repository. - Add the following content (Raw HTML):
<a href="data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4=">Click me for XSS</a> - Commit and push the file.
- Navigate to the file in the Gogs web interface.
- Click the "Click me for XSS" link.
- Result: An alert box with "XSS" appears, executing the JavaScript payload.
Impact
This is a Stored XSS vulnerability. Any user who views the malicious comment and clicks the link will execute the attacker-supplied JavaScript in their browser context. This allows attackers to:
- Steal authentication cookies and session tokens.
- Perform arbitrary actions on behalf of the victim (e.g., modifying repositories, adding collaborators).
- Redirect users to malicious sites.
Go Vulnerability Database
Gogs: Stored XSS via data URI in issue comments in gogs.io/gogs.
NOTE: The source advisory for this report contains additional versions that could not be automatically mapped to standard Go module versions.
(If this is causing false-positive reports from vulnerability scanners, please suggest an edit to the report.)
The additional affected modules and versions are: gogs.io/gogs before v0.14.2.
NVD (es)
Gogs es un servicio Git autoalojado de código abierto. Antes de la versión 0.14.2, existe una vulnerabilidad de cross-site scripting (XSS) almacenado en la funcionalidad de comentarios y descripción de incidencias. El saneador HTML de la aplicación permite explícitamente esquemas URI data:, permitiendo a usuarios autenticados inyectar ejecución arbitraria de JavaScript a través de enlaces maliciosos. Este problema ha sido parcheado en la versión 0.14.2.
References
| https://github.com/gogs/gogs/security/advisories/GHSA-xrcr-gmf5-2r8j | advisory, exploit, vendor-advisory, web | |
| https://github.com/gogs/gogs/pull/8174 | issue-tracking, web | |
| https://github.com/gogs/gogs/commit/441c64d7bd8893b2f4e48660a8be3a7472e14291 | patch, web | |
| https://github.com/gogs/gogs/releases/tag/v0.14.2 | release-notes, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-26022 | advisory | |
| https://github.com/gogs/gogs | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-26022 changed 2026-03-10 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-xrcr-gmf5-2r8j changed 2026-03-23 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2026-4620 changed 2026-03-23 | CC-BY-4.0 |
| NVD | CVE-2026-26022 changed 2026-06-17 | Public domain |