CVE-2021-31607: Command Injection in SaltStack Salt

salt Updated 02 Oct 2025

Summary

24/05/2022
Yes i
High
7.8

CVE-2021-31607: Command Injection in SaltStack Salt. Affects salt versions >= 2016.11.0, < 3003rc1. Fixed in 3003rc1. How to fix ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

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 →

Share this vulnerability

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.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback