Summary
FacturaScripts versions 2025.71 and earlier contain a stored Cross-Site Scripting (XSS) vulnerability in the Observations field rendered in the History view.
Malicious input saved into this field is later displayed without proper HTML entity encoding, allowing arbitrary JavaScript execution in the browser of administrators viewing the history.
Affected context
The vulnerability appears in the History view of FacturaScripts when it renders previously stored values from the Observations field.
The risk is present when user-controlled or externally sourced text can be stored in Observations and later viewed by privileged users such as administrators.
It specifically affects contexts where this stored content is inserted into HTML without appropriate output encoding or sanitization.
Exploit preconditions
- Attack surface: Web application History view in FacturaScripts.
- Required access: Ability to create or modify records that include the Observations field (e.g., as a logged-in user or any workflow that persists user-provided text).
- Trigger point: An administrator or other user with access opens the History view that displays the stored Observations content.
- Why exploitation is possible: The application outputs stored Observations data directly into the HTML response without proper context-aware encoding, allowing embedded script content to be interpreted by the browser.
Why this happens
This issue stems from unescaped, user-controlled data being rendered into an HTML page, mapping directly to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting).
The History view uses stored Observations values without applying context-appropriate output encoding (such as HTML entity encoding for text nodes or attribute encoding for attributes).
Because the rendering logic treats stored text as safe, any previously injected HTML/JavaScript payload becomes part of the page structure and is executed by the browser when an administrator views the history.
Potential impact
- Attacker-controlled JavaScript may run in the administrator's browser.
- Session data associated with the FacturaScripts instance could be accessed or exfiltrated by injected scripts, depending on cookie and storage configuration.
- Administrative actions might be performed on behalf of the victim (e.g., changing settings, modifying records, creating new users) via forged requests.
- Malicious content or phishing interfaces could be presented within the trusted application UI.
- Further compromise of connected systems is possible if administrative workflows are abused via the injected script.
General mitigation guidance
Long-term mitigation focuses on enforcing strict output encoding and treating all stored content as untrusted:
- Apply context-aware output encoding to all values rendered in the History view, especially for the Observations field (HTML entity encoding for text content; attribute or JavaScript encoding where appropriate).
- Implement a templating or view layer that performs escaping by default and requires explicit opt-out only in carefully reviewed cases.
- Consider normalizing or sanitizing rich text fields with a robust HTML sanitizer configured to allow only a minimal, safe subset of tags and attributes, if rich formatting is required.
- Review privilege and role boundaries so that untrusted users cannot inject content viewed by high-privilege administrators without going through additional validation.
- Follow a "default deny" approach for script-capable constructs (e.g., event handlers, inline JavaScript, dangerous URL schemes) in any user-visible fields.
How teams detect issues like this
Detection can rely on both code- and behavior-based approaches:
- Static analysis: Configure rules or linters to flag string concatenation into HTML templates, unescaped variable output in views, or bypasses of framework-provided escaping in FacturaScripts code.
- Code review: During manual review, pay attention to any rendering of database fields (like Observations) into the History view or similar pages where user-generated content appears, ensuring encoding functions are applied.
- Security testing: Use automated DAST tools or manual penetration testing with benign payloads to identify fields whose content is re-displayed and interpreted as HTML/JavaScript.
- Content monitoring: Implement application or WAF rules that detect obviously malicious patterns in stored content, such as
<script>tags, event handlers (e.g.,onload,onclick), orjavascript:URLs, while recognizing that not all XSS payloads are so obvious.

