GITEA.DEV · CVE-2026-120729 · Package
FIX → 28.4.0
Gitea's issue reference popup fetches a path built from the hovered link and inserts part of the response as HTML, so a crafted link pointing at a raw file in an attacker's repository can run script in another signed-in user's browser session when hovered. The attacker can read anything the victim sees and act as the victim, including administrators.
first public Nov 15, 2026 · 2 sources
Check it with your coding agent
It reads this page and tells you if your code or app is affected.
Any self-hosted Gitea instance from 1.27 through 28.3.0 is exposed, because the popup behaviour is on by default and any account the site has issued can plant the link. Instances on versions before 1.27 are not affected by this code path, and the advisory notes the flaw was introduced in 1.27.0-rc0.
Not affected if managed-hosting-patched, version-before-1.27
Who cares gitea, self-hosted
gitea --version or check the Gitea server version in the admin dashboard and compare to the affected range >= 1.27, <= 28.3.0.Upgrade to 28.4.0
28.4.0A stored XSS in the issue reference popup lets any regular Gitea user run script on the Gitea origin, in the session of another signed-in user, when that user rests the mouse on what looks like an ordinary #1 issue reference. No click is needed. The attacker commits a JSON file to their own repository and posts a link into that file's raw path in an issue, pull request or comment. Gitea renders the link as #1. On hover, the victim's frontend fetches the attacker's file and inserts one of its fields into the page as HTML. This works on default settings. The attacker needs an issued account (self-registration is off by default), a repository the victim can read, and a host to serve a script.
The cause is that showRefIssuePopup (web_src/js/features/ref-issue.ts:26) requests ${link.pathname}/info instead of the real /{owner}/{repo}/issues/{index}/info endpoint. ContextPopup.vue then renders the answer's renderedLabels with v-html. Two checks fail to stop an arbitrary path from reaching this code:
parseIssueHref uses an unanchored regex.Are you affected?
Ask from here. InfraStack checks the affected versions against your stack and answers in your inbox.
InfraStack checks the affected versions against your stack and answers in Slack, with the evidence and the fix.
InfraStack checks it against your stack and answers on your report, with the evidence and the fix.
fullIssuePatternProcessor gives the ref-issue class and #N text to any same-site URL that merely ends in /owner/repo/issues/N.As a result, /mallory/x/raw/branch/main/alice/app/issues/1 is treated as a genuine reference, and the popup loads mallory's committed file through the raw route. Links inside the dashboard feed and repo activity ([data-ref-issue-container]) reach the popup even without the class.
The attached reproducer runs the shipped frontend bundle in happy-dom with the victim's session. It shows the hover fetching the attacker's file, an <iframe srcdoc> being inserted, and the attacker's externally hosted script reading the victim's page URL and user name. happy-dom does not enforce Content-Security-Policy, so execution in a real browser has not been observed. It follows from the page's script-src * policy, which permits an external script inside a same-origin srcdoc frame.
The behaviour was introduced in 12d83cbfa3ca ("Extend issue context popup beyond markdown content (#36908)", first in v1.27.0-rc0). Before that commit, the popup built its request URL from the parsed owner, repo and index.
Commit 31626de2a6cdd3e1fe93216e4ac80f511297f1e7, default configuration. The attacker is a regular user (self-registration is off by default, so an account the site has issued) with a public repository of their own who can write an issue, pull request or comment that the victim reads. The victim rests the mouse for 300 ms on a link that is rendered as an ordinary #1 issue reference; nothing is clicked.
The issue reference popup takes its data from the path of the hovered link plus /info, and inserts one field of the answer as HTML:
// web_src/js/features/ref-issue.ts:24
async function showRefIssuePopup(link: HTMLAnchorElement) {
const [data, {default: ContextPopup}] = await Promise.all([
getIssueInfo(`${link.pathname}/info`), // :26
…
const app = createApp(ContextPopup, {
issue: data.convertedIssue,
renderedLabels: data.renderedLabels, // :32
<!-- web_src/js/components/ContextPopup.vue:43 -->
<div v-if="issue.labels.length" v-html="renderedLabels"/>
This is safe only while <path>/info is the route GET /{owner}/{repo}/(issues|pulls)/{index}/info (routers/web/web.go:1313), where GetIssueInfo builds renderedLabels on the server with RenderLabels (routers/web/repo/issue.go:274). Nothing restricts the link to that route. For the link
http://<gitea>/mallory/x/raw/branch/main/alice/app/issues/1
the popup requests /mallory/x/raw/branch/main/alice/app/issues/1/info, which is the file alice/app/issues/1/info on branch main of mallory's repository mallory/x, served by the raw route (routers/web/web.go:1696). Its content is whatever mallory committed.
Two conditions decide whether a hovered link gets the popup (ref-issue.ts:52-53), and the link above meets both.
The first is parseIssueHref, whose expression is not anchored, so any path that contains a/b/issues/N passes:
// web_src/js/utils.ts:52
export function parseIssueHref(href: string): IssuePathInfo | null {
// FIXME: it should use pathname and trim the appSubUrl ahead
const path = (href || '').replace(/[#?].*$/, '');
const match = /([^/]+)\/([^/]+)\/(issues|pulls)\/([0-9]+)/.exec(path);
The second is that the link has the class ref-issue or sits inside a [data-ref-issue-container]. The markup backend hands out that class itself. issueFullPattern (modules/markup/html.go:81) starts with https?://(?:\S+/), so it matches any URL that ends in /a/b/issues/N, and fullIssuePatternProcessor (modules/markup/html_issue.go:47-73) only checks that the URL is on the current site, takes the last path segments as owner and repository, and emits the link with class ref-issue. Written as a bare URL in an issue of alice/app, the link above is rendered as
<a href="http://<gitea>/mallory/x/raw/branch/main/alice/app/issues/1" class="ref-issue" …>#1</a>
which reads #1, exactly like the genuine reference to alice/app#1.
What was observed: the shipped frontend bundle, run in a DOM emulation (happy-dom) with alice's session, requests mallory's file on hover and inserts the iframe into the document; the emulation then loads x.js, which reads top.location and the signed-in user name from the parent page. The same run on a genuine reference requests /alice/app/issues/1/info and inserts no frame.
What was not observed, because no browser is available offline: enforcement of the page's Content-Security-Policy, which happy-dom does not implement. The policy is delivered as a meta tag (services/context/context_template.go:136-142), and the issue page carries no policy header:
default-src * data: blob:;script-src * 'nonce-…';style-src * 'unsafe-inline';
It stops inline scripts and inline event handlers, which is why the payload is not <script>…</script> or onerror=. It does not stop this payload: a srcdoc frame has the origin of its parent and inherits the parent's policy, the script in it is a parser-inserted external script, and script-src * allows an external script from any host. The frame has no sandbox attribute, so the script reaches the Gitea page through top.
The [data-ref-issue-container] branch of the second condition needs no backend help at all. The dashboard activity feed (templates/user/dashboard/feeds.tmpl:1) is such a container, and a comment [more details](/mallory/x/raw/branch/main/alice/app/issues/1) on an issue in alice's repository shows up in alice's own dashboard feed as a link with that href and free text. In the same emulation, hovering it on / requests mallory's file and runs the script there. templates/repo/activity.tmpl:8 is the other container.
A regular user can run script on the Gitea origin in the session of any user who hovers a planted reference: in an issue, pull request or comment of any repository the attacker may post in (including the victim's own), or in the victim's dashboard feed. The link is indistinguishable from a normal #N reference and the only interaction is resting the mouse on it. The script can read everything the victim can see and perform any web UI action as the victim; for a site administrator that includes the admin pages. Preconditions: an account (registration is off by default, so one the site has issued), one public repository (or any repository the victim can read) to host the file, and a host that serves the script to the victim's browser. No non-default setting is involved. The fetch and the insertion of the attacker's HTML are demonstrated; that a real browser then runs the external script follows from the page's script-src * policy (see Details) and was shown only in a DOM emulation that does not enforce the policy.
The popup has requested
NVD data is provided by NIST and is public domain. Posts quoted belong to their authors.