Summary
ChurchCRM contained a SQL injection vulnerability in the EditEventTypes.php administrative endpoint where the EN_tyid POST parameter was used in a database query without proper sanitization.
An authenticated administrator could craft malicious input to execute arbitrary SQL commands directly against the application database, risking data exposure, tampering, or disruption.
Affected context
This vulnerability occurs in ChurchCRM within the EditEventTypes.php functionality, which is designed to manage event type records and is only exposed to authenticated administrators.
The issue manifests when user-supplied input from the EN_tyid POST parameter is interpolated directly into SQL statements without appropriate parameterization or escaping.
The risk is present in deployments where administrators (or accounts with equivalent permissions) can send crafted HTTP requests to this endpoint.
Exploit preconditions
- Attack surface: Web application administrative interface (EditEventTypes.php).
- Required access: Valid authenticated ChurchCRM administrator account or any account with access to the EditEventTypes functionality.
- Trigger point: Submission of a crafted EN_tyid POST parameter value in a request to EditEventTypes.php.
- Why exploitation is possible: The EN_tyid parameter is concatenated directly into an SQL query without parameterized statements or robust input validation, allowing attacker-controlled SQL fragments to be executed by the database.
Why this happens
The root cause is the construction of SQL queries using string concatenation that embeds untrusted input from the EN_tyid POST parameter.
This pattern aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the application fails to treat user input as data only and instead allows it to alter the structure of the SQL statement.
By not using prepared/parameterized statements or sufficient validation, the application blurs the boundary between code and data at the database layer, enabling arbitrary SQL execution by privileged users.
Potential impact
- An administrator may be able to read sensitive data from arbitrary tables in the ChurchCRM database.
- An administrator could modify, insert, or delete records, including membership data, financial records, or configuration entries.
- An administrator could corrupt application data, impacting the integrity and availability of ChurchCRM.
- Depending on database capabilities and configuration, an administrator might leverage SQL features (e.g., stored procedures) for further escalation within the database environment.
General mitigation guidance
Effective mitigation centers on eliminating raw string-based query construction and tightening trust boundaries around administrative input:
- Prefer parameterized queries or prepared statements for all database access, ensuring that user-supplied values are always bound as parameters rather than interpolated into SQL strings.
- Apply strict server-side validation and type enforcement on all incoming parameters, especially IDs and numeric fields, to ensure they conform to expected formats.
- Centralize database access in well-reviewed data access layers that prohibit ad-hoc SQL construction in presentation or controller code.
- Limit privileges associated with the application's database account to the minimum needed, reducing the blast radius if an injection occurs.
- Implement defense-in-depth controls such as database-level query controls or allowlists to constrain potentially dangerous operations.
How teams detect issues like this
Organizations can identify and monitor for similar SQL injection risks through a combination of static and dynamic approaches:
- Static analysis: Configure SAST tools or custom linters to flag string concatenation used in SQL query construction, especially instances that include variables derived from HTTP request parameters.
- Code review signals: During manual review, scrutinize administrative endpoints and legacy scripts for direct use of
$_POST,$_GET, or similar request variables in SQL strings without parameter binding. - Policy enforcement: Adopt coding guidelines that mandate the use of parameterized queries and forbid inline SQL with untrusted input, and enforce these via pull request templates and automated checks.
- Runtime monitoring: Use database audit logs or application logging to detect anomalous or unexpected SQL patterns, such as queries containing injected fragments or always-true conditions.

