HIGH 8.9

CVE-2026-52798: Gogs Jupyter Notebook Stored XSS – Exploitation & Patch Guide

Gogs, a self-hosted Git service, contains a stored cross-site scripting (XSS) vulnerability in how it handles Jupyter notebook (.ipynb) file previews. While the server sanitizes notebook content through an API endpoint, the client-side rendering process re-processes this content without proper security controls, allowing malicious links with JavaScript schemes to execute when clicked. An attacker can craft a malicious notebook file that, when viewed by a victim in Gogs, triggers arbitrary JavaScript execution within the Gogs application context. This vulnerability requires user interaction (clicking a link) and authenticated access to upload or view the notebook, but the impact is severe because it operates within the Gogs origin with full application privileges.

Source data · NVD / CISA · public domain

CVSS
3.1 · 8.9 HIGH · CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:L
Weaknesses (CWE)
CWE-79
Affected products
0 configuration(s)
Published / Modified
2026-06-24 / 2026-06-25

NVD description (verbatim)

Gogs is an open source self-hosted Git service. Prior to 0.14.3, 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. This vulnerability is fixed in 0.14.3.

5 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability stems from a sanitization bypass in the client-side rendering pipeline for Jupyter notebook previews. Gogs implements server-side sanitization via the /-/api/sanitize_ipynb endpoint, which should remove dangerous content. However, the rendered HTML is subsequently processed by the marked() JavaScript library on elements with the .nb-markdown-cell class without re-validating the sanitization. During this re-rendering, link schemes that were previously neutralized (such as javascript:) can be reconstructed, bypassing the initial sanitization layer. This allows an attacker to embed malicious links in notebook markdown cells that execute arbitrary JavaScript when a victim clicks them, with the script running in the security context of the Gogs application. The root cause is the assumption that content sanitized server-side remains safe after client-side DOM manipulation and re-parsing.

Business impact

This vulnerability enables account compromise and lateral movement within organizations using self-hosted Gogs instances. An attacker with the ability to commit or upload notebook files (which may be any authenticated user, depending on repository permissions) can target other users viewing those notebooks. Successful exploitation allows theft of session cookies, API tokens, or other sensitive data accessible to the victim's Gogs account, as well as actions performed on behalf of the victim such as modifying code, creating new repositories, or escalating privileges. In environments where Gogs is used as a central Git service for development teams, this attack vector represents a significant supply-chain risk.

Affected systems

Gogs versions prior to 0.14.3 are affected. The vulnerability specifically impacts the Jupyter notebook preview functionality; systems that do not host .ipynb files or have disabled notebook preview are not exploitable. Self-hosted Gogs deployments are the primary concern, as this is not a SaaS offering. Any instance using an affected version that permits authenticated users to upload or commit notebook files is at risk.

Exploitability

The vulnerability requires a user to be authenticated and capable of viewing a crafted notebook file within Gogs, then clicking a malicious link embedded in that notebook. There is no network complexity or privilege escalation required beyond authentication, and the attack is reliable once the preconditions are met. However, it is not wormable or self-executing—user interaction (clicking) is mandatory. The CVSS score of 8.9 reflects the high impact (confidentiality and integrity compromise) balanced against the requirement for user interaction and prior authentication. Exploitation is straightforward for an attacker with access to a repository; no special tools or advanced techniques are needed beyond crafting a notebook with a JavaScript-scheme link.

Remediation

Upgrade Gogs to version 0.14.3 or later, which fixes the client-side sanitization issue. Verify that the update is applied to all instances, including development and staging environments where sensitive data or test repositories may be exposed. No workarounds are available for earlier versions; patching is the only remediation. Organizations should prioritize patching authenticated users who access notebooks containing sensitive information or those with high GitHub/GitLab integration.

Patch guidance

