CVE-2022-21235: Command Injection in github.com/Masterminds/vcs

github.com/Masterminds/vcs Updated 02 Oct 2025

Summary

01/07/2022
Yes i
Critical
9.8

CVE-2022-21235: Command injection in github.com/Masterminds/vcs. Affects github.com/Masterminds/vcs versions < 1.13.3. Fixed in 1.13.3. 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 Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The github.com/Masterminds/vcs package is a Go library that provides functionality for interacting with version control systems (VCS) such as Git, Mercurial, Bazaar, and Subversion. It allows users to perform various VCS operations like cloning repositories, fetching updates, and exporting directories. However, a vulnerability has been discovered in the package that allows for command injection attacks.

Vulnerability Detail

The vulnerability in github.com/Masterminds/vcs arises from the package's handling of user-provided arguments when executing VCS commands. These arguments can be interpreted as command-line flags, which can be manipulated by an attacker to inject arbitrary commands. This can lead to unauthorized execution of commands on the system where the vulnerable code is running. The impact of this vulnerability can range from unauthorized data access to complete compromise of the system.

How To Fix

Latest published version: v1.13.3 as of 22 Oct 2026

go get github.com/Masterminds/vcs@v1.13.3

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.13.3

This is the first release that contains the fix.

go get github.com/Masterminds/vcs@v1.13.3

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a workaround, developers can manually sanitize and validate user-provided inputs before passing them to VCS functions. This involves checking for any potentially malicious characters or command sequences and rejecting or sanitizing them. Here's an example of how this can be done in Go:

import (
	"os/exec"
	"strings"
)

func sanitizeInput(input string) string {
	// Remove any potentially malicious characters
	sanitized := strings.ReplaceAll(input, "&", "")
	// Sanitize any command sequences
	sanitized = strings.ReplaceAll(sanitized, ";", "")
	return sanitized
}

func main() {
	userInput := getUserInput()
	sanitizedInput := sanitizeInput(userInput)
	// Pass the sanitized input to VCS functions
	vcs.Get(sanitizedInput)
}

Conclusion

The github.com/Masterminds/vcs package is vulnerable to command injection, which can lead to unauthorized command execution and potential compromise of the system. Developers should update to version 1.13.3 or later to fix this vulnerability. Additionally, proper input validation and sanitization should be implemented to prevent command injection attacks. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for github.com/Masterminds/vcs →

Share this vulnerability

FAQ

The impact of this vulnerability can range from unauthorized data access to complete compromise of the system where the vulnerable code is running. Attackers can execute arbitrary commands, potentially leading to data leaks, unauthorized modifications, or even remote code execution.

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply provide your Gopkg.lock file, and Vulert will analyze it to identify any vulnerable dependencies.

At the time of this report, there are no known public exploits for this vulnerability. However, it is important to apply the recommended fix as soon as possible to mitigate the risk of potential attacks.

While it is strongly recommended to update to the fixed version of the github.com/Masterminds/vcs package, you can mitigate the vulnerability by manually sanitizing and validating user-provided inputs before passing them to VCS functions. Refer to the provided workaround section for an example of how this can be done.

This vulnerability was discovered by Alessio Della Libera of the Snyk Research Team.

References

How To Fix

Latest published version: v1.13.3 as of 22 Oct 2026

go get github.com/Masterminds/vcs@v1.13.3

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.13.3

This is the first release that contains the fix.

go get github.com/Masterminds/vcs@v1.13.3

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