Summary
A time-based SQL injection vulnerability in ChurchCRM allows crafted input to the Reports/ConfirmReportEmail.php?familyId= parameter to modify database queries through unsanitized user data.
When exploited, this can enable attackers to infer or manipulate sensitive data by abusing database response timing, especially in deployments where the endpoint is exposed to untrusted users.
Affected context
This vulnerability occurs in ChurchCRM deployments that expose the Reports/ConfirmReportEmail.php endpoint and accept the familyId parameter from user-controlled sources.
The issue is triggered when user input passes through a sanitization step, but the sanitized value is not actually used in the query construction, leaving the raw parameter to influence SQL statements.
It is most relevant in environments where attackers can reach this endpoint over the network without strong input validation or strict access controls.
Exploit preconditions
- Attack surface: HTTP(S) interface of the ChurchCRM application, specifically
Reports/ConfirmReportEmail.php?familyId=. - Required access: Ability to send requests to the vulnerable endpoint (e.g., authenticated or unauthenticated depending on deployment configuration).
- Trigger point: Database operations performed when
ConfirmReportEmail.phpprocesses thefamilyIdparameter and constructs an SQL query. - Why exploitation is possible: The application performs input validation or sanitization but fails to use the sanitized value when building the SQL query, allowing the original user-supplied
familyIdto alter the SQL logic. Time-based payloads can then be used to infer data based on response delays.
Why this happens
The root cause aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Instead of binding user input via parameterized queries, the endpoint constructs SQL statements in a way that allows user-controlled data from familyId to be concatenated into the query.
Although there is an attempt to sanitize the input, the sanitized variant is not used in the actual query creation, effectively bypassing the defensive step and leaving the database call vulnerable to injection and timing-based inference.
Potential impact
- Attackers may extract sensitive information from database tables by using time-based blind SQL techniques.
- Malicious actors could modify or corrupt stored data, affecting records related to families, members, or other church management information.
- Application behavior could be altered by manipulating query conditions, impacting report generation or email confirmation workflows.
- In some configurations, attackers might be able to escalate to broader database compromise if additional flaws or weak permissions are present.
General mitigation guidance
Effective mitigation focuses on eliminating direct string concatenation of user input into SQL and ensuring that any transformation or validation is consistently applied.
Recommended defensive patterns include:
- Using parameterized queries or prepared statements for all database access, with placeholders for user-supplied values.
- Ensuring that the sanitized or validated variant of user input is the only value passed into the query-building layer.
- Applying strict server-side validation and type enforcement (e.g., treating
familyIdas an integer and rejecting non-conforming input). - Centralizing database access patterns in a data access layer that enforces secure query construction by default.
- Limiting database privileges of the application account to only the operations and tables required for normal use.
How teams detect issues like this
Detection typically combines code-focused reviews with runtime testing:
- Static analysis: Use rules that flag dynamic SQL construction with user-controlled variables, particularly concatenation involving request parameters such as
familyId. - Code review: Look for instances where input is sanitized but the sanitized variable is not actually used in the executed query; verify that prepared statements are consistently applied.
- Dynamic testing: Perform time-based SQL injection tests on endpoints that use numeric or identifier parameters, monitoring for measurable response delays correlated with crafted inputs.
- Policy enforcement: Introduce development guidelines and automated checks that require parameterized queries and prohibit ad-hoc string-based query construction.

