Summary
Pimcore's Custom Reports columnConfigAction endpoint allows user-controlled SQL fragments to flow into query construction without adequate validation.
An attacker with the reports_config permission can craft arbitrary SELECT and UNION queries, invoke dangerous database functions, and leverage error-based SQL injection to read or manipulate backend data across the Pimcore database.
Affected context
This vulnerability appears in Pimcore installations that use the Custom Reports Bundle and expose the columnConfigAction endpoint to users with the reports_config permission.
It manifests when report configurations permit direct inclusion of SQL snippets that are concatenated into query strings rather than being constrained to parameterized, pre-defined queries.
Environments where database accounts used by Pimcore have broad read or write privileges are more susceptible to impactful exploitation.
Exploit preconditions
- Attack surface: HTTP requests targeting the Custom Reports columnConfigAction endpoint.
- Required access: Valid Pimcore account with the
reports_configpermission or any role capable of defining or editing custom report SQL configuration. - Trigger point: Submission or modification of report configurations that include crafted SQL segments, which flow through
CustomReportController::columnConfigAction,SqlAdapter::getColumns,SqlAdapter::buildQueryString, andDb::fetchAssociative(). - Why exploitation is possible: User-controlled SQL strings are incorporated directly into the query without robust parameterization or syntactic restrictions, enabling arbitrary SELECT, UNION operations, function calls, and error-based SQL injection.
Why this happens
The underlying bug class is classic SQL injection as captured by CWE-89, where untrusted input is integrated into SQL statements without proper neutralization.
The Custom Reports subsystem treats report configuration as trusted SQL, allowing users with configuration privileges to influence the query text rather than restricting them to structured filters and parameterized clauses.
As a result, the query builder constructs dynamic SQL that is executed by the database driver, turning configuration fields into a vehicle for executing attacker-controlled queries.
Potential impact
- Attackers may exfiltrate sensitive data from application tables, including user records, configuration values, and business data.
- They could perform UNION-based queries to blend attacker-controlled result sets with legitimate report output.
- They can call dangerous database functions that may reveal schema details, system information, or assist in further exploitation.
- They may modify or delete database records if the connected database account has write privileges.
- They could pivot to other parts of the data layer, using error-based injection to enumerate tables, columns, and indexes.
General mitigation guidance
Effective mitigation focuses on reducing SQL construction flexibility and enforcing strong separation between configuration data and query logic.
Recommended patterns include:
- Designing the reporting system around parameterized queries, where users choose from predefined filters and fields rather than author raw SQL fragments.
- Validating and constraining configuration inputs using whitelists of allowed columns, operations, and functions instead of passing arbitrary SQL.
- Applying least-privilege to the database account used by Pimcore, ensuring it cannot perform dangerous operations outside the application's expected scope.
- Centralizing query generation in a well-reviewed data access layer that consistently uses prepared statements and avoids dynamic concatenation of user input.
- Treating any configuration that influences query text as untrusted and subject to the same sanitization and validation standards as user-submitted form data.
How teams detect issues like this
Organizations can identify and monitor this type of issue through several complementary strategies:
- Static analysis rules that flag dynamic SQL construction where variables originating from HTTP requests, configuration objects, or user-editable fields are concatenated into query strings.
- Secure code review practices that focus on report building, query generation utilities, and data access helpers, looking for patterns like string-based WHERE clauses or inline UNION segments.
- Application-level logging of report definitions and executed queries, coupled with anomaly detection to highlight suspicious patterns such as unexpected UNIONs, subqueries, or calls to sensitive database functions.
- Security policies requiring that all reporting and analytics features use parameterized queries and schema-based query builders, with automated checks in CI to enforce these conventions.
- Use of database activity monitoring tools to detect abnormal query behavior originating from application accounts, such as large-scale data reads or schema enumeration.

