From Code Analysis to CVE: Uncovering SQL Injection in ChurchCRM
A SQL injection vulnerability existed in ChurchCRM's CartToFamily.php because user input was concatenated directly into a SQL query without prepared statements. An attacker could inject SQL commands to exfiltrate the entire member database, including personal and donation information.
Published on guimury.medium.com
Achieving your first CVE (Common Vulnerabilities and Exposures) is a major milestone in any Offensive Security career. More than just a unique ID, it represents the validation of a methodology and a tangible contribution to the security of the open-source community.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The application used direct string concatenation to build SQL queries instead of prepared statements, and the input filter was insufficient to neutralise SQL special characters.
Impact
An unauthenticated attacker could exfiltrate the entire member database, including names, addresses, emails, and donation data, leading to a massive PII leak.
What the attacker needed
Access to the CartToFamily.php endpoint; ability to send POST requests
The fix
The vulnerability should be fixed by using prepared statements (parameterized queries) so that user input is treated strictly as data, never as executable code.
How it was found
- Set up a local ChurchCRM instance using Docker.
- Intercept the POST request to CartToFamily.php with Burp Suite.
- Modify the PersonAddress parameter to include a SQL injection payload.
- Send the request and observe the database name and version in the response.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
SQL injection is when an attacker sneaks database commands into a form field, tricking the website into running them. Here, the website pasted whatever the user typed straight into a database question, so a clever input could ask the database to reveal all its data. This let someone steal private information like names and addresses.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.