CVE-2020-12827

7.2 HIGH

📋 TL;DR

CVE-2020-12827 is a path traversal vulnerability in MJML email framework versions prior to 4.6.3. Attackers can exploit the mj-include directive to read arbitrary files on the server. This affects any application using vulnerable MJML versions to process user-controlled MJML templates.

💻 Affected Systems

Products:
  • MJML
Versions: All versions prior to 4.6.3
Operating Systems: All operating systems running MJML
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications that process user-controlled MJML templates using the mj-include directive.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete server compromise through reading sensitive files like configuration files, SSH keys, or database credentials, potentially leading to lateral movement and data exfiltration.

🟠

Likely Case

Unauthorized file disclosure including source code, configuration files, or sensitive user data stored on the server.

🟢

If Mitigated

Limited impact with proper input validation and file system permissions restricting access to sensitive directories.

🌐 Internet-Facing: HIGH - Any internet-facing application processing user-submitted MJML templates is vulnerable to exploitation.
🏢 Internal Only: MEDIUM - Internal applications could still be exploited by authenticated users or through other attack vectors.

🎯 Exploit Status

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

Public proof-of-concept available in Packet Storm Security disclosure. Exploitation requires ability to submit MJML templates for processing.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 4.6.3

Vendor Advisory: https://github.com/mjmlio/mjml/releases/tag/v4.6.3

Restart Required: No

Instructions:

1. Update MJML to version 4.6.3 or later using npm: npm update mjml
2. Verify the update with: npm list mjml
3. Test MJML template processing functionality

🔧 Temporary Workarounds

Input Validation

all

Implement strict validation on mj-include paths to prevent directory traversal sequences

File System Restrictions

all

Run MJML in a sandboxed environment with restricted file system access

🧯 If You Can't Patch

  • Disable mj-include directive processing for user-controlled templates
  • Implement web application firewall rules to block path traversal patterns in MJML input

🔍 How to Verify

Check if Vulnerable:

Check MJML version: npm list mjml | grep mjml. If version is below 4.6.3, system is vulnerable.

Check Version:

npm list mjml | grep mjml

Verify Fix Applied:

After updating, verify version is 4.6.3 or higher: npm list mjml | grep mjml

📡 Detection & Monitoring

Log Indicators:

  • Unusual file access patterns in MJML processing logs
  • Multiple failed attempts to access restricted files

Network Indicators:

  • HTTP requests containing path traversal sequences in MJML payloads

SIEM Query:

source="mjml_logs" AND (path="../" OR path="..\\" OR path="%2e%2e%2f")

🔗 References

📤 Share & Export