CVE-2026-28737: Gitea Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-9cpj-qc93-vw8v
CVSS 8.7
CWE-79
Published
Advisory Summary

CVE-2026-28737 is a HIGH (CVSS 8.7) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Gitea libraries in the Go ecosystem. The issue involves stored xss via gltf `extensionsrequired` in gitea 3d file viewer. Remediation is available by upgrading affected packages to version 1.26.0.

CVE-2026-28737 at a Glance

CVE Identifier CVE-2026-28737
GHSA Identifier GHSA-9cpj-qc93-vw8v
Severity HIGH
CVSS v3.1 Base Score 8.7
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Gitea
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-28737

To remediate this vulnerability, upgrade all affected Gitea dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

code.gitea.io/gitea fixed: 1.26.0
Upgrade code.gitea.io/gitea to 1.26.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for code.gitea.io/gitea

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-28737, inspect your project dependencies for Gitea:

inspect dependencies for code.gitea.io/gitea

Analyze the terminal output to locate any version of Gitea in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.26.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where 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. In Gitea, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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` (SHA `e33d1da...`), which bundles `online-3d-viewer` npm package v0.16.0 - The upstream [Online3DViewer](https://github.com/kovacsv/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: ```javascript // 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`: ```javascript // Gitea's error display handler element.innerHTML = errorMessage; // unsanitized ``` The extension names from `extensionsRequired` are taken directly from the JSON file with no escaping or sanitization, allowing HTML injection. ### Attack Vector 1. An attacker creates a `.gltf` file with a malicious `extensionsRequired` value: ```json { "asset": {"version": "2.0"}, "buffers": [], "extensionsRequired": ["<img src=x onerror=\"alert(document.cookie)\">"], "scenes": [] } ``` 2. The attacker pushes this file to any Gitea repository they have write access to (including forks of public repositories). 3. 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`. 4. 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/applications` with 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`, or `navigator.sendBeacon` ## Proof of Concept ### Minimal PoC (alert box) Save as `poc.gltf` and push to any Gitea 1.25+ repository: ```json { "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: ```javascript // 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>` with `sandbox="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

CVE-2026-28737 Affected Gitea Versions

1 component(s)
Fixed Versions:
1.26.0
Product / Package Ecosystem Affected Versions Fixed Version
code.gitea.io/gitea
Go
≥ 1.25.0
< 1.26.0
1.26.0

References

Frequently Asked Questions

