Summary
A SQL Injection vulnerability in Apache Fineract's report execution API allows crafted report parameters to be embedded directly into dynamically generated SQL queries without adequate validation.
An authenticated user with permission to run reports can abuse this behavior to inject arbitrary SQL, potentially accessing or manipulating data beyond the scope of the intended report.
Affected context
The vulnerability occurs in Apache Fineract deployments that expose the report execution (runreports) API and rely on dynamic SQL generation based on user-provided report parameters.
It is relevant where:
- Report definitions are translated into SQL at runtime
- User-supplied parameter values are concatenated or interpolated into SQL strings
- The system trusts authenticated report runners without enforcing strict parameter validation or binding
Exploit preconditions
- Attack surface: HTTP-based Report Execution API (
runreportsendpoint) - Required access: Authenticated access with permissions to execute reports
- Trigger point: Submission of specially crafted parameter values in report requests
- Why exploitation is possible: Parameters are incorporated into SQL without robust validation or parameterized binding, allowing attacker-controlled input to alter the structure and behavior of the resulting query
Why this happens
The root cause aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
In the affected report execution flow, user-supplied parameter values are treated as trusted input and embedded directly into SQL statements, often via string concatenation or unescaped interpolation.
Without proper neutralization or the use of prepared statements with bound parameters, the database interprets parts of the user input as executable SQL syntax, enabling attackers to extend or modify queries beyond their intended structure.
Potential impact
- Unauthorized access to sensitive data outside of the designed report scope
- Reading records from tables not normally exposed through the reporting interface
- Manipulation or deletion of data if write-capable SQL statements can be injected
- Bypassing business logic or multi-tenant isolation enforced at the application layer
- Discovery of schema details that can facilitate further attacks
General mitigation guidance
Effective mitigation for SQL Injection focuses on eliminating direct concatenation of user input into SQL and narrowing trust boundaries around report parameters.
Recommended secure patterns include:
- Using parameterized queries or prepared statements for all report-related SQL, binding parameters rather than interpolating them into query strings
- Applying strict server-side validation and type enforcement for report parameters (e.g., numeric ranges, enumerated values, and structured filters)
- Designing report definitions so that end users select from predefined filters rather than composing free-form SQL fragments
- Implementing least-privilege database accounts for report execution, restricting accessible tables and operations to the minimal necessary subset
- Centralizing query-building logic to enforce consistent sanitization and access control policies across all reports
How teams detect issues like this
Organizations can detect and manage SQL Injection risks in reporting APIs through:
- Static analysis rules that flag dynamic SQL construction involving user-controlled input (e.g., string concatenation, unescaped interpolation)
- Code reviews focused on report generation paths, ensuring use of parameterized queries and clear separation between SQL templates and user data
- Security testing that probes report parameters with injection patterns to identify unsafe query behavior, including error-based and time-based probes
- Logging and monitoring of unusual report queries (e.g., unexpected table access, abnormal query complexity) to spot potential abuse
- Policy enforcement in CI/CD pipelines requiring secure database access patterns and rejecting changes that introduce unparameterized SQL

