CVE-2026-77529: FacturaScripts: Stored XSS via EmailSentHtml client-side regex sanitizer that admins can bypass to attack other admins
FacturaScripts is an open source accounting and invoicing software. Prior to version 2026.2, EditEmailSent::getHtmlAction returns the stored EmailSent::html value through Tools::fixHtml(), which reverses the Tools::noHtml HTML-entity escaping that EmailSent::test() applied at write time. The browser-side Tab/EmailSentHtml.html.twig then assigns data.html straight to html.innerHTML inside an open shadow DOM after running it through a hand-rolled regex sanitizer (limpiarJS) that strips <script>...</script> blocks and inline event handlers via four regex passes. The filter is overlapping, single-pass, and oblivious to nested or unclosed tags, alternative XSS sinks (javascript: URIs, <iframe srcdoc>, <style> import), or HTML entity tricks. Several payloads survive intact and execute because the shadow root inherits the parent document's origin and JavaScript privileges, giving the attacker the viewing admin's session, CSRF tokens, and any DOM data on the page. Storage of the payload is straightforward: EmailNotification::test() only sanitises name and subject, leaving body untouched, so an admin who can manage notification templates plants the payload once and every administrator who later opens an EmailSent row generated from that template fires it. This issue has been patched in version 2026.2.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 2026.2
Event History
Frequently Asked Questions
Who can exploit this issue, and who is at risk?
An administrator who can manage notification templates can store a malicious payload in a template body. Other administrators are at risk when they view the affected email HTML, because the payload executes with the viewing administrator's browser session and page privileges.
Is user interaction required for exploitation?
Yes. A targeted administrator must view the stored email HTML for the payload to execute. The attacker can plant the payload once, after which it can affect administrators who view it.
What access could malicious script obtain?
The script runs with the parent document's origin and JavaScript privileges despite being rendered in an open shadow DOM. It can access the viewing administrator's session, CSRF tokens, and DOM data available on the page.
Are notification template bodies protected by server-side sanitization?
No. EmailNotification::test() sanitizes the template name and subject, but leaves the body unchanged, allowing an administrator with template-management access to store malicious HTML.
What version resolves the issue?
The issue affects versions prior to 2026.2. Updating to version 2026.2 addresses the vulnerable handling described.