CVE-2020-13921

9.8 CRITICAL

📋 TL;DR

This SQL injection vulnerability in Apache SkyWalking allows attackers to execute arbitrary SQL commands when using H2, MySQL, or TiDB as storage backends. It specifically affects wildcard query functionality, potentially leading to data theft, modification, or complete system compromise. Only deployments using these specific database backends are affected.

💻 Affected Systems

Products:
  • Apache SkyWalking
Versions: Versions prior to 8.1.0
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects deployments using H2, MySQL, or TiDB as storage backends. PostgreSQL and Elasticsearch backends are not affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete database compromise allowing data exfiltration, modification, or deletion; potential remote code execution depending on database configuration and privileges.

🟠

Likely Case

Unauthorized data access and potential data manipulation within the SkyWalking database.

🟢

If Mitigated

Limited impact with proper network segmentation, database user privilege restrictions, and input validation in place.

🌐 Internet-Facing: HIGH if SkyWalking API endpoints are exposed to untrusted networks without authentication.
🏢 Internal Only: MEDIUM as it still requires attacker access to internal networks or compromised accounts.

🎯 Exploit Status

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

SQL injection vulnerabilities typically have low exploitation complexity. The vulnerability is in wildcard query functionality which may require specific API access.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 8.1.0 and later

Vendor Advisory: https://lists.apache.org/thread.html/r6f3a934ebc54585d8468151a494c1919dc1ee2cccaf237ec434dbbd6%40%3Cdev.skywalking.apache.org%3E

Restart Required: Yes

Instructions:

1. Upgrade to SkyWalking 8.1.0 or later. 2. Stop SkyWalking services. 3. Replace with patched version. 4. Restart services. 5. Verify functionality.

🔧 Temporary Workarounds

Database User Privilege Restriction

all

Limit database user permissions to minimum required operations

-- Example MySQL command: REVOKE ALL PRIVILEGES ON skywalking.* FROM 'skywalking_user'@'%';
-- GRANT SELECT, INSERT, UPDATE, DELETE ON skywalking.* TO 'skywalking_user'@'%';

Network Access Control

linux

Restrict access to SkyWalking API endpoints

# Example iptables rule: iptables -A INPUT -p tcp --dport 12800 -s trusted_network -j ACCEPT
# iptables -A INPUT -p tcp --dport 12800 -j DROP

🧯 If You Can't Patch

  • Switch to PostgreSQL or Elasticsearch storage backends which are not vulnerable
  • Implement Web Application Firewall (WAF) with SQL injection protection rules

🔍 How to Verify

Check if Vulnerable:

Check SkyWalking version and storage backend configuration. Vulnerable if version < 8.1.0 AND using H2/MySQL/TiDB backend.

Check Version:

Check SkyWalking OAP server logs or configuration files for version information

Verify Fix Applied:

Confirm SkyWalking version is 8.1.0 or later and test wildcard query functionality.

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL query patterns in database logs
  • Multiple failed wildcard query attempts
  • Unexpected database error messages

Network Indicators:

  • Unusual traffic patterns to SkyWalking API endpoints
  • SQL injection patterns in HTTP requests

SIEM Query:

source="skywalking.logs" AND ("SQL error" OR "syntax error" OR "wildcard query")

🔗 References

📤 Share & Export