/

CVE-2026-23997

Severity:

HIGH RISK

(8.0)

Stored XSS in FacturaScripts History Observations Field

CVE-2026-23997

Analyzed

Vulnerability type

Category:

Stored Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Arbitrary JavaScript Execution in Administrator Browsers

Severity:

HIGH RISK

(8.0)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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), or javascript: URLs, while recognizing that not all XSS payloads are so obvious.

Sources

SourceLink
github.comgithub.com/NeoRazorX/facturascripts/security/advisories/GHSA-4v7v-7v7r-3r5h

Frequently asked

questions

This vulnerability is broadly exploitable wherever users can supply or influence the Observations field which is later rendered in the History view. Any user capable of saving such data can potentially attack administrators or other privileged users who view the affected history entries.

No. The attacker typically only needs the ability to create or modify records that populate the Observations field. The attack becomes impactful when a higher-privileged user, such as an administrator, subsequently views the History page containing the stored payload.

The safest pattern is to enforce context-aware output encoding on all user-controlled data at render time, ideally using framework-level escaping that is enabled by default. When rich HTML is unavoidable, pair encoding with a conservative, well-maintained HTML sanitizer to strip scripts and unsafe attributes.

To prevent similar issues, adopt an output-encoding-first mindset, use templating engines that escape by default, and establish coding standards that prohibit rendering raw user input. Complement these practices with automated static analysis rules, code review checklists focusing on rendering paths, and periodic security testing of user-editable fields that are later displayed to privileged users.

Find out what's already
exploitable in your codebase.