CVE-2026-26022: Gogs Cross-Site Scripting Vulnerability
HIGHCVE-2026-26022 is a HIGH (CVSS 8.7) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Gogs libraries in the Go ecosystem. The issue involves stored xss via data uri in issue comments. Remediation is available by upgrading affected packages to version 0.14.2.
CVE-2026-26022 at a Glance
Security Impact
CVSS: 8.7
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N).
How to Fix CVE-2026-26022
To remediate this vulnerability, upgrade all affected Gogs dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade gogs.io/gogs to 0.14.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for gogs.io/gogs
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-26022, inspect your project dependencies for Gogs:
inspect dependencies for gogs.io/gogs
Analyze the terminal output to locate any version of Gogs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.14.2), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Gogs, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-26022 Affected Gogs Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
gogs.io/gogs
|
Go |
< 0.14.2
|
0.14.2
|
References
Frequently Asked Questions
What is CVE-2026-26022?
Which Gogs versions are affected?
What version fixes CVE-2026-26022?
Is gogs.io/gogs affected?
What is the CVSS score of CVE-2026-26022?
What CWE is associated with CVE-2026-26022?
How can I check Go dependencies for CVE-2026-26022?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-xrcr-gmf5-2r8j",
"modified" : "2026-03-05T22:28:35Z",
"published" : "2026-03-05T19:26:02Z",
"aliases" : [ "CVE-2026-26022" ],
"summary" : "Gogs: Stored XSS via data URI in issue comments",
"details" : "### Summary\nA 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.\n\n### Details\nThe 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:\n\n```go\n// internal/markup/sanitizer.go\nfunc NewSanitizer() {\n sanitizer.init.Do(func() {\n // ...\n // Data URLs\n sanitizer.policy.AllowURLSchemes(\"data\")\n // ...\n })\n}\n```\n\nWhile 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.\n\n### PoC\n1. Create a file named `exploit.md` in a repository.\n2. Add the following content (Raw HTML):\n ```html\n <a href=\"data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4=\">Click me for XSS</a>\n ```\n3. Commit and push the file.\n4. Navigate to the file in the Gogs web interface.\n5. Click the \"Click me for XSS\" link.\n6. **Result:** An alert box with \"XSS\" appears, executing the JavaScript payload.\n\n### Impact\nThis 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:\n* Steal authentication cookies and session tokens.\n* Perform arbitrary actions on behalf of the victim (e.g., modifying repositories, adding collaborators).\n* Redirect users to malicious sites.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "gogs.io/gogs"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.14.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 0.14.1"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/gogs/gogs/security/advisories/GHSA-xrcr-gmf5-2r8j"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-26022"
}, {
"type" : "WEB",
"url" : "https://github.com/gogs/gogs/pull/8174"
}, {
"type" : "WEB",
"url" : "https://github.com/gogs/gogs/commit/441c64d7bd8893b2f4e48660a8be3a7472e14291"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/gogs/gogs"
}, {
"type" : "WEB",
"url" : "https://github.com/gogs/gogs/releases/tag/v0.14.2"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-03-05T19:26:02Z",
"nvd_published_at" : "2026-03-05T19:16:03Z"
}
}