Gitea
CVE-2026-28737
HIGH
Severity by source
AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N
Network-reachable web UI (AV:N/AC:L); attacker needs a push-capable account, easily met by forking (PR:L); victim must open the preview (UI:R); XSS crosses into victim session (S:C) yielding full account takeover (C:H/I:H, A:N).
Primary rating from GitHub Advisory.
CVSS VectorGitHub Advisory
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N
Lifecycle Timeline
2DescriptionGitHub Advisory
Summary
Me again.
Gitea's built-in 3D file viewer (powered by Online3DViewer) is vulnerable to stored cross-site scripting (XSS) through crafted .gltf files. When a glTF file declares an unsupported required extension, Online3DViewer generates an error message containing the extension name and Gitea inserts it into the DOM using innerHTML without sanitization. An attacker who can push a .gltf file to any repository can execute arbitrary JavaScript in the context of any user who views the file.
Affected Versions
- Gitea 1.25.0 and later (3D file preview was introduced in 1.25 via the Online3DViewer integration)
- Confirmed on
gitea:1.25-nightly(SHAe33d1da...), which bundlesonline-3d-viewernpm package v0.16.0 - The upstream Online3DViewer library is the root cause
Severity
- Stored XSS: the payload persists in the repository and fires on every page view
- Executes under the Gitea origin with the victim's session (cookies, CSRF tokens)
- Any authenticated user viewing the file is compromised
- Enables full account takeover (token creation, settings modification, repository manipulation)
- No user interaction beyond viewing the file page is required
Details
Root Cause
When Online3DViewer parses a glTF file, it checks whether all extensionsRequired entries are supported. For unsupported extensions, it calls:
// In the Online3DViewer bundle (online-3d-viewer.js)
// Approximate offset 1142618 in the bundled chunk
this.SetError(yp("Unsupported extension: {0}.", unsupportedExtensions.join(", ")));The SetError method stores this message, and Gitea's rendering code inserts it into the page using innerHTML:
// Gitea's error display handler
element.innerHTML = errorMessage; // unsanitizedThe extension names from extensionsRequired are taken directly from the JSON file with no escaping or sanitization, allowing HTML injection.
Attack Vector
- An attacker creates a
.gltffile with a maliciousextensionsRequiredvalue:
{
"asset": {"version": "2.0"},
"buffers": [],
"extensionsRequired": ["<img src=x onerror=\"alert(document.cookie)\">"],
"scenes": []
}- The attacker pushes this file to any Gitea repository they have write access to (including forks of public repositories).
- When any user navigates to the file's page in the Gitea web UI, the 3D viewer attempts to render it, encounters the "unsupported extension," and inserts the error message (containing the attacker's HTML) into the DOM via
innerHTML. - The injected
<img onerror>handler executes arbitrary JavaScript under the Gitea origin with the victim's authenticated session.
Impact
From the XSS context, an attacker can:
- Create API access tokens for the victim by POSTing to
/user/settings/applicationswith the page's CSRF token - Read private repositories via same-origin API calls
- Modify repository contents (supply chain attacks)
- Escalate to admin if the victim is a Gitea administrator
- Exfiltrate data via
fetch,XMLHttpRequest, ornavigator.sendBeacon
Proof of Concept
Minimal PoC (alert box)
Save as poc.gltf and push to any Gitea 1.25+ repository:
{
"asset": {"version": "2.0"},
"buffers": [],
"extensionsRequired": ["<img src=x onerror=\"alert('XSS: '+document.domain)\">"],
"scenes": []
}Navigate to the file in the Gitea web UI. The alert will fire.
Suggested Fixes
Sanitize or text-encode the error message before DOM insertion. Replace innerHTML with textContent for error display:
// Instead of:
element.innerHTML = errorMessage;
// Use:
element.textContent = errorMessage;Alternatively, escape HTML entities in the error message before insertion.
Additional hardening
- Render 3D file previews inside a sandboxed
<iframe>withsandbox="allow-scripts"and a restrictive CSP (default-src 'none'), similar to how Gitea already handles SVG attachments - Apply Content-Security-Policy headers to file preview pages that restrict inline script execution
Articles & Coverage 1
AnalysisAI
Stored cross-site scripting in Gitea 1.25.x affects the built-in 3D file viewer (Online3DViewer integration) where a crafted .gltf file with an unsupported extension name in extensionsRequired is rendered into the DOM via innerHTML without sanitization. Any low-privileged user who can push a file to a repository (including a public fork) can compromise the session of any user who later views the file, enabling token theft and full account takeover. …
Unlock full vulnerability intelligence
- Risk assessment & exploitation conditions
- Attack chain visualization
- Remediation with exact patch versions
- Threat intelligence from 22 sources
- Personal watchlist & email alerts
Free forever · No credit card required
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata
Vulnerability AssessmentAI
| Exploitation | Target instance must be running Gitea 1.25.0 through 1.25.x with the default Online3DViewer-backed 3D file preview enabled. … Additional conditions and limiting factors are described in the full assessment. |
| Risk Assessment | The vendor CVSS 3.1 vector AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N (8.7 High) is well-aligned with the facts: exploitation is over the network, requires only an account that can push a file (PR:L - satisfied by forking any public repo), needs a victim to load the file page (UI:R), and crosses scope into the victim's browser/session (S:C) producing high confidentiality and integrity impact. … Full risk analysis with EPSS, KEV, and SSVC signal comparison available after sign-in. |
| Exploit Scenario | An attacker registers (or uses an existing low-privilege account), forks any public repository on the target Gitea 1.25.x instance, and commits a poc.gltf whose extensionsRequired array contains '<img src=x onerror="...">'. They then send a maintainer or admin a link to the file (for example as part of a pull request review) and when the victim opens the preview page the 3D viewer reports the unsupported extension, Gitea writes the attacker's HTML into the DOM, and the onerror handler runs in the Gitea origin to mint an API token via /user/settings/applications, exfiltrate it, and take over the account. … |
| Remediation | Vendor-released patch: upgrade Gitea to 1.26.0 or later, which is the fixed version called out in GHSA-9cpj-qc93-vw8v (https://github.com/go-gitea/gitea/security/advisories/GHSA-9cpj-qc93-vw8v). … Detailed patch versions, workarounds, and compensating controls in full report. |
Recommended ActionAI
Within 24 hours: disable the Online3DViewer integration in Gitea configuration and audit recent .gltf file uploads for suspicious content. …
Sign in for detailed remediation steps and compensating controls.
Threat intelligence, references, and detailed analysis are available after sign-in.
More from same product – last 7 days
Authorization bypass in Gitea versions up to and including 1.26.1 allows any authenticated user with mere read access to
OAuth2 scope enforcement bypass in Gitea <= 1.26.1 allows any OAuth2 access token to perform write actions far beyond it
Authorization scope bypass in Gitea v1.26.1 and earlier allows authenticated users to use OAuth2/PAT Bearer tokens to pe
Authorization bypass in Gitea versions 1.22.3 through 1.26.1 allows holders of `public-only` access tokens or OAuth gran
Authorization bypass in Gitea versions prior to 1.26.0 lets a read-only organization member create repositories in the o
Share
External POC / Exploit Code
Leaving vuln.today
GHSA-9cpj-qc93-vw8v