Fundraising Script 1.0 - SQLi
## Title: Fundraising Script-1.0 SQLi
## Author: nu11secur1ty
## Date: 09/13/2023
## Vendor: https://www.phpjabbers.com/
## Software: https://www.phpjabbers.com/fundraising-script/#sectionDemo
## Reference: https://portswigger.net/web-security/sql-injection
## Description:
The `cid` parameter appears to be vulnerable to SQL injection attacks.
The payload ' was submitted in the cid parameter, and a database error
message was returned.
The database is empty, but if it is not, this will be over for the
money of the donors and their bank accounts!
The attacker can steal all information from the database!
[+]Payload:
mysql
Parameter: cid (GET)
Type: error-based
Title: MySQL >= 5.1 error-based - Parameter replace (UPDATEXML)
Payload: controller=pjFront&action=pjActionLoadCampaign&cid=(UPDATEXML(1741,CONCAT(0x2e,0x71626b7071,(SELECT
(ELT(1741=1741,1))),0x7162787171),3873))
https://github.com/nu11secur1ty/CVE-nu11secur1ty/tree/main/vendors/phpjabbers/2023/Fundraising-Script-1.0
System Administrator - Infrastructure Engineer
Penetration Testing Engineer
nu11secur1ty <http://nu11secur1ty.com/> Fundraising Script 1.0 SQL Injection Vulnerability: A Deep Dive into Exploitation and Remediation
Security vulnerabilities in web applications can have devastating consequences—especially when they involve financial data. One such critical flaw was recently identified in PHPJabbers Fundraising Script 1.0, a widely used open-source platform for managing donation campaigns. This article examines the error-based SQL injection vulnerability found in the cid parameter, its exploitation mechanics, real-world impact, and essential mitigation strategies.
Overview of the Vulnerable System
The Fundraising Script 1.0 is designed to help organizations collect donations through customizable campaigns. It leverages PHP and MySQL for backend operations. While the platform is marketed as secure and user-friendly, a recent audit by cybersecurity researcher nu11secur1ty revealed a critical flaw in the cid parameter, which is used to identify campaigns via GET requests.
When attackers submit malformed input—specifically '—into the cid field, the application returns a database error message. This behavior confirms the presence of an SQL injection vulnerability, particularly in the form of error-based injection.
Exploitation Mechanism: Error-Based SQL Injection
SQL injection attacks exploit improper input validation in web applications. In this case, the cid parameter is not sanitized before being used in SQL queries. The attacker leverages the database’s error reporting mechanism to extract information from the backend.
Here’s the malicious payload used in the exploit:
controller=pjFront&action=pjActionLoadCampaign&cid=(UPDATEXML(1741,CONCAT(0x2e,0x71626b7071,(SELECT(ELT(1741=1741,1))),0x7162787171),3873)
This payload is crafted to trigger a database error that leaks data. Let’s break it down:
- UPDATEXML: A MySQL function that modifies XML content. When used with invalid arguments, it triggers a database error.
- CONCAT: Concatenates strings. The payload uses hexadecimal values to embed a unique identifier (
0x71626b7071= "qbpq") and a conditional expression. - ELT: Returns a value based on a condition.
ELT(1741=1741,1)evaluates to1because the condition is always true. - 0x2e: Represents a dot (.) used as a delimiter.
When the database processes this malformed query, it throws an error that includes the concatenated string, effectively leaking data from the database. This technique is known as error-based SQL injection, commonly used in MySQL versions >= 5.1.
Real-World Impact: Data Theft and Financial Risk
While the test environment had an empty database, the implications are severe when the system is live with real donor data:
- Donor Information: Names, email addresses, and contact details.
- Payment Data: Credit card numbers, bank account details, transaction history.
- Internal Records: Admin credentials, campaign budgets, and user roles.
With a single SQL injection, an attacker can extract entire databases—potentially leading to identity theft, financial fraud, and reputational damage for the organization.
Attack Chain: From Discovery to Exfiltration
Attackers can follow a systematic approach:
- Confirm vulnerability via
cid='and observe error messages. - Use
UPDATEXMLto trigger error-based data leakage. - Iteratively extract database schema (e.g., table names, column names).
- Construct additional payloads to retrieve sensitive data (e.g.,
SELECT user_name FROM donors). - Exfiltrate data through error messages or via automated tools like sqlmap.
Tools like Burp Suite or sqlmap can automate this process, making exploitation faster and more efficient.
Security Best Practices for Developers and Admins
To prevent such vulnerabilities, developers and system administrators must implement robust security measures:
- Input Sanitization: Always validate and sanitize user inputs before querying the database.
- Parameterized Queries: Use prepared statements to separate code from data.
- Least Privilege Principle: Database users should have minimal permissions.
- Web Application Firewalls (WAF): Deploy WAFs to detect and block SQL injection attempts.
- Regular Penetration Testing: Conduct routine audits using tools like OWASP ZAP or Metasploit.
For Fundraising Script 1.0 users, immediate action is required:
- Update to the latest version if available.
- Apply patches or custom fixes to sanitize the
cidparameter. - Monitor logs for suspicious GET requests containing SQL-like syntax.
Corrected Code Example: Secure Implementation
Here’s how the vulnerable code should be rewritten using prepared statements:
// Vulnerable (Original)
$query = "SELECT * FROM campaigns WHERE id = '" . $_GET['cid'] . "'";
// Secure (Fixed)
$stmt = $pdo->prepare("SELECT * FROM campaigns WHERE id = ?");
$stmt->execute([$_GET['cid']]);
$result = $stmt->fetchAll();
This approach ensures that user input is treated as data, not executable code. The database engine never interprets the input as SQL, preventing injection attacks.
Conclusion: Proactive Defense is Critical
SQL injection remains one of the most prevalent web vulnerabilities. The Fundraising Script 1.0 case highlights how even seemingly benign parameters can lead to catastrophic breaches. Organizations must prioritize security at every layer—from code design to deployment and monitoring.
As cybersecurity experts, we must advocate for secure-by-design principles. Every application handling sensitive data—especially financial information—must undergo rigorous security testing before deployment.