CVE-2024-40400

8.8 HIGH

📋 TL;DR

This vulnerability allows attackers to upload malicious files through Automad's image upload function, potentially leading to remote code execution. Any Automad v2.0.0 installation with the vulnerable image upload feature enabled is affected. Attackers can compromise the entire web server if successful.

💻 Affected Systems

Products:
  • Automad
Versions: v2.0.0
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects installations with image upload functionality enabled and accessible.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete server compromise allowing attackers to execute arbitrary commands, steal data, install backdoors, or pivot to internal networks.

🟠

Likely Case

Webshell deployment leading to data theft, defacement, or use as a foothold for further attacks.

🟢

If Mitigated

File upload blocked or sanitized, preventing malicious file execution while maintaining legitimate image upload functionality.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Exploitation requires access to the image upload function, which may require authentication depending on configuration.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: v2.0.1 or later

Vendor Advisory: https://github.com/marcantondahmen/automad/issues/106

Restart Required: No

Instructions:

1. Backup your Automad installation and database. 2. Download the latest version from the official repository. 3. Replace all files except your data directory. 4. Clear any cached files. 5. Verify the upload functionality works with legitimate images.

🔧 Temporary Workarounds

Disable Image Upload

all

Temporarily disable the vulnerable image upload functionality

Modify Automad configuration to remove or disable image upload endpoints

Web Server File Restriction

linux

Configure web server to block execution of uploaded files

For Apache: Add 'php_flag engine off' to upload directory .htaccess
For Nginx: Add 'location ~* \.(php|phtml)$ { deny all; }' to upload directory

🧯 If You Can't Patch

  • Implement strict file type validation (whitelist .jpg, .png, .gif only)
  • Use web application firewall to block malicious file upload patterns

🔍 How to Verify

Check if Vulnerable:

Check if Automad version is exactly 2.0.0 and image upload is accessible

Check Version:

Check Automad version in admin panel or read composer.json version field

Verify Fix Applied:

Attempt to upload a file with PHP extension - should be rejected or not execute

📡 Detection & Monitoring

Log Indicators:

  • Unusual file uploads with non-image extensions
  • Multiple failed upload attempts
  • Uploads to unexpected directories

Network Indicators:

  • POST requests to upload endpoints with suspicious file contents
  • Unusual outbound connections after file uploads

SIEM Query:

source="web_server" AND (uri_path="*upload*" OR uri_path="*image*upload*") AND (file_extension="php" OR file_extension="phtml" OR file_extension="jsp")

🔗 References

📤 Share & Export