CVE-2021-31607: Command Injection in SaltStack Salt
Summary
CVE-2021-31607: Command Injection in SaltStack Salt. Affects salt versions >= 2016.11.0, < 3003rc1. Fixed in 3003rc1. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
SaltStack Salt is a popular configuration management and remote execution tool used for managing and securing large-scale infrastructure. It allows administrators to automate the deployment and configuration of software across multiple systems. However, a vulnerability has been discovered in versions 2016.9 through 3002.6 of SaltStack Salt that can lead to command injection and local privilege escalation on a minion. This vulnerability specifically affects the snapper module, which is responsible for managing file snapshots. By creating a file with a pathname that is backed up by snapper and exploiting the snapper.diff function, an attacker can execute arbitrary commands with elevated privileges.
Vulnerability Detail
The command injection vulnerability in SaltStack Salt allows an attacker to execute arbitrary commands with elevated privileges on a minion. To exploit this vulnerability, the attacker needs to create a file with a pathname that is backed up by snapper and trigger the snapper.diff function from the master. The snapper.diff function executes popen unsafely, allowing the attacker to inject malicious commands. This can lead to local privilege escalation, enabling the attacker to gain full control over the affected system. The severity of this vulnerability is rated as HIGH with a CVSS score of 7.8.
How To Fix
Latest published version: 3008.3.0 as of 22 Oct 2026
pip install --upgrade "salt==3008.3.0"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
3003rc1
This is the first release that contains the fix.
pip install --upgrade "salt==3003rc1"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If upgrading to a fixed version is not immediately possible, a temporary workaround is to disable or restrict access to the snapper module in SaltStack Salt. By preventing the execution of the snapper.diff function, the command injection vulnerability can be mitigated. However, this workaround may impact the functionality of the snapper module and should only be considered as a temporary solution until the system can be upgraded to a fixed version.
Conclusion
In conclusion, the command injection vulnerability in SaltStack Salt can lead to local privilege escalation on a minion. It is crucial to upgrade to a fixed version of SaltStack Salt (version 3003rc1 or later) to mitigate this vulnerability. If immediate upgrading is not possible, disabling or restricting access to the snapper module can serve as a temporary workaround. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for salt →
FAQ
SaltStack Salt is a configuration management and remote execution tool used for managing and securing large-scale infrastructure. It allows administrators to automate the deployment and configuration of software across multiple systems.
This vulnerability allows an attacker to execute arbitrary commands with elevated privileges on a minion. By exploiting the command injection vulnerability, the attacker can gain full control over the affected system and potentially escalate their privileges.
To fix this vulnerability, it is recommended to upgrade to a fixed version of SaltStack Salt. The vulnerability has been addressed in version 3003rc1 and later. Upgrading to the latest version will ensure that the vulnerable code is patched and the command injection vulnerability is mitigated.
If upgrading to a fixed version is not immediately possible, a temporary workaround is to disable or restrict access to the snapper module in SaltStack Salt. By preventing the execution of the snapper.diff function, the command injection vulnerability can be mitigated. However, this workaround may impact the functionality of the snapper module and should only be considered as a temporary solution until the system can be upgraded to a fixed version.
Yes, the CVSS score for this vulnerability is 7.8, indicating a high severity.
Related vulnerabilities
Recent vulnerabilities recorded for salt.