Summary
A SQL injection vulnerability in ChurchCRM's PropertyTypeEditor.php allows crafted Name and Description values to be concatenated directly into SQL queries after only minimal sanitization.
Authenticated users with "Manage Properties" permissions can leverage this flaw to execute arbitrary SQL commands, potentially exfiltrating, modifying, or deleting application data and causing persistent, application-wide impact.
Affected context
This vulnerability occurs in ChurchCRM installations where the PropertyTypeEditor.php endpoint processes POST requests to create or edit property types.
The issue manifests when:
- The Name and Description fields are accepted from the client,
- The input is sanitized only with
strip_tags()(removing HTML but not SQL control characters), - The resulting values are concatenated directly into SQL statements without parameterization.
It primarily affects environments where authenticated users are granted the "Manage Properties" permission and the application connects to a relational database using these unsafe queries.
Exploit preconditions
- Attack surface: Web application interface handling Property Type creation/editing (PropertyTypeEditor.php).
- Required access: Authenticated user with "Manage Properties" permission or equivalent capability to submit Name and Description POST parameters.
- Trigger point: Submission of malicious values for Name and/or Description through HTTP POST, which are then embedded in SQL without parameter binding.
- Why exploitation is possible: Input is only sanitized via
strip_tags(), which does not neutralize SQL meta-characters or query structure.
The application constructs SQL queries by string concatenation instead of using prepared statements, enabling attacker-controlled fragments to alter query logic.
Why this happens
The underlying bug is the direct embedding of user-supplied input into SQL queries without proper query parameterization or escaping.
Relying on strip_tags() addresses HTML and script markup but does nothing to prevent SQL metacharacters (quotes, operators, delimiters) from influencing query structure.
This maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where untrusted data is used to construct SQL statements dynamically rather than being treated as data via prepared statements or bound parameters.
Potential impact
- Attackers with the required permissions may execute arbitrary SQL commands against the ChurchCRM database.
- Sensitive data, including member records or internal configuration data, could be exfiltrated.
- Database records may be modified, corrupted, or deleted, affecting operational integrity.
- Malicious data can be injected and stored, potentially leading to persistent tampering of application content.
- Because injected content is reflected without output encoding, secondary impacts such as stored cross-site scripting could become possible in some views.
General mitigation guidance
Effective mitigation centers on eliminating dynamic SQL construction with untrusted input and tightening trust boundaries around administrative features:
- Replace string-concatenated SQL with parameterized queries or prepared statements for all Name and Description uses.
- Apply server-side input validation for administrative fields, enforcing strict length limits and allowed character sets consistent with expected business semantics.
- Introduce a central database access layer that discourages or technically prevents ad-hoc query concatenation.
- Ensure all data rendered back into HTML contexts is passed through appropriate output encoding functions based on output context (HTML, attribute, JavaScript).
- Restrict high-privilege roles such as "Manage Properties" to the minimal number of accounts and follow least-privilege principles for administrative operations.
How teams detect issues like this
Detection approaches can combine code-centric and runtime techniques:
- Static analysis: Search for SQL construction patterns involving direct concatenation of
$_POST,$_REQUEST, or other user-controlled variables, especially in PropertyTypeEditor.php and related modules. - Code review: Flag uses of
strip_tags()or similar HTML-focused sanitization as the sole defense before database calls, and ensure all database interactions are mediated through parameterized APIs. - Security testing: Use automated DAST or manual penetration testing to probe PropertyTypeEditor.php with typical SQL injection payloads and monitor for error messages, response anomalies, or data leakage.
- Database monitoring: Enable logging or anomaly detection on the database to identify unusual or malformed queries originating from the application, particularly ones that deviate from expected CRUD patterns on property-type tables.

