Summary
Gitea versions from 1.25.0 before 1.26.0 contain a stored cross-site scripting vulnerability in the 3D file viewer when rendering glTF files.
Malicious content in the extensionsRequired field can be executed in a visitor's browser, making repository browsing risky when untrusted glTF assets are present.
Affected context
This vulnerability appears in Gitea instances that use the built-in 3D file viewer to render glTF assets directly in the web interface.
It becomes relevant when users can upload or push glTF files containing crafted data in the extensionsRequired field, and other users or administrators later view these files through the Gitea UI.
Multi-user environments with shared repositories, public projects, or integrations that automatically render 3D assets are most exposed to the risk of stored script execution.
Exploit preconditions
- Attack surface: Gitea web interface, specifically the 3D file viewer for glTF files.
- Required access: Ability to push or upload glTF files into a repository that is later viewed via the browser (e.g., valid user account or compromised pipeline).
- Trigger point: A victim navigates to a repository page where the vulnerable 3D viewer renders a crafted glTF file containing malicious data in
extensionsRequired. - Why exploitation is possible: The 3D viewer mishandles glTF metadata, allowing untrusted data from
extensionsRequiredto be interpreted in a way that leads to script injection without proper sanitization or encoding.
Why this happens
The issue stems from insufficient validation and output encoding of glTF metadata fields before they are incorporated into the DOM or client-side rendering logic.
Data from the extensionsRequired field, which should be treated as plain, inert configuration metadata, is instead processed in a manner that allows embedded script-like content to influence the rendered page.
This maps to CWE-79: Improper Neutralization of Input During Web Page Generation, where untrusted input is not correctly sanitized or escaped before being used in a web context.
Potential impact
- Attackers may execute arbitrary JavaScript in the context of the Gitea domain.
- Malicious scripts could steal session cookies or tokens associated with the Gitea instance.
- User accounts can be targeted with phishing overlays or deceptive UI modifications.
- Repository integrity and project workflows may be impacted through unauthorized actions performed via the victim's browser.
- The vulnerability could be chained with other issues to escalate access or pivot into more sensitive areas of the environment.
General mitigation guidance
Effective mitigation focuses on treating all glTF metadata as untrusted input and ensuring it cannot directly influence script execution.
Common defensive patterns include:
- Applying strict HTML and JavaScript output encoding to any data surfaced from glTF files before inserting it into the DOM.
- Enforcing rigorous input validation on glTF fields, rejecting or stripping unexpected content and limiting allowed characters or structures in
extensionsRequired. - Isolating 3D rendering logic within sandboxed contexts (such as safe iframes or dedicated viewer components that never interpret metadata as code).
- Adhering to least-privilege principles for client-side features, avoiding unnecessary dynamic script generation or evaluation in the viewer.
- Integrating security reviews for custom file viewers and renderers to ensure they conform to secure-by-default patterns.
How teams detect issues like this
Organizations can identify similar vulnerabilities by:
- Using static analysis rules and linters that flag dynamic DOM insertion, string-based JavaScript construction, or unsanitized template variables within viewer components.
- Conducting focused code reviews for file rendering pipelines, paying attention to how metadata and content from uploaded artifacts are passed into front-end code.
- Applying security testing frameworks that simulate XSS payloads in structured file formats (such as glTF) and verify whether the UI safely handles them.
- Enforcing security policies that require encoding libraries and centralized sanitization utilities for any user-controlled data rendered in the web interface.

