/

CVE-2026-35184

Severity:

CRITICAL RISK

(9.8)

SQL Injection in EcclesiaCRM Query View Template

CVE-2026-35184

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Database Compromise / Remote Code Execution (environment-dependent)

Severity:

CRITICAL RISK

(9.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

EcclesiaCRM versions prior to 8.0.0 contain a SQL injection vulnerability in v2/templates/query/queryview.php, where the custom and value parameters are used unsafely in database queries.

An attacker who can control these parameters may inject arbitrary SQL, potentially leading to data exfiltration, data tampering, or complete compromise of the CRM database under vulnerable configurations.

Affected context

The issue appears in EcclesiaCRM's server-side PHP code that dynamically builds SQL queries for the query view functionality.

It becomes relevant when user-controllable input (such as HTTP GET/POST parameters mapped to custom and value) is passed into SQL statements without guaranteed use of prepared statements or strict parameterization.

Installations exposed to untrusted users over a network, especially internet-facing deployments or multi-user church management portals, are most at risk.

Exploit preconditions

  • Attack surface: Web interface endpoints that eventually invoke v2/templates/query/queryview.php.
  • Required access: Ability to send crafted HTTP requests or interact with UI elements that populate the custom and value parameters.
  • Trigger point: Execution of SQL queries in the query view feature where custom and value are incorporated into the query text.
  • Why exploitation is possible: Input from custom and value is not robustly constrained or parameterized, allowing attackers to alter the intended SQL structure rather than only its data values.

Why this happens

This vulnerability stems from constructing SQL statements by concatenating or interpolating untrusted input into query strings in PHP.

Instead of treating custom and value as bounded parameters, the code path in queryview.php allows user input to influence parts of the SQL syntax (e.g., WHERE clauses, operators, or additional statements).

This aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command, where metacharacters such as quotes, comment markers, or statement delimiters are insufficiently sanitized, enabling attackers to modify the logic of the query.

Potential impact

  • Extraction of sensitive CRM data, including member records, contact information, and internal notes
  • Unauthorized modification or deletion of records, potentially affecting donations, membership, and pastoral care data
  • Bypassing authentication or authorization checks if the database is used to validate sessions or roles
  • In some environments, potential execution of server-side commands or pivoting to other systems if the database engine or configuration allows it

General mitigation guidance

Effective mitigation generally focuses on removing dynamic SQL construction based on raw user input and reducing trust in web-sourced parameters:

  • Use parameterized queries or prepared statements for all database access, binding custom and value as data values rather than inline SQL fragments.
  • Introduce server-side whitelisting for any queryable fields or operators; map user choices to predefined, constant SQL fragments instead of passing them through directly.
  • Apply strict input validation for query-building inputs (e.g., only allow known field names and restricted value formats) to narrow the input domain.
  • Enforce least-privilege database accounts so that even if a query is abused, the account has minimal ability to alter schema or sensitive tables.
  • Centralize database access patterns in a data access layer, making unsafe query construction easier to spot and refactor.

How teams detect issues like this

Organizations can look for this and similar issues using:

  • Static analysis rules that flag SQL query strings built via string concatenation or interpolation with user-sourced variables in PHP.
  • Code review checklists emphasizing parameterized queries, explicit whitelisting of queryable fields, and banned direct use of request variables in SQL.
  • Runtime monitoring of database logs for anomalous queries, such as those containing comment sequences, tautologies, or unexpected UNION/OR clauses.
  • Web application security testing tools or frameworks that perform automated injection tests against parameters like custom and value to detect exploitable patterns.

Sources

SourceLink
gist.github.comgist.github.com/NicolasPauferro/d877992327592f1e8eb4e2c9dce1ae9b
github.comgithub.com/phili67/ecclesiacrm/commit/f743b97f89da469a4c70b82bd61d0a59a3a957a9
github.comgithub.com/phili67/ecclesiacrm/pull/2861
github.comgithub.com/phili67/ecclesiacrm/security/advisories/GHSA-gjw3-73q9-v2qh

Frequently asked

questions

Yes, in typical deployments this is remotely exploitable whenever the affected functionality is exposed over HTTP(S) and accessible to untrusted users who can control the custom and value parameters.

An attacker generally only needs the ability to interact with the web interface or send HTTP requests to the vulnerable endpoint. No direct database access is required; the application acts as the conduit to the database.

The safest fix is to eliminate dynamic SQL that includes untrusted input and migrate all database access to parameterized queries or prepared statements, combined with strict whitelisting of allowable fields and operators in any query-building feature.

Establish a standard data access layer that enforces parameterization by default, forbid ad-hoc SQL string concatenation in code review policies, integrate static analysis rules for SQL injection patterns into CI/CD, and ensure developers are trained on secure query construction practices.

Find out what's already
exploitable in your codebase.