/

CVE-2026-40522

Severity:

HIGH RISK

(7.1)

SQL Injection (CWE-89) in FrontAccounting Bank Reports

CVE-2026-40522

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89, CWE-916

Impact:

Sensitive Data Exposure via SQL Injection

Severity:

HIGH RISK

(7.1)

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

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_0 parameter containing UNION SELECT and other SQL syntax.
  • Why exploitation is possible: The application builds SQL statements by directly concatenating PARAM_0 into 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 users table.
  • 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 users from report-related queries, combined with alerting policies.

Sources

SourceLink
github.comgithub.com/FrontAccountingERP/FA/commit/894adaf71393e0ef6a04fe6036fcd2464050f590
jivasecurity.comjivasecurity.com/writeups/frontaccounting-sqli-bank-statement-report-cve-2026-40522
sourceforge.netsourceforge.net/p/frontaccounting/news/2026/04/release-2420/
vulncheck.comvulncheck.com/advisories/frontaccounting-sql-injection-via-rep601-php

Frequently asked

questions

No, exploitation requires a valid authenticated account with access to the Bank Statement report functionality. However, even low-privileged accounts may be sufficient if they can trigger the vulnerable report.

The attacker needs application-level authenticated access to the reporting endpoint that consumes the PARAM_0 POST parameter. Direct database access is not required; the injection is performed through standard HTTP requests.

The most robust fix is to replace all dynamically constructed SQL queries with prepared statements or ORM abstractions, binding user input strictly as data. In parallel, constrain report parameters to validated, well-typed values and remove any ability for users to influence raw SQL fragments.

Adopt a secure query-building architecture that prohibits inline SQL concatenation, establish coding standards mandating parameterized queries, and incorporate security review checkpoints for all new reporting endpoints. Combining these with automated static analysis and regular penetration testing helps catch injection risks early in the development lifecycle.

Find out what's already
exploitable in your codebase.