Summary
ChurchCRM contains a second-order SQL injection vulnerability in the /FundRaiserEditor.php endpoint, where data previously stored in a PHP session parameter is later used unsafely in SQL queries.
An authenticated but otherwise low-privilege user can inject arbitrary SQL via the iCurrentFundraiser session value and subsequently trigger it to extract or modify data in the ChurchCRM database.
Affected context
The vulnerability occurs in ChurchCRM deployments that:
- Use the /FundRaiserEditor.php endpoint,
- Store user-controlled values (such as iCurrentFundraiser) in PHP session state, and
- Later incorporate those values into SQL statements without proper sanitization, parameterization, or validation.
It becomes especially risky in environments where authenticated users are common and session data flows into privileged database operations without strict checks.
Exploit preconditions
- Attack surface: HTTP(S) requests to the /FundRaiserEditor.php endpoint in a deployed ChurchCRM instance.
- Required access: Valid authenticated user account; no special roles or elevated privileges are required.
- Trigger point: SQL queries that read the iCurrentFundraiser value from the PHP session and concatenate it directly into SQL statements.
- Why exploitation is possible: The application assumes data in the session is trusted and does not re-validate or parameterize it before using it in database operations, allowing previously injected content to execute as part of a later query.
Why this happens
This issue is a classic second-order SQL injection problem aligned with CWE-89: Improper Neutralization of Special Elements used in an SQL Command.
Instead of directly using request parameters in SQL, the application stores a user-controlled value (iCurrentFundraiser) in the PHP session and later constructs SQL queries by concatenating this value into the query string.
Because session data is treated as inherently trusted and is not passed through parameterized queries or robust validation at the point of use, attacker-controlled SQL fragments can execute during subsequent operations involving the fundraiser data.
Potential impact
- An authenticated user could read sensitive data from ChurchCRM tables, including personal or financial records.
- An attacker may modify or delete fundraising or related records, impacting data integrity.
- SQL injection could be used to escalate access within the application by altering permission or account data.
- In certain configurations, database-level compromise may enable further lateral movement in the environment.
General mitigation guidance
Effective mitigation focuses on treating all persisted data as potentially untrusted and enforcing safe database interaction patterns:
- Use parameterized queries or prepared statements for all SQL interactions, including those using values sourced from sessions or other server-side storage.
- Normalize and validate identifiers such as fundraiser IDs (e.g., enforcing numeric types, whitelisting known values) before interacting with the database.
- Apply a clear separation between data and SQL logic, avoiding dynamic SQL string concatenation wherever possible.
- Reduce the trust level of session data by re-validating its contents against expected schemas or domain rules before use in sensitive operations.
- Apply least-privilege to database accounts so that the web application can perform only the minimum required operations, limiting the blast radius of any injection.
How teams detect issues like this
Organizations can detect similar issues by:
- Running static analysis with rules targeting dynamic SQL construction, especially where session variables, request parameters, or other user-influenced data flow into query strings.
- Reviewing code paths where values are written to and later read from sessions, cookies, or persistent storage, checking that parameterization is enforced at the point of query execution.
- Applying secure coding guidelines and linting policies that forbid ad-hoc string concatenation for SQL and require prepared statements.
- Using application security testing (DAST/IAST) tools configured to exercise authenticated workflows and look for second-order injection patterns that manifest only after multiple requests.

