CVE-2026-26022
JSON

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 packageVersionsReported by
gogs gogs< 0.14.2, before 0.14.2CVE List, NVD
gogs.io/gogs (Go)before 0.14.2, all versionsGitHub Advisory Database, Go Vulnerability Database

All scores

GitHub_M8.7high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N
GitHub8.7high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N
NVD5.4medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N

Classification

CWE-79

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
  1. Create a file named exploit.md in a repository.
  2. Add the following content (Raw HTML):
    <a href="data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4=">Click me for XSS</a>
    
  3. Commit and push the file.
  4. Navigate to the file in the Gogs web interface.
  5. Click the "Click me for XSS" link.
  6. 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

Sources

SourceRecordLicence
CVE ListCVE-2026-26022 changed 2026-03-10CVE Terms of Use
GitHub Advisory DatabaseGHSA-xrcr-gmf5-2r8j changed 2026-03-23CC-BY-4.0
Go Vulnerability DatabaseGO-2026-4620 changed 2026-03-23CC-BY-4.0
NVDCVE-2026-26022 changed 2026-06-17Public domain