Summary
An SQL injection flaw in ChurchCRM's /EventNames.php endpoint allows authenticated users with AddEvent privileges to inject arbitrary SQL via the newEvtTypeCntLst parameter during event type creation.
Because user-controlled input is interpolated directly into an ON DUPLICATE KEY UPDATE clause without proper escaping or parameterization, an attacker can manipulate database queries and potentially access or alter sensitive data.
Affected context
This vulnerability arises in ChurchCRM deployments that:
- Expose the Event Type creation functionality via /EventNames.php
- Grant AddEvent privileges to regular users or delegated staff
- Build SQL statements dynamically using the newEvtTypeCntLst parameter
The issue is triggered when creating or updating event types, where values from newEvtTypeCntLst reach an ON DUPLICATE KEY UPDATE clause without safe handling.
Exploit preconditions
- Attack surface: HTTP(S) requests to the ChurchCRM web interface, specifically the event type creation feature.
- Required access: Valid, authenticated ChurchCRM account with AddEvent privileges.
- Trigger point: Submission of a crafted newEvtTypeCntLst parameter during event type creation or update via /EventNames.php.
- Why exploitation is possible: The application directly interpolates user input into an SQL ON DUPLICATE KEY UPDATE statement without parameterization or robust escaping, allowing attacker-controlled fragments to alter the intended query structure.
Why this happens
The root cause is the construction of SQL statements through string concatenation that includes untrusted user input, mapping directly to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
In this case, the newEvtTypeCntLst parameter is treated as data but embedded directly into the ON DUPLICATE KEY UPDATE clause, so any SQL meta-characters in the input are interpreted by the database engine as part of the query.
The lack of prepared statements or strict input validation means the database cannot distinguish between intended values and injected control sequences, enabling query manipulation.
Potential impact
- Authenticated users with AddEvent privileges could manipulate event-related tables beyond their intended permissions.
- Attackers may be able to exfiltrate sensitive information from the database, depending on query context and database permissions.
- Event records and related entities could be modified, corrupted, or deleted.
- Application logic relying on event data may be disrupted, leading to inconsistent or misleading reports and schedules.
- Under permissive database accounts, attackers could pivot to broader schema changes or privilege escalation at the database level.
General mitigation guidance
Effective mitigation focuses on eliminating dynamic SQL that mixes control and data:
- Use parameterized queries or prepared statements for all database interactions involving user-controlled values, including ON DUPLICATE KEY UPDATE clauses.
- Apply strict server-side validation and canonicalization to parameters like newEvtTypeCntLst, allowing only expected formats (e.g., numeric IDs, constrained strings).
- Centralize database access logic so that all SQL is constructed through vetted data-access utilities rather than ad-hoc string concatenation.
- Follow the principle of least privilege for the database user account used by ChurchCRM, limiting the impact of any injected queries.
- Incorporate defense-in-depth controls such as database-level query controls, read-only roles where possible, and logging of unusual write-heavy patterns.
How teams detect issues like this
Organizations can detect and monitor for this class of vulnerability using several approaches:
- Static analysis: Configure SAST rules to flag dynamic SQL construction, especially concatenation involving request parameters or form data in PHP files like /EventNames.php.
- Code review: During manual reviews, look for direct interpolation of $_POST/$_GET variables into SQL strings, and verify that data-access layers consistently use prepared statements.
- Security testing: Use authenticated application security testing (DAST) focused on event management workflows to identify injectable parameters such as newEvtTypeCntLst.
- Logging and monitoring: Instrument database logs to detect anomalous queries, unexpected UNIONs, subqueries, or error patterns following event type operations, and correlate them with specific user accounts and endpoints.

