/

CVE-2026-39337

Severity:

CRITICAL RISK

(10.0)

Code Injection in ChurchCRM Setup Wizard Database Password

CVE-2026-39337

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Pre-authentication Remote Code Execution

Severity:

CRITICAL RISK

(10.0)

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

ChurchCRM's setup wizard contained a pre-authentication code injection flaw where the $dbPassword installation parameter was incorporated into PHP code without proper sanitization.

During initial installation, an unauthenticated attacker able to reach the setup interface could inject arbitrary PHP code via this parameter, potentially achieving full remote code execution and complete server compromise.

Affected context

This vulnerability affects ChurchCRM instances that are not yet fully installed and expose the setup wizard over a network-accessible interface.

It is most relevant in deployments where:

  • The ChurchCRM setup process is accessible from the internet or untrusted networks
  • The database configuration step is performed through a web form
  • Installation files and setup scripts remain reachable until installation is complete and the admin secures the environment

Because the issue occurs during initial configuration, even freshly deployed servers are at risk if the setup wizard is exposed to attackers.

Exploit preconditions

  • Attack surface: HTTP(S) endpoint serving the ChurchCRM setup wizard.
  • Required access: No authentication required; the attacker only needs network access to the installation page.
  • User interaction: The setup wizard must be reachable and not yet locked down; the attacker submits crafted values for the $dbPassword field.
  • Trigger point: The database configuration step where the application processes and embeds $dbPassword into PHP or configuration logic.
  • Why exploitation is possible: The $dbPassword variable is incorporated into dynamically generated PHP code or configuration without adequate sanitization or encoding, enabling injection of attacker-controlled code that is later executed by the PHP interpreter.

Why this happens

The root cause is improper neutralization of user-controlled input before it is incorporated into executable PHP code.

Specifically, the $dbPassword parameter from the setup wizard is treated as data but is placed into a context that is interpreted as code—such as direct concatenation into PHP scripts or configuration statements that PHP executes.

This pattern maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), where application logic dynamically builds code constructs using untrusted values.

Additionally, the vulnerability stems from an incomplete or partial remediation of a prior issue (CVE-2025-62521), indicating that the original fix did not systematically remove all code paths where $dbPassword could influence code generation without strict validation and encoding.

Potential impact

  • Full remote execution of arbitrary PHP code on the server
  • Complete compromise of the ChurchCRM application and its data
  • Theft or modification of sensitive church member records and financial data
  • Installation of webshells or backdoors for persistent server access
  • Use of the compromised server as a pivot point into the broader network
  • Tampering with application integrity, including adding rogue admin accounts or altering configuration

General mitigation guidance

Effective mitigation focuses on eliminating dynamic code generation paths that are influenced by untrusted input and tightening the security of the installation workflow.

Recommended patterns include:

  • Avoid dynamic code construction: Do not build PHP code strings using runtime user input such as $dbPassword. Instead, use static templates with clearly defined configuration files or environment variables.
  • Treat configuration as data only: Ensure that installation parameters are written to configuration files in formats that are not parsed as executable PHP, or if PHP is used, values must be strictly escaped and never interpreted as code.
  • Strong input neutralization: Apply rigorous escaping/encoding for any configuration values that might be embedded in language constructs, including quotes, delimiters, and special characters.
  • Lock down the setup surface: Restrict access to the setup wizard to trusted administrators and internal networks only. Disable or remove setup components automatically once installation completes.
  • Least privilege environment: Run the web server and PHP with minimal privileges, limiting the damage of potential compromise and restricting write access to sensitive directories.
  • Holistic fix strategy: When addressing a previously reported issue, review all related code paths for similar patterns rather than patching only the initially reported instance.

How teams detect issues like this

Detection can combine code-centric and operational approaches:

  • Static analysis: Configure static analyzers to flag:
  • Dynamic eval, assert, create_function, or include/require statements built from request parameters.
  • String concatenation where user-supplied data flows into PHP code fragments or configuration-generating functions.
  • Any use of installation parameters (e.g., $dbPassword, $dbUser) in code-generating contexts.
  • Code review signals:
  • Setup or installation scripts that write .php files containing interpolated user data.
  • Direct embedding of configuration values into executable PHP rather than purely data-oriented formats (e.g., .ini, .env, JSON).
  • "Quick fix" patches that sanitize input in only one location instead of analyzing the full data flow.
  • Runtime monitoring:
  • Web server logs showing unexpected or malformed values in installation parameters.
  • File integrity monitoring on application directories to detect new or modified PHP files after installation.
  • Automated checks in CI/CD:
  • Security-focused linters and SAST tools integrated into pipelines, with policies specifically examining installation and configuration routines for code injection patterns.

Sources

SourceLink
github.comgithub.com/ChurchCRM/CRM/security/advisories/GHSA-pm2v-ggh4-mp7p

Frequently asked

questions

The vulnerability is highly exploitable wherever the ChurchCRM setup wizard is exposed to untrusted networks. Any unauthenticated user who can reach the installation page during setup can potentially exploit it, which is why it is rated critical.

No. The issue is pre-authentication; exploitation occurs before any user accounts are created or login checks are enforced. Network reachability to the setup wizard is the primary requirement.

The safest approach is to eliminate dynamic code generation from user-controlled input entirely. Treat installation parameters strictly as data, store them in non-executable configuration formats, and ensure any necessary interpolation applies rigorous escaping and validation without ever passing user values into constructs that PHP will execute as code.

Adopt a secure design principle that forbids using user or configuration input to construct executable code, enforce secure coding guidelines around installation scripts, and use static analysis plus targeted code reviews to scrutinize any area where configuration values are written into PHP. Additionally, perform regression testing for previously reported vulnerabilities to confirm that related code paths are also secured.

Find out what's already
exploitable in your codebase.