Summary
FileBrowser Quantum contained a stored cross-site scripting (XSS) vulnerability in the metadata fields of shared links, such as the share title and description.
When a victim visited a publicly shared URL, unescaped metadata was rendered into HTML, allowing injected JavaScript to execute in the victim's browser and potentially compromise their session or data.
Affected context
This vulnerability appears in the public share feature of FileBrowser Quantum, specifically for URLs under /public/share/<hash>.
It is relevant when:
- Users can create or modify share links and supply metadata (e.g., title, description, or similar fields).
- Those metadata values are persisted on the server and later rendered into HTML for other users without context-aware escaping.
- The application uses Go's
text/templatepackage instead ofhtml/templateto render the share page, causing user-controlled content to be injected into the DOM as raw HTML.
Any environment exposing publicly accessible or internally shared file links may be affected if these conditions hold.
Exploit preconditions
- Attack surface: Public or internal share pages served at
/public/share/<hash>. - Required access: Ability to create or edit a share and control its metadata fields (e.g., title, description). This typically requires an authenticated FileBrowser Quantum account or any workflow that lets an attacker influence share metadata.
- Victim interaction: A victim must visit the crafted share URL in a browser for the injected script to execute.
- Trigger point: Page rendering of the share metadata into HTML using
text/templatewithout HTML or JavaScript context-aware escaping. - Why exploitation is possible: User-controlled fields are inserted directly into the HTML response, and
text/templatedoes not automatically escape content for HTML contexts, enabling arbitrary HTML/JS injection (CWE-79).
Why this happens
The underlying flaw is improper output encoding when rendering user-controlled content into a web page.
Instead of using a context-aware templating engine that automatically escapes HTML, the application employs Go's text/template package, which is not designed for HTML output and therefore does not escape characters such as <, >, " and '.
As a result, share metadata fields like titles and descriptions are treated as trusted HTML and placed directly into the document structure.
This aligns with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting), where untrusted input is introduced into a web page without appropriate encoding for its output context.
Potential impact
- Execution of arbitrary JavaScript in the victim's browser when they visit a malicious share link.
- Theft of cookies or other browser-accessible session data, depending on cookie flags and application design.
- Unauthorized actions performed on behalf of the victim within the FileBrowser Quantum application (session riding within the same origin).
- Injection of deceptive UI elements to phish credentials or trick users into performing sensitive actions.
- Lateral movement within an internal network if administrators or privileged users are tricked into opening malicious share links.
General mitigation guidance
Effective mitigation focuses on enforcing strict output encoding for any user-controlled content rendered into HTML:
- Prefer HTML-aware templating systems (e.g., Go's
html/template) that automatically escape data for HTML, attribute, and URL contexts. - Ensure all user-supplied metadata fields are treated as plain text and encoded according to their output context (HTML body, attribute, URL, JavaScript string, etc.).
- Centralize template rendering helpers so that escaping rules are consistent and harder to bypass.
- Limit the ability to store or render raw HTML in metadata fields; if rich text is required, use a well-reviewed, whitelist-based sanitizer that strips active content such as
<script>, event handlers, andjavascript:URLs. - Apply the principle of least privilege in the browser by using CSP (Content Security Policy) to reduce the impact of any remaining XSS bugs (e.g., disallow inline scripts and restrict script sources).
How teams detect issues like this
High-level detection typically includes:
- Static analysis: Rules that flag direct inclusion of user-controlled variables into templates rendered with
text/templateor other non-escaping engines for HTML output. - Template review: Manual or automated checks for templates where variables are interpolated inside
<script>blocks, event handler attributes (e.g.,onclick), or other sensitive contexts without explicit escaping helpers. - Security testing: Automated dynamic scans configured to test share metadata fields for reflective and stored XSS by inserting markers and checking for unescaped reflections in the resulting HTML.
- Policy enforcement: Engineering guidelines that prohibit the use of generic text templating engines for HTML views, enforced by code review and possibly pre-commit hooks or CI checks.
- Runtime monitoring: Web server logs and application monitoring tuned to identify suspicious payload patterns in metadata fields (e.g.,
<script>,onerror=,javascript:), while accounting for false positives.

