CVE-2026-52798
highpriority · track · 0EPSS 0.004 · 36 %ileDEEUUSEPSS · scored 2026-10-23
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.
cvss
Technical severity, 0–10. One row per scoring source.
base score 0–10 · higher = more severe · hover a vector to decode
ssvc
A stakeholder decision — act, attend, or track — from exploitation and impact.
weaknesses
The CWE weakness classes this flaw belongs to.
affected products (5)
Products and version ranges known to be affected.
advisories (3)
Vendor and ecosystem advisories describing this.
- WID-SEC-W-2026-2013Gogs: Mehrere SchwachstellenDeutsch2026-06-18csaf · cert_bundDE
Ein Angreifer kann mehrere Schwachstellen in Gogs ausnutzen, um erweiterte Berechtigungen zu erlangen, beliebigen Code auszuführen – sogar mit erweiterten Berechtigungen, was zur vollständigen Kontrolle über das System führen kann –, Sicherheitsmaßnahmen zu umgehen, Daten zu manipulieren, Cross-Site-Scripting-Angriffe durchzuführen, Benutzer auf bösartige Websites umzuleiten oder einen Denial-of-Service-Zustand zu verursachen.
- GHSA-jq8v-rmf6-65jwGogs has Stored XSS in `.ipynb` Preview2026-06-22ghsa · osvUS
# 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.
- GO-2026-5477Gogs has Stored XSS in `.ipynb` Preview in gogs.io/gogs2026-06-25vendor · osvUS
Gogs has Stored XSS in `.ipynb` Preview in gogs.io/gogs. NOTE: The source advisory for this report contains additional versions that could not be automatically mapped to standard Go module versions. (If this is causing false-positive reports from vulnerability scanners, please suggest an edit to the report.) The additional affected modules and versions are: gogs.io/gogs before v0.14.3.
also known as (5)
Other names and identifiers for this entity.
sources
Which sources assert this record, and when.
references (12)
External citations — patches, advisories, analysis.
- https://github.com/gogs/gogs/commit/17b168b11ca759a7550e1f4bbd68bbde14db7785cnnvd
- https://github.com/gogs/gogs/pull/8319cnnvd
- https://github.com/gogs/gogs/releases/tag/v0.14.3cnnvd
- https://github.com/gogs/gogs/security/advisories/GHSA-jq8v-rmf6-65jwcnnvd
- https://github.com/gogs/gogs/commit/17b168b11ca759a7550e1f4bbd68bbde14db7785enisa_euvd
- https://github.com/gogs/gogs/pull/8319enisa_euvd
- https://github.com/gogs/gogs/releases/tag/v0.14.3enisa_euvd
- https://github.com/gogs/gogs/security/advisories/GHSA-jq8v-rmf6-65jwenisa_euvd
Attackers weaponise vulnerabilities like this against internet-exposed services. See what is exposed on your perimeter with a free passive scan.
Free scan