CVE-2022-31325

7.2 HIGH

📋 TL;DR

This SQL injection vulnerability in ChurchCRM 4.4.5 allows attackers to execute arbitrary SQL commands via the PersonID parameter in WhyCameEditor.php. This affects all ChurchCRM 4.4.5 installations with the vulnerable endpoint accessible. Attackers could potentially read, modify, or delete database contents.

💻 Affected Systems

Products:
  • ChurchCRM
Versions: 4.4.5
Operating Systems: All platforms running ChurchCRM
Default Config Vulnerable: ⚠️ Yes
Notes: All ChurchCRM 4.4.5 installations with WhyCameEditor.php accessible are vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete database compromise including sensitive personal data exposure, authentication bypass, and potential remote code execution if database functions allow it.

🟠

Likely Case

Unauthorized data access and extraction of sensitive church member information, donation records, and personal details.

🟢

If Mitigated

Limited impact with proper input validation and parameterized queries preventing SQL injection.

🌐 Internet-Facing: HIGH - The vulnerable endpoint is web-accessible and SQL injection is a common attack vector.
🏢 Internal Only: MEDIUM - Internal attackers could still exploit this to escalate privileges or access sensitive data.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploit requires authentication to access WhyCameEditor.php, but SQL injection payloads are publicly documented.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 4.4.6 or later

Vendor Advisory: https://github.com/ChurchCRM/CRM/issues/6005

Restart Required: No

Instructions:

1. Backup your ChurchCRM database and files. 2. Download ChurchCRM 4.4.6 or later from the official repository. 3. Replace the vulnerable WhyCameEditor.php file with the patched version. 4. Verify the fix by testing the PersonID parameter.

🔧 Temporary Workarounds

Input Validation Filter

all

Add input validation to ensure PersonID only accepts numeric values

Modify WhyCameEditor.php to include: if(!is_numeric($_GET['PersonID'])) { die('Invalid input'); }

WAF Rule

all

Implement web application firewall rules to block SQL injection patterns

Add WAF rule: SecRule ARGS:PersonID "@rx (\'|\"|--|#|;|union|select|insert|update|delete|drop|create|alter)" "id:1001,phase:2,deny"

🧯 If You Can't Patch

  • Restrict access to WhyCameEditor.php using IP whitelisting or authentication requirements
  • Implement database user with minimal privileges (read-only if possible) for the application

🔍 How to Verify

Check if Vulnerable:

Test the PersonID parameter with SQL injection payloads like: PersonID=1' OR '1'='1

Check Version:

Check ChurchCRM version in admin panel or review version.php file

Verify Fix Applied:

Test the same SQL injection payloads after patching - they should be rejected or properly handled

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL errors in application logs
  • Multiple failed PersonID parameter attempts with special characters

Network Indicators:

  • HTTP requests to WhyCameEditor.php with SQL keywords in parameters

SIEM Query:

source="web_logs" AND uri="/churchcrm/WhyCameEditor.php" AND (query="*union*" OR query="*select*" OR query="*' OR '*" OR query="*;*" OR query="*--*")

🔗 References

📤 Share & Export