CVE-2020-24617

8.8 HIGH

📋 TL;DR

CVE-2020-24617 is an SQL injection vulnerability in Mailtrain's campaign statistics feature that allows attackers to execute arbitrary SQL commands. This affects Mailtrain instances up to version 1.24.1. Attackers can potentially access, modify, or delete database content including user data and campaign information.

💻 Affected Systems

Products:
  • Mailtrain
Versions: through 1.24.1
Operating Systems: All platforms running Mailtrain
Default Config Vulnerable: ⚠️ Yes
Notes: All Mailtrain installations using the default configuration are vulnerable. The vulnerability exists in the statsClickedSubscribersByColumn function.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete database compromise allowing data theft, modification, or deletion; potential privilege escalation to system access; possible remote code execution if database functions permit.

🟠

Likely Case

Unauthorized access to sensitive campaign data, subscriber information, and user credentials stored in the database.

🟢

If Mitigated

Limited impact with proper input validation and database permissions restricting query execution scope.

🌐 Internet-Facing: HIGH - The vulnerable endpoint is accessible via web interface and can be exploited remotely without authentication.
🏢 Internal Only: MEDIUM - Internal attackers or compromised accounts could exploit this, but external exposure increases risk significantly.

🎯 Exploit Status

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

Exploitation requires sending crafted requests to /campaigns/clicked/ajax endpoint. Public proof-of-concept exists in GitHub security advisory.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.24.2 and later

Vendor Advisory: https://github.com/Mailtrain-org/mailtrain/pull/909

Restart Required: Yes

Instructions:

1. Backup your Mailtrain installation and database. 2. Update Mailtrain to version 1.24.2 or later. 3. Restart the Mailtrain service. 4. Verify the fix by checking the version and testing the vulnerable endpoint.

🔧 Temporary Workarounds

Input Validation Filter

all

Add input validation to reject malicious column names before processing

Modify lib/models/campaigns.js to validate column parameter against allowed list

Web Application Firewall Rule

all

Block SQL injection patterns in requests to /campaigns/clicked/ajax

Add WAF rule to detect and block SQL injection patterns in URL parameters

🧯 If You Can't Patch

  • Restrict network access to Mailtrain interface to trusted IP addresses only
  • Implement database user with minimal permissions (read-only for stats functions)

🔍 How to Verify

Check if Vulnerable:

Check Mailtrain version. If version is 1.24.1 or earlier, the system is vulnerable. Review lib/models/campaigns.js for the statsClickedSubscribersByColumn function to see if column parameter is properly escaped.

Check Version:

Check package.json or run: grep version /path/to/mailtrain/package.json

Verify Fix Applied:

After patching, verify version is 1.24.2 or later. Test the /campaigns/clicked/ajax endpoint with malicious input to confirm SQL injection is prevented.

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL queries in database logs
  • Multiple failed requests to /campaigns/clicked/ajax
  • Requests with SQL keywords in parameters

Network Indicators:

  • Unusual traffic patterns to /campaigns/clicked/ajax endpoint
  • Requests containing SQL injection payloads

SIEM Query:

source="mailtrain" AND (url="/campaigns/clicked/ajax" AND (param="column" AND value CONTAINS "UNION" OR value CONTAINS "SELECT" OR value CONTAINS "--"))

🔗 References

📤 Share & Export