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

CVE-2026-26022

Gogs: Stored XSS via data URI in issue comments
Back to all
CVE

CVE-2026-26022

Gogs: Stored XSS via data URI in issue comments

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 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):

    ```html

    <a href="data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4=">Click me for XSS</a>

    ```

  1.  Commit and push the file.
  2.  Navigate to the file in the Gogs web interface.
  3.  Click the "Click me for XSS" link.
  4.  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.

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
8.7
-
3.1
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N
C
H
U
0
-
3.1
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N
C
H
U
8.7
-
3.1
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N

Related Resources

No items found.

References

https://github.com/gogs/gogs/security/advisories/GHSA-xrcr-gmf5-2r8j, https://nvd.nist.gov/vuln/detail/CVE-2026-26022, https://github.com/gogs/gogs/pull/8174, https://github.com/gogs/gogs/commit/441c64d7bd8893b2f4e48660a8be3a7472e14291, https://github.com/gogs/gogs, https://github.com/gogs/gogs/releases/tag/v0.14.2

Severity

8.7

CVSS Score
0
10

Basic Information

Ecosystem
Base CVSS
8.7
EPSS Probability
0.00017%
EPSS Percentile
0.04565%
Introduced Version
0,v0.12.0,v0.0.0-20191024085146-01c8df01ec06,v0.11.4,v0.0.0-20170404232959-d05395fe906d,v0.11,v0.0.0-20170331201910-761bb3cf5396
Fix Available
0.14.2,v0.14.2-rc.1,v0.0.0-20260211032631-441c64d7bd88

Fix Critical Vulnerabilities Instantly

Secure your app without upgrading.
Fix Without Upgrading