CVE-2021-3197

9.8 CRITICAL

📋 TL;DR

This vulnerability allows remote attackers to execute arbitrary shell commands on SaltStack Salt servers via shell injection in the salt-api SSH client. Attackers can exploit this by including malicious ProxyCommand arguments or ssh_options in API requests. Systems running SaltStack Salt versions before 3002.5 with salt-api enabled are affected.

💻 Affected Systems

Products:
  • SaltStack Salt
Versions: All versions before 3002.5
Operating Systems: Linux, Unix-based systems
Default Config Vulnerable: ⚠️ Yes
Notes: Requires salt-api to be enabled and accessible. The SSH client functionality within salt-api must be exposed.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise allowing attackers to execute arbitrary commands with the privileges of the salt-api service, potentially leading to data theft, lateral movement, or ransomware deployment.

🟠

Likely Case

Unauthorized command execution leading to privilege escalation, data exfiltration, or deployment of backdoors on managed systems.

🟢

If Mitigated

Limited impact if proper network segmentation, API authentication, and input validation are in place, though risk remains significant.

🌐 Internet-Facing: HIGH
🏢 Internal Only: HIGH

🎯 Exploit Status

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

Exploitation requires API access but is straightforward once access is obtained. The vulnerability is well-documented in security advisories.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 3002.5 and later

Vendor Advisory: https://github.com/saltstack/salt/releases

Restart Required: Yes

Instructions:

1. Backup configuration files. 2. Update SaltStack Salt to version 3002.5 or later using your package manager. 3. Restart salt-master and salt-api services. 4. Verify the update was successful.

🔧 Temporary Workarounds

Disable salt-api SSH client

linux

Disable or restrict access to the vulnerable SSH client functionality in salt-api if not required.

# Edit salt master config to disable SSH client
# Set 'ssh_client: False' in /etc/salt/master or equivalent

Restrict API access

linux

Implement network-level restrictions to limit which systems can access salt-api endpoints.

# Use firewall rules to restrict access
iptables -A INPUT -p tcp --dport 8000 -s trusted_network -j ACCEPT
iptables -A INPUT -p tcp --dport 8000 -j DROP

🧯 If You Can't Patch

  • Implement strict network segmentation to isolate SaltStack management interfaces from untrusted networks
  • Enforce strong authentication and authorization controls for salt-api access, including API key rotation and IP whitelisting

🔍 How to Verify

Check if Vulnerable:

Check Salt version: 'salt --versions-report' or 'salt-master --version'. If version is below 3002.5 and salt-api is enabled, the system is vulnerable.

Check Version:

salt --versions-report | grep -i salt

Verify Fix Applied:

After updating, verify version is 3002.5 or higher with 'salt --versions-report'. Test SSH client functionality through salt-api to ensure proper input validation.

📡 Detection & Monitoring

Log Indicators:

  • Unusual SSH client activity in salt-api logs
  • Unexpected ProxyCommand or ssh_options parameters in API requests
  • Failed authentication attempts followed by SSH client usage

Network Indicators:

  • Unusual outbound connections from salt-master to unexpected destinations
  • SSH traffic patterns inconsistent with normal Salt operations

SIEM Query:

source="salt-api" AND ("ProxyCommand" OR "ssh_options") AND status=success

🔗 References

📤 Share & Export