CVE-2021-21030

8.1 HIGH

📋 TL;DR

This stored cross-site scripting (XSS) vulnerability in Magento allows attackers to inject malicious JavaScript into customer address uploads. When exploited, it can execute arbitrary code in victims' browsers, potentially stealing session cookies or performing actions as the user. Magento 2.4.1 and earlier, 2.4.0-p1 and earlier, and 2.3.6 and earlier versions are affected.

💻 Affected Systems

Products:
  • Magento Commerce
  • Magento Open Source
Versions: Magento 2.4.1 and earlier, 2.4.0-p1 and earlier, 2.3.6 and earlier
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Requires user interaction for exploitation. Customer address upload feature must be enabled.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers steal administrator session cookies, gain full control of the Magento admin panel, install backdoors, exfiltrate customer data, or deploy ransomware.

🟠

Likely Case

Attackers steal customer session cookies, perform account takeover, modify orders, or redirect users to phishing sites.

🟢

If Mitigated

Limited to low-privilege user account compromise if proper input validation and output encoding are implemented.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Exploitation requires user interaction (victim must view malicious content). Attackers need customer account access to upload malicious address data.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Magento 2.4.2, 2.4.1-p1, 2.3.7

Vendor Advisory: https://helpx.adobe.com/security/products/magento/apsb21-08.html

Restart Required: Yes

Instructions:

1. Backup your Magento installation and database. 2. Update to Magento 2.4.2, 2.4.1-p1, or 2.3.7 via Composer or Magento Marketplace. 3. Clear cache: bin/magento cache:clean. 4. Reindex: bin/magento indexer:reindex. 5. Verify the update completed successfully.

🔧 Temporary Workarounds

Disable customer address upload feature

all

Temporarily disable the vulnerable customer address upload functionality until patching is possible.

Edit Magento admin panel: Stores > Configuration > Customers > Customer Configuration > Address Templates > Disable file upload

Implement Content Security Policy (CSP)

linux

Add CSP headers to restrict JavaScript execution from untrusted sources.

Add to .htaccess: Header set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"

🧯 If You Can't Patch

  • Implement web application firewall (WAF) rules to block XSS payloads in customer address fields
  • Enable input validation and output encoding for all user-controllable fields in Magento templates

🔍 How to Verify

Check if Vulnerable:

Check Magento version via admin panel or run: php bin/magento --version

Check Version:

php bin/magento --version

Verify Fix Applied:

Verify version is 2.4.2, 2.4.1-p1, or 2.3.7 or later. Test address upload feature with XSS payloads.

📡 Detection & Monitoring

Log Indicators:

  • Unusual file uploads in customer address fields
  • JavaScript payloads in Magento logs
  • Multiple failed login attempts from customer accounts

Network Indicators:

  • Outbound connections to suspicious domains after customer address updates
  • Unusual traffic patterns from Magento admin panel

SIEM Query:

source="magento.log" AND "customer_address" AND ("script" OR "javascript" OR "onerror=" OR "onload=")

🔗 References

📤 Share & Export