Summary
An SQL injection vulnerability in ChurchCRM's /SettingsUser.php endpoint allows authenticated administrative users to inject arbitrary SQL statements via the type array parameter index.
Under certain conditions, this can be used to read, modify, or delete data in the ChurchCRM database and potentially impact the integrity and confidentiality of stored church records.
Affected context
This vulnerability occurs in ChurchCRM deployments using version 7.0.5 (and likely nearby versions prior to 7.1.0) where the /SettingsUser.php endpoint is accessible to logged-in administrative users.
It specifically affects request paths that accept a type array parameter whose index value is incorporated into SQL queries without robust sanitization or parameterization.
The risk is present in environments where admin accounts are widely used, shared, or insufficiently protected, and where the application database contains sensitive member, contribution, or operational data.
Exploit preconditions
- Attack surface: HTTP(S) requests to the /SettingsUser.php endpoint within ChurchCRM.
- Required access: Valid authenticated administrative user account (or equivalent privileges that can call the affected functionality).
- Trigger point: Submission of crafted input in the
typearray parameter index, causing the backend to interpolate untrusted data into SQL statements. - Why exploitation is possible: The server-side code uses the
typearray index directly in SQL construction without using parameterized queries or adequate validation/escaping, allowing an attacker-controlled fragment to alter the structure of the SQL query.
Why this happens
The root cause aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
The endpoint logic builds SQL queries dynamically, incorporating user-controlled data from the type array parameter index.
Instead of using parameterized queries or strict whitelisting of allowed values, the implementation likely concatenates or interpolates the input directly into the query text.
This pattern allows crafted input to break out of the intended query context and inject additional SQL operations, turning untrusted input into executable database commands.
Potential impact
- Unauthorized reading of sensitive data stored in the ChurchCRM database (e.g., member records, contributions, contact information).
- Modification of configuration settings or user-related data, potentially impacting application behavior.
- Insertion, update, or deletion of database records, leading to data tampering or loss.
- Escalation of impact if combined with other weaknesses (e.g., use of powerful database accounts, weak separation of duties).
- Potential for staging further attacks if the database contents are used for authentication or application logic decisions.
General mitigation guidance
Effective mitigation focuses on eliminating dynamic SQL construction from user-controllable input and hardening the privilege context in which queries execute.
Recommended defensive patterns include:
- Using parameterized queries or prepared statements for all database access, ensuring user-supplied values are bound as data, not as query structure.
- Applying strict whitelisting for any dynamic elements that must influence query structure (such as column or setting names), mapping user input to a fixed, vetted set of server-side constants.
- Normalizing input handling of array parameters so that indices and keys are validated against expected formats and value sets before use.
- Enforcing least-privilege database credentials so that the application account only has the minimal permissions required for normal operation.
- Introducing centralized database access layers or ORM patterns that discourage ad-hoc string concatenation and encourage safe query patterns by default.
How teams detect issues like this
Organizations can surface this class of issue using a mix of review and automation:
- Static analysis: Configure rules to flag direct string concatenation or interpolation involving request parameters (e.g.,
$_GET,$_POST,$_REQUEST, or framework input objects) in SQL query construction. - Code review: During manual review, trace how the
typeparameter and similar user-controlled inputs propagate into database calls, looking for unparameterized query assembly and missing validation. - Dynamic testing: Use application-aware security testing (DAST) to send crafted payloads to the /SettingsUser.php endpoint and monitor for SQL errors, response anomalies, or unexpected behavior.
- Policy enforcement: Adopt secure coding guidelines that mandate prepared statements and whitelisting for all dynamic query elements, and enforce these policies via pre-commit hooks or CI checks.

