Summary
FACTION suffers from a stored cross-site scripting (XSS) vulnerability where attachment filenames are persisted and later rendered into HTML and attribute contexts without proper output encoding.
An attacker who can upload or otherwise control an attachment filename can inject JavaScript that executes in the browsers of other users viewing the assessment file preview, including potentially privileged users.
Affected context
This vulnerability occurs in FACTION's assessment file preview functionality, where user-supplied attachment filenames are stored on the server and later embedded into the web UI.
The issue is present when filenames are injected into HTML or attribute contexts without context-aware escaping, and when users with access to the affected assessments view the preview page in their browser.
Any deployment where untrusted or semi-trusted users can upload files or influence filenames may be exposed, especially in shared, multi-user environments.
Exploit preconditions
- Attack surface: Web interface for uploading or managing assessment attachments.
- Required access: Ability to upload or otherwise set attachment filenames (e.g., authenticated user with report or file management rights).
- Trigger point: Viewing the assessment file preview page or any UI component that renders the stored filename into HTML or attribute contexts.
- Why exploitation is possible: The application takes persisted filename values and injects them directly into the DOM without applying the appropriate output encoding for the specific HTML/attribute context, allowing attacker-controlled scripts to run.
Why this happens
The underlying bug is a classic stored cross-site scripting issue, categorized as CWE-79: Improper Neutralization of Input During Web Page Generation.
FACTION stores user-controlled attachment filenames and later renders them into HTML or attribute contexts without applying the correct context-aware output encoding.
Because the data is treated as trusted and inserted directly into the page, browsers interpret parts of the filename as executable script or event handlers, leading to arbitrary JavaScript execution.
The problem stems from mixing untrusted presentation-layer data with the page template without a consistent encoding strategy, rather than from the upload mechanism itself.
Potential impact
- Attackers may execute arbitrary JavaScript in the context of the FACTION application for any user viewing the affected page.
- Malicious scripts could steal session cookies or authentication tokens, potentially leading to account takeover.
- Privileged users (e.g., administrators or project owners) may have their accounts compromised, enabling broader system manipulation.
- Attackers could perform unauthorized actions on behalf of victims (e.g., modifying reports, changing permissions, or exfiltrating sensitive findings).
- Persistent injected content can be used to deface parts of the UI or mislead users into divulging credentials or sensitive data.
General mitigation guidance
Effective mitigation focuses on enforcing strict output encoding and context separation for all user-controlled data rendered into web pages.
Recommended defensive patterns include:
- Applying context-aware output encoding for filenames before inserting them into HTML, attribute, JavaScript, or URL contexts, ensuring that special characters are neutralized.
- Treating all stored user input as untrusted at render time and avoiding direct concatenation into templates.
- Centralizing templating and encoding responsibilities in the view or rendering layer instead of duplicating ad-hoc HTML generation.
- Restricting permissible filename characters server-side where feasible (e.g., disallowing control characters or HTML-significant characters) while still respecting usability needs.
- Implementing a Content Security Policy (CSP) that discourages inline scripts and reduces the impact of potential XSS flaws, while not treating CSP as a substitute for proper encoding.
How teams detect issues like this
Detection efforts can focus on both preventive analysis and runtime observation:
- Static analysis: Configure rules to flag unencoded insertion of user-controlled variables (such as filenames) into HTML templates and attributes, particularly in views related to file previews or report attachments.
- Code review: During manual review, trace the lifecycle of user inputs from upload or form submission through persistence to template rendering, verifying that encoding is applied close to the sink.
- Template linting: Enforce template-level policies requiring use of safe helpers or escaping functions for all output, and prohibit raw HTML insertion in view logic.
- Security testing: Use automated and manual XSS testing tools to probe filename fields, observing whether payloads reappear in rendered pages; integrate these checks into CI pipelines.
- Logging and monitoring: Monitor for unusual patterns in filenames or HTML structures, such as strings containing script tags or event handler attributes, which may indicate exploitation attempts.

