Summary
FrontAccounting before version 2.4.20 contains a SQL injection flaw in the Bank Statement report handler, where user-controlled POST data is concatenated into an unparameterized WHERE clause.
An authenticated attacker can inject UNION SELECT payloads into the PARAM_0 parameter to extract arbitrary database data, including usernames, password hashes, and email addresses, which are then rendered into the PDF report output.
Affected context
This vulnerability exists in FrontAccounting deployments that expose the Bank Statement reporting functionality to authenticated users.
It arises when the report handler constructs dynamic SQL queries by directly embedding POST parameters, particularly PARAM_0, into the WHERE clause without parameterization or sufficient input validation.
The issue is most pronounced in environments where reporting features pull from sensitive tables such as the users table and render query results into downloadable document formats like PDFs.
Exploit preconditions
- Attack surface: HTTP POST endpoint handling the Bank Statement report generation.
- Required access: Valid authenticated account with permission to access the Bank Statement reporting feature.
- Trigger point: Submission of crafted POST data in the
PARAM_0parameter containing UNION SELECT and other SQL syntax. - Why exploitation is possible: The application builds SQL statements by directly concatenating
PARAM_0into the WHERE clause without using prepared statements, parameter binding, or robust server-side validation, allowing execution of attacker-controlled SQL fragments.
Why this happens
The core issue maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
The Bank Statement report handler forms SQL queries by interpolating user input (PARAM_0) into an unparameterized WHERE clause, treating the input as trusted SQL syntax instead of data.
This unsafe pattern of dynamically constructing SQL strings without prepared statements or strict whitelisting enables attackers to introduce UNION SELECT and other constructs, pivoting the query to arbitrary tables such as users.
The presence of sensitive data in the reporting query path amplifies the impact, and the absence of output filtering leads to direct leakage through the generated PDF.
Potential impact
- Attackers may extract usernames, password hashes, and email addresses from the
userstable. - Attackers could access other business-critical or financial records stored in the database.
- Compromised password hashes can facilitate offline cracking and account takeover.
- Disclosure of customer or employee information could lead to privacy violations and regulatory exposure.
- Knowledge of internal schema and data may assist in further attacks against the application or infrastructure.
General mitigation guidance
Effective mitigation focuses on eliminating direct string concatenation of user input in SQL and reducing the trust placed in report parameters.
Common defensive patterns include:
- Refactoring report queries to use prepared statements with bound parameters for all user-supplied values.
- Enforcing strict validation and whitelisting on report filters, limiting input to expected formats (e.g., dates, numeric IDs, enumerated codes).
- Designing reporting interfaces so that users select from predefined options rather than entering free-form SQL-like filters.
- Restricting the inclusion of highly sensitive tables (such as
users) in generic reporting queries unless strictly necessary, and segregating access to sensitive data. - Applying least-privilege database accounts for reporting components, granting only read access to the minimum necessary tables and columns to reduce impact if a query is abused.
How teams detect issues like this
Organizations can detect this class of vulnerability through several complementary approaches:
- Static analysis rules that flag dynamic SQL construction using string concatenation or interpolation with HTTP request parameters, especially in reporting modules.
- Targeted code reviews focusing on query-building logic for PDF and other document-generating endpoints, looking for unparameterized WHERE clauses and unchecked user input.
- Security testing and fuzzing of report handlers with automated tools to identify injection points via UNION SELECT and other SQL constructs.
- Centralized logging and monitoring of unusual query patterns, such as unexpected UNIONs or access to tables like
usersfrom report-related queries, combined with alerting policies.

