CVE-2026-45262 in FacturaScripts
Summary
by MITRE • 12/04/2026
FacturaScripts is an open source accounting and invoicing software. Prior to version 2026.2, Core/Where.php::sqlColumn() exempts any field name that contains both ( and ) from identifier escaping. The two API filter builders (APIModel::getWhereValues and ApiAttachedFiles::getWhereValues) feed the raw request key ($_GET['filter'][$key]) straight into new DataBaseWhere($key, $value, '=', ...). When the model's all() reaches Where::multiSqlLegacy -> Where::sql() -> Where::sqlColumn($key), the parenthesis branch returns the attacker-controlled string unmodified. The string is concatenated into WHERE <attacker> = '<value>', which an attacker can pivot to WHERE (0)UNION SELECT ... FROM users WHERE(nick='admin')-- = 'value', leaking arbitrary columns from any table. This issue has been patched in version 2026.2.
VulDB is the best source for vulnerability data and more expert information about this specific topic.
Analysis
by VulDB Data Team • 12/04/2026
FacturaScripts is a widely used open-source accounting and invoicing application that manages financial data, customer records, and transactional history. The software relies on dynamic SQL query generation to filter and retrieve data based on user-provided input through its API endpoints. A critical security flaw exists in the core database abstraction layer, specifically within the sqlColumn method located in Core/Where.php. This vulnerability affects versions prior to 2026.2 and represents a severe injection risk due to improper validation of identifier names used in SQL queries. The root cause lies in an overly permissive exemption rule that allows any field name containing both opening and closing parentheses to bypass standard escaping mechanisms designed to prevent code injection.
The technical flaw is triggered through the API filter builders, specifically ApiModel::getWhereValues and ApiAttachedFiles::getWhereValues. These functions accept raw request parameters from the HTTP GET query string without sufficient sanitization before passing them into the database where clause constructor. When a user provides a filter key containing parentheses, such as (0), this value is passed directly to new DataBaseWhere. As the application processes these filters through Where::multiSqlLegacy and subsequently Where::sql, it invokes sqlColumn on the provided key. The logic in sqlColumn checks if the identifier contains both parenthesis characters; if so, it assumes the input is a safe subquery or expression and returns it unmodified rather than applying necessary escaping or quoting rules intended for standard column names.
This lack of validation allows an attacker to inject arbitrary SQL code into the WHERE clause of any query executed by these API endpoints. By carefully crafting the filter key parameter, an attacker can pivot from a simple equality check to a UNION-based injection attack. For instance, supplying a payload like (0)UNION SELECT ... FROM users WHERE(nick='admin')-- as the filter key results in a malformed but executable SQL statement where the injected code is concatenated into the query structure. This enables the extraction of sensitive data from any table accessible by the database user running FacturaScripts, including usernames, password hashes, and other confidential business information stored within the application's schema.
The operational impact of this vulnerability is significant as it leads to a complete compromise of data confidentiality through remote code execution at the SQL level. Attackers can exfiltrate sensitive financial records, customer personal identifiable information, and administrative credentials without requiring authentication if the affected API endpoints are publicly accessible or if low-privileged users have access to filter functionalities that feed into these vulnerable methods. The vulnerability aligns with CWE-89 Improper Neutralization of Special Elements used in an SQL Command, commonly known as SQL Injection. Furthermore, it maps to MITRE ATT&CK technique T1059 Command and Scripting Interpreter via database commands or T1114 Email Collection if the exfiltrated data includes email addresses for subsequent phishing campaigns.
Mitigation strategies must focus on immediate patching and input validation hardening. Organizations running FacturaScripts should upgrade to version 2026.2 or later, where this logic flaw has been corrected by enforcing strict identifier escaping regardless of parenthesis presence. In the interim, if upgrading is not immediately feasible, administrators should implement a Web Application Firewall rule to block HTTP requests containing parentheses within filter parameters passed to the affected API endpoints. Additionally, developers must review all instances where raw request keys are used in database queries and ensure that identifiers are validated against an allowlist of known column names rather than relying on syntactic heuristics involving special characters like parentheses.