CVE-2021-41799

7.5 HIGH

📋 TL;DR

CVE-2021-41799 is a denial-of-service vulnerability in MediaWiki's ApiQueryBacklinks feature that allows attackers to trigger full table scans, consuming excessive database resources and causing service degradation. This affects MediaWiki instances before version 1.36.2. Any MediaWiki installation with the vulnerable version is susceptible to resource exhaustion attacks.

💻 Affected Systems

Products:
  • MediaWiki
Versions: All versions before 1.36.2
Operating Systems: All operating systems running MediaWiki
Default Config Vulnerable: ⚠️ Yes
Notes: Affects any MediaWiki installation with the ApiQueryBacklinks feature enabled (default configuration).

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete service unavailability due to database resource exhaustion, potentially affecting all users and requiring database restart or server reboot.

🟠

Likely Case

Significant performance degradation, slow page loads, and intermittent service disruptions affecting user experience.

🟢

If Mitigated

Minimal impact with proper rate limiting, query optimization, and monitoring in place.

🌐 Internet-Facing: HIGH - The vulnerable API endpoint is typically accessible to internet users, making it easy to exploit.
🏢 Internal Only: MEDIUM - Internal users could still exploit this, but attack surface is smaller than internet-facing.

🎯 Exploit Status

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

Exploitation requires only HTTP requests to the vulnerable API endpoint with crafted parameters.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: MediaWiki 1.36.2 and later

Vendor Advisory: https://phabricator.wikimedia.org/T290394

Restart Required: No

Instructions:

1. Backup your MediaWiki installation and database. 2. Update MediaWiki to version 1.36.2 or later. 3. Clear caches if necessary. 4. Verify the update was successful.

🔧 Temporary Workarounds

Disable ApiQueryBacklinks

all

Temporarily disable the vulnerable API endpoint to prevent exploitation

Edit LocalSettings.php and add: $wgAPIListModules['backlinks'] = false;

Implement Rate Limiting

all

Add rate limiting to API queries to prevent resource exhaustion

Edit LocalSettings.php and configure: $wgRateLimits['action']['query'] = ['user' => [100, 60]];

🧯 If You Can't Patch

  • Implement strict rate limiting on API endpoints
  • Monitor database performance and set alerts for unusual query patterns

🔍 How to Verify

Check if Vulnerable:

Check MediaWiki version in includes/DefaultSettings.php or via Special:Version page. If version is below 1.36.2, you are vulnerable.

Check Version:

grep 'wgVersion' includes/DefaultSettings.php

Verify Fix Applied:

After updating, verify version is 1.36.2 or higher via Special:Version page and test ApiQueryBacklinks with monitoring to ensure no full table scans occur.

📡 Detection & Monitoring

Log Indicators:

  • Unusually long query execution times in database logs
  • High frequency of API requests to action=query&list=backlinks
  • Database connection pool exhaustion alerts

Network Indicators:

  • High volume of requests to /api.php with backlinks parameters
  • Increased response times for API queries

SIEM Query:

source="apache_access.log" AND uri="/api.php" AND query="*list=backlinks*" | stats count by src_ip

🔗 References

📤 Share & Export