/

CVE-2026-39327

Severity:

HIGH RISK

(8.8)

SQL Injection in ChurchCRM Member Role Change Endpoint

CVE-2026-39327

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Authentication-bypassing data access and modification via SQL Injection

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

An SQL injection vulnerability in ChurchCRM's /MemberRoleChange.php endpoint allows authenticated users with the Manage Groups & Roles (ManageGroups) permission to inject arbitrary SQL via the NewRole parameter.

Under these conditions, an attacker can read and modify database records, potentially altering member roles, group assignments, and other sensitive application data.

Affected context

The vulnerability occurs in ChurchCRM deployments using versions prior to 7.1.0, specifically identified in 7.0.5, where the /MemberRoleChange.php endpoint processes role changes for members.

It is exposed when authenticated users with the ManageGroups capability can submit requests containing unvalidated NewRole parameter values that are interpolated into SQL statements without proper sanitization or binding.

The issue is limited to contexts where the application backend directly builds SQL queries from request parameters instead of using parameterized queries or robust input handling.

Exploit preconditions

  • Attack surface: HTTP(S) requests to the /MemberRoleChange.php endpoint.
  • Required access: Valid, authenticated ChurchCRM account with the Manage Groups & Roles (ManageGroups) permission.
  • Trigger point: Submission of the NewRole parameter containing crafted SQL fragments in a request that invokes member role changes.
  • Why exploitation is possible: The server-side code concatenates the NewRole parameter into SQL queries without parameterization or sufficient validation, allowing attacker-controlled input to alter the query structure and logic.

Why this happens

This vulnerability stems from dynamically constructing SQL statements using untrusted input from the NewRole parameter and embedding it directly into the query string.

Instead of using prepared statements or parameterized queries, the implementation appears to concatenate raw request data into SQL, which matches CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').

The core bug class is trusting user-supplied data as part of query syntax rather than treating it strictly as data, enabling attackers to change the intent of the database operation.

Potential impact

  • Reading sensitive information from ChurchCRM tables that the application database user can access.
  • Modifying or corrupting member roles, group memberships, and related access-control data.
  • Inserting, updating, or deleting records in the CRM database, potentially impacting integrity of church member and operational data.
  • Escalating privileges within the application by assigning more powerful roles to attacker-controlled accounts, depending on database permissions and schema.
  • Disrupting application behavior through data tampering that affects authorization logic or configuration stored in the database.

General mitigation guidance

Effective mitigation focuses on eliminating direct string concatenation of user input into SQL and tightening trust boundaries around role-management functions.

Common defensive patterns include:

  • Using parameterized queries or prepared statements for all database interactions, ensuring that variables such as NewRole are always bound as data parameters.
  • Applying strict server-side validation and whitelisting for role identifiers (e.g., numeric IDs or a finite set of allowed role names), rejecting any values outside the expected domain.
  • Centralizing data access in a well-reviewed data access layer or ORM that consistently enforces safe query construction.
  • Minimizing the privileges of the database account used by the application so that even if an injection vector exists, the scope of possible operations is limited.
  • Restricting the ManageGroups permission to a minimal number of trusted administrative accounts and regularly reviewing assignment of powerful roles.

How teams detect issues like this

Organizations can detect and monitor for this class of vulnerability through several complementary approaches:

  • Static analysis: Configure rules to flag dynamic SQL concatenation, especially where request parameters (e.g., $_GET, $_POST, or framework request objects) flow into query-building functions without binding.
  • Code review: During manual review, look for endpoints performing administrative actions (like role changes) that build queries using string interpolation; verify that all variables are passed through parameter binding APIs.
  • Security testing: Use automated DAST or interactive application security testing to probe parameters such as NewRole for injection behavior, monitoring for anomalous responses or database errors.
  • Runtime monitoring: Enable database and application logging to detect unusual or malformed SQL patterns, as well as unexpected role changes or permission escalations associated with specific user accounts.

Sources

SourceLink
github.comgithub.com/ChurchCRM/CRM/security/advisories/GHSA-66fc-v5xj-x859

Frequently asked

questions

Yes, if the ChurchCRM instance is exposed over the network and an attacker can obtain or already has an account with the ManageGroups permission, they can exploit the vulnerability via HTTP(S) requests.

The attacker does not need full system or database administrator access, but they do need a valid ChurchCRM account with the Manage Groups & Roles (ManageGroups) capability. Without that permission, the vulnerable endpoint is typically not reachable for meaningful exploitation.

The safest pattern is to replace any dynamic SQL construction with parameterized queries or prepared statements, combined with strict validation or whitelisting of allowed role values, and to centralize query execution in a hardened data access layer.

Adopt a development standard that prohibits raw string concatenation in database queries, enforce parameterized access through frameworks or ORMs, require security-focused reviews for endpoints that modify authorization or role data, and integrate static and dynamic security testing into the CI/CD pipeline.

Find out what's already
exploitable in your codebase.