/

CVE-2026-39340

Severity:

HIGH RISK

(8.1)

SQL Injection in ChurchCRM Property Type Administration

CVE-2026-39340

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Database Compromise and Sensitive Data Exposure

Severity:

HIGH RISK

(8.1)

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

A SQL injection vulnerability in ChurchCRM's PropertyTypeEditor administration page allows crafted input in the Name and Description fields to be concatenated directly into raw SQL INSERT and UPDATE statements without proper escaping.

Any authenticated user with the non-admin MenuOptions role can perform time-based blind SQL injection and potentially exfiltrate sensitive data from the ChurchCRM database, including all user password hashes, when this feature is exposed.

Affected context

The vulnerability exists in the administration interface used to manage property type categories (People → Person Properties / Family Properties) within ChurchCRM.

It affects deployments where:

  • The PropertyTypeEditor.php functionality is accessible to users with the MenuOptions role, and
  • User input from the Name and Description fields is processed using a function that strips HTML but does not perform SQL escaping or parameterization.

The risk is higher in environments where many staff users have MenuOptions permissions and where the database contains sensitive pastoral records, personal data, and account credentials.

Exploit preconditions

  • Attack surface: Web-based administration UI for property type categories.
  • Required access: Authenticated ChurchCRM user with the MenuOptions role (non-admin staff permissions).
  • User-controlled fields: Name and Description inputs for property type categories.
  • Trigger point: Creation or modification of property type categories, where these values are incorporated into raw INSERT or UPDATE SQL queries.
  • Why exploitation is possible: User-controlled strings are concatenated directly into SQL statements without parameterized queries or SQL escaping; HTML sanitization alone does not remove SQL metacharacters, enabling time-based blind injection.

Why this happens

The core issue is the insecure construction of SQL queries using string concatenation with untrusted input, mapping directly to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').

A refactor replaced a function that both stripped HTML and escaped SQL (legacyFilterInput) with one that only strips HTML (sanitizeText), mistakenly assuming that HTML sanitization was sufficient for database safety.

As a result, attacker-controlled Name and Description values are embedded into SQL INSERT and UPDATE statements without parameterization or escaping, allowing crafted input to alter query structure and logic.

Potential impact

  • Extraction of arbitrary data from the ChurchCRM database through time-based blind SQL injection.
  • Exposure of sensitive personal information about congregants, families, and staff.
  • Retrieval of password hashes for all user accounts, potentially enabling offline cracking attacks.
  • Tampering with stored data, including modification or deletion of records.
  • Indirect compromise of other connected systems if credentials or API keys are stored in the database.

General mitigation guidance

Mitigation should focus on eliminating direct string concatenation of user input into SQL and enforcing strict separation between data and query logic.

Helpful defensive patterns include:

  • Using parameterized queries or prepared statements for all database interactions, ensuring user input is always treated as data rather than executable SQL.
  • Centralizing database access through a data access layer that enforces safe query construction patterns by default.
  • Maintaining distinct sanitization steps for different sinks: HTML sanitization for output to the UI and SQL-safe parameter binding for database operations, rather than reusing a single filter for both.
  • Applying least-privilege to the database account used by the application so that, even if injection occurs, the account cannot perform unnecessary administrative operations.
  • Implementing defense-in-depth validation rules (length limits, character whitelisting, and contextual validation) for administrative fields like Name and Description.

How teams detect issues like this

Detection can combine code-centric and behavior-centric approaches:

  • Static analysis: Scan the codebase for SQL statements that use string concatenation or interpolation with variables derived from HTTP request parameters, particularly in administrative modules like PropertyTypeEditor.php.
  • Code review: Flag any custom sanitization functions used for multiple sinks (e.g., both HTML and SQL) and verify that database calls use parameterized queries rather than manually escaped strings.
  • Runtime monitoring: Use database query logging or an application-level audit trail to detect anomalous patterns such as long-running time-based queries, unusual WHERE clauses, or repeated similar queries from a single session.
  • Security testing: Include time-based blind SQL injection tests in automated DAST pipelines, targeting fields that accept free-form text in administrative interfaces.

Sources

SourceLink
github.comgithub.com/ChurchCRM/CRM/security/advisories/GHSA-66f7-4p96-mww9

Frequently asked

questions

Exploitation is limited to authenticated users who hold the MenuOptions role or higher and can access the property type administration UI; it is not directly exploitable by anonymous visitors.

No. The vulnerability can be triggered by non-admin staff users with the MenuOptions permission, which expands the pool of potential insiders or compromised accounts that can abuse it.

The safest pattern is to refactor all affected database interactions to use parameterized queries or prepared statements and ensure that any sanitization functions for UI display are not relied on for SQL safety.

Adopt a strict policy that forbids building SQL with string concatenation, enforce this via code review and static analysis, and use well-tested database abstraction layers that make safe patterns the default while performing context-specific validation for each input.

Find out what's already
exploitable in your codebase.