CVE-2021-42343

9.8 CRITICAL

📋 TL;DR

This vulnerability in Dask distributed package allows remote code execution when Dask clusters are configured to listen on external interfaces instead of localhost only. It affects users running single-machine Dask clusters with LocalCluster or Client defaults. Sophisticated attackers can exploit exposed ports to execute arbitrary code on vulnerable systems.

💻 Affected Systems

Products:
  • Dask distributed package for Python
Versions: All versions before 2021.10.0
Operating Systems: All operating systems running Python
Default Config Vulnerable: ⚠️ Yes
Notes: Affects single-machine Dask clusters started with dask.distributed.LocalCluster or dask.distributed.Client (which defaults to LocalCluster). Only vulnerable when running on machines with applicable ports exposed.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise with remote code execution leading to data theft, lateral movement, and complete control of affected systems.

🟠

Likely Case

Unauthorized access to Dask worker processes enabling data exfiltration, resource hijacking for cryptocurrency mining, or deployment of additional malware.

🟢

If Mitigated

Limited impact with proper network segmentation and firewall rules preventing external access to Dask worker ports.

🌐 Internet-Facing: HIGH - Systems with exposed Dask worker ports are directly vulnerable to remote exploitation without authentication.
🏢 Internal Only: MEDIUM - Internal systems could still be vulnerable to lateral movement attacks if network segmentation is weak.

🎯 Exploit Status

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

Exploitation requires network access to exposed Dask worker ports. The vulnerability is well-documented in security advisories.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 2021.10.0 and later

Vendor Advisory: https://github.com/dask/distributed/security/advisories/GHSA-hwqr-f3v9-hwxr

Restart Required: Yes

Instructions:

1. Update Dask distributed package using pip: pip install --upgrade dask-distributed>=2021.10.0
2. Restart all Dask clusters and worker processes
3. Verify the fix by checking that workers only bind to localhost

🔧 Temporary Workarounds

Explicitly bind to localhost

all

Configure Dask clusters to bind only to localhost interface

from dask.distributed import LocalCluster, Client
cluster = LocalCluster(host='127.0.0.1')
client = Client(cluster)

Firewall blocking

linux

Block external access to Dask worker ports using firewall rules

# Linux iptables example
iptables -A INPUT -p tcp --dport 30000:50000 -j DROP
# Adjust port range based on your Dask configuration

🧯 If You Can't Patch

  • Implement strict network segmentation to isolate Dask clusters from untrusted networks
  • Configure host-based firewalls to block all external access to Dask worker ports

🔍 How to Verify

Check if Vulnerable:

Check Dask distributed version: python -c "import distributed; print(distributed.__version__)" and verify if <2021.10.0. Also check if Dask workers are listening on external interfaces using netstat or ss commands.

Check Version:

python -c "import distributed; print('Dask distributed version:', distributed.__version__)"

Verify Fix Applied:

After patching, verify version is >=2021.10.0 and confirm Dask workers only bind to localhost (127.0.0.1) using netstat -tulpn or ss -tulpn.

📡 Detection & Monitoring

Log Indicators:

  • Unexpected external connections to Dask worker ports
  • Unauthorized access attempts to Dask cluster endpoints

Network Indicators:

  • External traffic to high ports (typically 30000-50000) where Dask workers run
  • Unusual outbound connections from Dask worker processes

SIEM Query:

source_ip IN (external_ips) AND dest_port BETWEEN 30000 AND 50000 AND protocol=tcp

🔗 References

📤 Share & Export