What is CVE-2026-28737?
CVE-2026-28737 is a security vulnerability in Gitea involving Stored XSS via glTF `extensionsRequired` in Gitea 3D File Viewer under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Gitea versions are affected?
Affected versions include releases prior to 1.26.0 across affected packages: code.gitea.io/gitea.
What version fixes CVE-2026-28737?
Upgrading to 1.26.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is code.gitea.io/gitea affected?
Yes, code.gitea.io/gitea is affected in releases prior to 1.26.0. Upgrade your dependency to 1.26.0 or later.
What is the CVSS score of CVE-2026-28737?
CVE-2026-28737 has a CVSS v3.1 base score of 8.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2026-28737?
CVE-2026-28737 is classified under 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.).
How can I check Go dependencies for CVE-2026-28737?
Run the dependency tree command: 'inspect dependencies for code.gitea.io/gitea'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9cpj-qc93-vw8v",
  "modified" : "2026-06-17T18:10:19Z",
  "published" : "2026-06-17T18:10:19Z",
  "aliases" : [ "CVE-2026-28737" ],
  "summary" : "Gitea: Stored XSS via glTF `extensionsRequired` in Gitea 3D File Viewer",
  "details" : "## Summary\n\nMe again.\n\nGitea'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.\n\n## Affected Versions\n\n- Gitea **1.25.0** and later (3D file preview was introduced in 1.25 via the Online3DViewer integration)\n- Confirmed on `gitea:1.25-nightly` (SHA `e33d1da...`), which bundles `online-3d-viewer` npm package v0.16.0\n- The upstream [Online3DViewer](https://github.com/kovacsv/Online3DViewer) library is the root cause\n\n## Severity\n\n- Stored XSS: the payload persists in the repository and fires on every page view\n- Executes under the Gitea origin with the victim's session (cookies, CSRF tokens)\n- Any authenticated user viewing the file is compromised\n- Enables full account takeover (token creation, settings modification, repository manipulation)\n- No user interaction beyond viewing the file page is required\n\n## Details\n\n### Root Cause\n\nWhen Online3DViewer parses a glTF file, it checks whether all `extensionsRequired` entries are supported. For unsupported extensions, it calls:\n\n```javascript\n// In the Online3DViewer bundle (online-3d-viewer.js)\n// Approximate offset 1142618 in the bundled chunk\nthis.SetError(yp(\"Unsupported extension: {0}.\", unsupportedExtensions.join(\", \")));\n```\n\nThe `SetError` method stores this message, and Gitea's rendering code inserts it into the page using `innerHTML`:\n\n```javascript\n// Gitea's error display handler\nelement.innerHTML = errorMessage;  // unsanitized\n```\n\nThe extension names from `extensionsRequired` are taken directly from the JSON file with no escaping or sanitization, allowing HTML injection.\n\n### Attack Vector\n\n1. An attacker creates a `.gltf` file with a malicious `extensionsRequired` value:\n\n```json\n{\n  \"asset\": {\"version\": \"2.0\"},\n  \"buffers\": [],\n  \"extensionsRequired\": [\"<img src=x onerror=\\\"alert(document.cookie)\\\">\"],\n  \"scenes\": []\n}\n```\n\n2. The attacker pushes this file to any Gitea repository they have write access to (including forks of public repositories).\n\n3. 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`.\n\n4. The injected `<img onerror>` handler executes arbitrary JavaScript under the Gitea origin with the victim's authenticated session.\n\n### Impact\n\nFrom the XSS context, an attacker can:\n\n- **Create API access tokens** for the victim by POSTing to `/user/settings/applications` with the page's CSRF token\n- **Read private repositories** via same-origin API calls\n- **Modify repository contents** (supply chain attacks)\n- **Escalate to admin** if the victim is a Gitea administrator\n- **Exfiltrate data** via `fetch`, `XMLHttpRequest`, or `navigator.sendBeacon`\n\n## Proof of Concept\n\n### Minimal PoC (alert box)\n\nSave as `poc.gltf` and push to any Gitea 1.25+ repository:\n\n```json\n{\n  \"asset\": {\"version\": \"2.0\"},\n  \"buffers\": [],\n  \"extensionsRequired\": [\"<img src=x onerror=\\\"alert('XSS: '+document.domain)\\\">\"],\n  \"scenes\": []\n}\n```\n\nNavigate to the file in the Gitea web UI. The alert will fire.\n\n\n## Suggested Fixes\n\nSanitize or text-encode the error message before DOM insertion. Replace `innerHTML` with `textContent` for error display:\n\n```javascript\n// Instead of:\nelement.innerHTML = errorMessage;\n\n// Use:\nelement.textContent = errorMessage;\n```\n\nAlternatively, escape HTML entities in the error message before insertion.\n\n### Additional hardening\n\n- Render 3D file previews inside a sandboxed `<iframe>` with `sandbox=\"allow-scripts\"` and a restrictive CSP (`default-src 'none'`), similar to how Gitea already handles SVG attachments\n- Apply Content-Security-Policy headers to file preview pages that restrict inline script execution",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "code.gitea.io/gitea"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.25.0"
      }, {
        "fixed" : "1.26.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/go-gitea/gitea/security/advisories/GHSA-9cpj-qc93-vw8v"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/go-gitea/gitea"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-17T18:10:19Z",
    "nvd_published_at" : null
  }
}