/

CVE-2026-28683

Severity:

HIGH RISK

(8.7)

Cross-Site Scripting (XSS) in Gokapi File Sharing Server

CVE-2026-28683

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Stored Cross-Site Scripting leading to session and data compromise within the web application context

Severity:

HIGH RISK

(8.7)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A stored cross-site scripting vulnerability in Gokapi allows malicious content embedded in uploaded SVG files to execute in visitors' browsers when accessed via hotlinks.

When an authenticated user uploads a crafted SVG and shares it through a hotlink, the embedded script may run in the context of the Gokapi web application, potentially impacting other users who open the link.

Affected context

The vulnerability occurs in Gokapi deployments that:

  • Allow authenticated users to upload SVG files
  • Serve these SVG files back to clients via direct hotlinks
  • Render or allow interpretation of SVG as active browser content without sanitization or appropriate content handling

The risk is most pronounced in environments where users routinely share links to uploaded files with others (e.g., internal teams or external recipients).

Exploit preconditions

  • Attack surface: Web interface / file delivery endpoint serving uploaded SVG files.
  • Required access: Authenticated user account with permission to upload files and generate hotlinks.
  • Trigger point: A victim user (or administrator) visits the malicious SVG's hotlink URL in a browser that interprets SVG content.
  • Why exploitation is possible: The application stores and serves user-supplied SVG content without robust sanitization or strict content-type handling, allowing embedded script or active content inside SVG to execute in the browser context associated with Gokapi.

Why this happens

This issue stems from insufficient neutralization of user-controlled content before it is rendered in a browser, aligning with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting).

SVG is both an image and a markup format capable of containing scriptable constructs and event handlers. Treating SVG uploads as passive files while serving them in a way that lets browsers process them as active content creates an XSS vector.

The abstract pattern is: untrusted, persistent user input (SVG markup) is stored and then delivered to other users' browsers without sanitization, transformation, or appropriate containment, enabling execution of attacker-controlled script.

Potential impact

  • Attacker-controlled scripts may execute in the victim's browser within the Gokapi application context.
  • Compromise of user session data (e.g., stealing cookies or tokens if accessible to script).
  • Unauthorized actions performed on behalf of the victim within Gokapi (e.g., file deletion, link creation, configuration changes depending on permissions).
  • Phishing or UI redressing attacks embedded directly in the served file content.
  • Pivoting to broader account or data compromise if Gokapi is integrated with other systems or identity providers.

General mitigation guidance

Effective mitigation usually combines content handling, sanitization, and privilege minimization patterns:

  • Treat SVG and other complex file formats as potentially active content; where possible, disallow SVG uploads when not strictly needed.
  • If SVG support is required, sanitize SVG content server-side using robust, allowlist-based sanitizers that strip scripting capabilities, external references, and event handlers.
  • Serve user-uploaded files from a distinct domain or subdomain without authentication cookies or sensitive headers (content isolation via separate origin).
  • Enforce correct Content-Type and Content-Disposition headers so that files are downloaded rather than directly rendered, where appropriate.
  • Apply strong Content Security Policy (CSP) to reduce the impact of any injected script that might still be rendered.
  • Ensure that user roles with file upload capability are restricted to those who genuinely need it, following least-privilege principles.

How teams detect issues like this

Detection strategies can focus on both code and runtime behavior:

  • Static analysis / code review:
  • Look for endpoints serving user-uploaded SVG or other markup-capable formats without sanitization.
  • Identify direct passthrough of file content from storage to HTTP responses without transformation or validation.
  • Review file type checks and upload validation logic to confirm SVG is either disallowed or handled via a controlled pipeline.
  • Security testing:
  • Perform manual and automated XSS tests on file uploads, especially SVG, HTML, and similar formats.
  • Use dynamic application security testing (DAST) tools configured to probe for stored XSS in file upload workflows.
  • Operational monitoring:
  • Monitor logs for unusual patterns in SVG uploads (e.g., presence of <script>, onload, xlink:href, or external URLs).
  • Use web application firewalls (WAF) with rulesets targeting XSS patterns in responses where feasible.

Automated code review and SAST tools can be configured with custom rules to flag any route that returns user-uploaded content without sanitization or origin isolation.

Sources

SourceLink
github.comgithub.com/Forceu/Gokapi/releases/tag/v2.2.3
github.comgithub.com/Forceu/Gokapi/security/advisories/GHSA-3c22-5j5m-4jq7

Frequently asked

questions

Yes, if the Gokapi instance is accessible over the network and an attacker can obtain an authenticated account, they can upload a malicious SVG and share the hotlink with other users, including over the internet.

Exploitation requires an authenticated user account with permission to upload files and generate hotlinks. No special administrative privileges are necessary beyond that capability.

The safest general fix is to either disallow SVG uploads entirely or handle SVG uploads with strict sanitization and isolation. Serving user-uploaded content from a separate, unprivileged origin and enforcing a strong Content Security Policy significantly reduces risk.

Adopt a systematic approach for user-generated content: classify file types as active or passive, sanitize or transform active formats, isolate file-serving origins from application origins, and enforce output encoding and CSP by default. Include file upload and rendering flows in regular security reviews and automated testing for XSS.

Find out what's already
exploitable in your codebase.