CVE-2024-7857

9.8 CRITICAL

📋 TL;DR

The Media Library Folders WordPress plugin has a second-order SQL injection vulnerability that allows authenticated attackers with subscriber-level access or higher to inject malicious SQL queries. This can lead to extraction of sensitive database information like user credentials or site data. All WordPress sites using this plugin up to version 8.2.2 are affected.

💻 Affected Systems

Products:
  • Media Library Folders WordPress plugin
Versions: All versions up to and including 8.2.2
Operating Systems: Any OS running WordPress
Default Config Vulnerable: ⚠️ Yes
Notes: Requires authenticated user with at least subscriber-level permissions. WordPress sites with the vulnerable plugin installed are affected regardless of other configurations.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete database compromise including extraction of administrator credentials, user data, and site content, potentially leading to full site takeover and data exfiltration.

🟠

Likely Case

Extraction of sensitive information from the WordPress database including user credentials, plugin settings, and potentially other site data stored in the database.

🟢

If Mitigated

Limited impact if proper input validation and prepared statements are implemented, restricting attackers to data extraction only within the plugin's database context.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires authenticated access but the SQL injection is straightforward once authenticated. The vulnerability is well-documented with specific parameter and function details available.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 8.2.3 or later

Vendor Advisory: https://plugins.trac.wordpress.org/changeset/3139954/media-library-plus/trunk/media-library-plus.php

Restart Required: No

Instructions:

1. Log into WordPress admin panel. 2. Navigate to Plugins → Installed Plugins. 3. Find Media Library Folders plugin. 4. Click 'Update Now' if update is available. 5. Alternatively, download version 8.2.3+ from WordPress plugin repository and manually update.

🔧 Temporary Workarounds

Disable vulnerable AJAX endpoint

all

Remove or restrict access to the vulnerable mlf_change_sort_type AJAX action

Add to theme's functions.php or custom plugin: remove_action('wp_ajax_mlf_change_sort_type', 'mlf_change_sort_type'); remove_action('wp_ajax_nopriv_mlf_change_sort_type', 'mlf_change_sort_type');

Input validation filter

all

Add input validation for the sort_type parameter before it reaches the vulnerable function

Add to theme's functions.php: add_filter('pre_mlf_change_sort_type', function($sort_type) { return in_array($sort_type, ['asc', 'desc', 'name', 'date']) ? $sort_type : 'name'; });

🧯 If You Can't Patch

  • Temporarily deactivate the Media Library Folders plugin until patched
  • Implement strict user access controls and monitor for suspicious database queries from subscriber-level accounts

🔍 How to Verify

Check if Vulnerable:

Check WordPress admin → Plugins → Installed Plugins for Media Library Folders version 8.2.2 or earlier

Check Version:

wp plugin list --name='Media Library Folders' --field=version

Verify Fix Applied:

Verify plugin version is 8.2.3 or later in WordPress admin panel

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL queries in WordPress debug logs
  • Multiple AJAX requests to admin-ajax.php with mlf_change_sort_type action
  • Database queries with unusual ORDER BY clauses from subscriber accounts

Network Indicators:

  • POST requests to /wp-admin/admin-ajax.php with action=mlf_change_sort_type containing SQL injection patterns
  • Unusual database response sizes from WordPress backend

SIEM Query:

source="wordpress.log" AND "admin-ajax.php" AND "mlf_change_sort_type" AND ("UNION" OR "SELECT" OR "FROM" OR "WHERE" OR "ORDER BY")

🔗 References

📤 Share & Export