CVE-2021-31556

9.8 CRITICAL

📋 TL;DR

This vulnerability in MediaWiki's OAuth extension allows attackers to cause denial of service or potentially execute arbitrary code by submitting RSA keys that exceed MySQL blob storage limits. It affects MediaWiki installations with the OAuth extension enabled through version 1.35.2. The high CVSS score reflects the potential for remote code execution.

💻 Affected Systems

Products:
  • MediaWiki with OAuth extension
Versions: MediaWiki through 1.35.2
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects installations with the OAuth extension enabled and configured.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, data exfiltration, or ransomware deployment.

🟠

Likely Case

Denial of service causing MediaWiki instance unavailability, potentially corrupting database entries.

🟢

If Mitigated

Limited impact with proper input validation and database constraints in place.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires OAuth consumer registration access, which typically requires some level of authentication.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: MediaWiki 1.35.3 or later

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

Restart Required: No

Instructions:

1. Update MediaWiki to version 1.35.3 or later. 2. Update the OAuth extension if installed separately. 3. Verify the patch is applied by checking the MWOAuthConsumerSubmitControl.php file.

🔧 Temporary Workarounds

Disable OAuth extension

all

Temporarily disable the OAuth extension if not required

Edit LocalSettings.php and comment out or remove: wfLoadExtension('OAuth');

Database constraint enforcement

linux

Add MySQL/MariaDB constraints to limit blob field sizes

ALTER TABLE oauth_registered_consumer MODIFY oauth_rsa_key BLOB(65535);

🧯 If You Can't Patch

  • Implement strict input validation for RSA key submissions
  • Restrict OAuth consumer registration to trusted administrators only

🔍 How to Verify

Check if Vulnerable:

Check MediaWiki version and OAuth extension status. If version <= 1.35.2 and OAuth enabled, system is vulnerable.

Check Version:

grep 'wgVersion' includes/DefaultSettings.php

Verify Fix Applied:

Verify MediaWiki version is >= 1.35.3 and check that MWOAuthConsumerSubmitControl.php includes proper length validation.

📡 Detection & Monitoring

Log Indicators:

  • Database errors related to blob overflow
  • OAuth consumer registration attempts with unusually large RSA keys

Network Indicators:

  • HTTP POST requests to OAuth registration endpoints with large payloads

SIEM Query:

source="mediawiki.log" AND ("blob overflow" OR "OAuth consumer submit" AND size>65535)

🔗 References

📤 Share & Export