Executive brief
Gogs is an open-source self-hosted Git service used by developers to manage source code. A security flaw in how the platform handles Jupyter Notebook files allows attackers to bypass security filters and inject malicious scripts. If a user is tricked into interacting with a specially crafted notebook preview, an attacker could execute unauthorized actions or steal sensitive information from the user's session.
Technical details
A Cross-Site Scripting (XSS) vulnerability exists in Gogs' Jupyter Notebook (.ipynb) sanitization endpoint. The 'POST /-/api/sanitize_ipynb' endpoint utilizes the bluemonday library with a policy that explicitly allows all 'data:' URI schemes via 'p.AllowURLSchemes("data")'. This configuration fails to restrict the MIME types allowed within the data URI, permitting 'data:text/html' payloads containing malicious JavaScript. Furthermore, the endpoint lacks authentication middleware, making it accessible to any registered user. An attacker can submit crafted HTML to the endpoint and receive a response where the malicious script is preserved, which executes when rendered in a victim's browser context. This was resolved in version 0.14.3 by implementing a restricted allowlist for safe image MIME types.
Affected products
- Gogs Gogs < 0.14.3
Timeline
- 2026-06-06: patched: Fix merged into main branch
- 2026-06-07: advisory: Version 0.14.3 released
- 2026-06-24: disclosed: CVE-2026-52816 published