Apply the Gogs 0.14.3 update as soon as feasible. The patch addresses the re-rendering vulnerability by ensuring client-side markdown processing does not reintroduce dangerous link schemes. After patching, verify the fix by attempting to create a notebook with a javascript: link and confirming it is rendered inert. Test in a staging environment if available. If using a package manager or container image (e.g., Docker), ensure your image is rebuilt with the patched Gogs version. Monitor for any instances of Gogs still running older versions across your infrastructure.

Detection guidance

Monitor Gogs logs for .ipynb file uploads and views, particularly from external or untrusted contributors. Look for HTTP requests to /-/api/sanitize_ipynb with payloads containing javascript: or data: schemes in link attributes. Analyze notebook files in repositories for suspicious link schemes using static analysis or YARA rules matching notebook JSON content. In browser DevTools or proxy logs, watch for XSS execution (e.g., unexpected fetch requests to external domains, console errors from injected scripts) when users open notebooks. Security scanning tools that inspect notebook file contents for XSS patterns can detect malicious notebooks before they are exploited.

Why prioritize this

This vulnerability merits immediate attention despite its modest 8.9 CVSS score. The combination of high confidentiality and integrity impact, the ease of exploitation, and the prevalence of Gogs in development environments make it a priority. Development teams often store sensitive credentials, proprietary code, and access tokens in Git repositories; a successful XSS attack grants an attacker access to these assets. The barrier to exploitation is low (crafting a notebook file), and the attack is difficult for victims to detect. Organizations should patch before engaging in high-risk development activities or processing sensitive data within Gogs.

Risk score, explained

The CVSS 3.1 score of 8.9 (HIGH) reflects: Attack Vector Network (AV:N)—the attack is delivered remotely via the web interface; Attack Complexity Low (AC:L)—no special conditions or race conditions required; Privileges Required Low (PR:L)—any authenticated user can upload or view notebooks; User Interaction Required (UI:R)—the victim must click a link; Scope Changed (S:C)—the impact extends beyond the vulnerable component to the entire Gogs application. Confidentiality High (C:H) and Integrity High (I:H) reflect full compromise of user data and actions. Availability Low (A:L) reflects potential temporary disruption or session termination. The score is justified by the ease of triggering the vulnerability and the severity of the resulting compromise, offset only by the requirement for user interaction.

Frequently asked questions

Can this vulnerability be exploited without user interaction?

No. An attacker cannot execute JavaScript automatically when a notebook is viewed; the victim must click on the malicious link. This does not require clicking an obviously suspicious link—the attacker can hide the link in legitimate-looking markdown, such as a link to documentation or a reference within code comments.

Does upgrading to 0.14.3 require a service restart or data migration?

Verify against the vendor advisory or release notes for Gogs 0.14.3. Typically, Gogs upgrades do not require data migration, but it is always best practice to back up your database and repositories before applying updates.

What if we cannot patch immediately due to downtime constraints?

There is no known workaround for this vulnerability in earlier versions. Consider implementing network-level controls, such as restricting access to your Gogs instance to a VPN, and educating users to avoid clicking suspicious links in notebook previews. Plan an urgent maintenance window to apply the patch—the risk of compromise outweighs the cost of a brief outage.

Are other Git services (GitHub, GitLab) affected by this issue?

This vulnerability is specific to Gogs. GitHub and GitLab handle notebook rendering differently and are not affected by this particular sanitization bypass, though they may have their own separate XSS considerations in other contexts.

This analysis is provided for informational purposes and reflects publicly available information about CVE-2026-52798 as of the publication date. The vulnerability details, affected versions, and patch information are sourced from the official CVE record and vendor advisories. Security teams should verify all technical details, patch availability, and compatibility with their infrastructure against the official Gogs release notes and announcements before deploying fixes. This article does not constitute professional security advice; organizations should consult with their security teams and vendors regarding their specific environments. No exploit code or weaponized proof-of-concept is provided or endorsed by SEC.co. Source: NVD (public-domain), retrieved 2026-08-02. Analysis generated by SEC.co (claude-haiku-4-5).