CVE-2021-38296

7.5 HIGH

📋 TL;DR

This vulnerability in Apache Spark allows attackers to recover full encryption keys from RPC connections using a flawed mutual authentication protocol. After an initial interactive attack, attackers can decrypt previously captured encrypted traffic offline. This affects Apache Spark deployments using RPC encryption with versions 3.1.2 and earlier.

💻 Affected Systems

Products:
  • Apache Spark
Versions: 3.1.2 and earlier
Operating Systems: All
Default Config Vulnerable: ✅ No
Notes: Only affects systems with spark.authenticate and spark.network.crypto.enabled configured for RPC encryption. Does not affect SASL encryption, SSL, or other security mechanisms.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers gain full access to decrypt all RPC communications, potentially exposing sensitive data, credentials, and internal system information transmitted between Spark components.

🟠

Likely Case

Attackers with network access can intercept and decrypt RPC traffic, potentially gaining access to job data, configuration details, and authentication information.

🟢

If Mitigated

With proper network segmentation and access controls, the attack surface is limited, but vulnerable systems remain at risk of traffic decryption if attackers gain initial access.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Requires initial interactive attack to capture traffic, followed by offline key recovery. Attack complexity is moderate due to the need for network access and traffic interception.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Apache Spark 3.1.3 or later

Vendor Advisory: https://lists.apache.org/thread/70x8fw2gx3g9ty7yk0f2f1dlpqml2smd

Restart Required: Yes

Instructions:

1. Download Apache Spark 3.1.3 or later from official Apache repository. 2. Stop all Spark services. 3. Replace existing Spark installation with patched version. 4. Restart Spark services. 5. Verify configuration settings remain intact.

🔧 Temporary Workarounds

Disable RPC Encryption

all

Disable the vulnerable RPC encryption mechanism while maintaining other security controls

Set spark.authenticate=false and spark.network.crypto.enabled=false in spark-defaults.conf

Use Alternative Encryption

all

Enable SASL encryption instead of the vulnerable RPC encryption

Set spark.authenticate.enableSaslEncryption=true in spark-defaults.conf

🧯 If You Can't Patch

  • Implement strict network segmentation to isolate Spark clusters from untrusted networks
  • Monitor network traffic for unusual RPC communication patterns and implement intrusion detection

🔍 How to Verify

Check if Vulnerable:

Check Spark version and configuration: if version ≤ 3.1.2 AND spark.authenticate=true AND spark.network.crypto.enabled=true, system is vulnerable

Check Version:

spark-submit --version | grep 'version'

Verify Fix Applied:

Verify Spark version is ≥ 3.1.3 and confirm RPC encryption settings are properly configured

📡 Detection & Monitoring

Log Indicators:

  • Failed authentication attempts on RPC ports
  • Unusual RPC connection patterns

Network Indicators:

  • Unusual traffic patterns on Spark RPC ports (default 7077)
  • Multiple failed handshake attempts

SIEM Query:

source="spark*" AND (event_type="authentication_failure" OR port=7077) | stats count by src_ip

🔗 References

📤 Share & Export