CVE-2022-21235 is a high-severity (CVSS 8.1) CWE-88 vulnerability in github.com/Masterminds/vcs. A fix is available for github.com/Masterminds/vcs — see the affected versions and patch details below.
Command Injection
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
github.com/Masterminds/vcsReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.
Description
URLs and local file paths passed to the Mercurial (hg) APIs that are specially crafted can contain commands which are executed by Mercurial if it is installed on the host operating system. The vcs package uses the underly version control system, in this case hg, to implement the needed functionality. When hg is executed, argument strings are passed to hg in a way that additional flags can be set. The additional flags can be used to perform a command injection. Other version control systems with an implemented interface may also be vulnerable. The issue has been fixed in version 1.13.2. A work around is to sanitize data passed to the vcs package APIs to ensure it does not contain commands or unexpected data. This is important for user input data that is passed directly to the package APIs.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐹Go | github.com/Masterminds/vcs | all versions | 1.13.2go get github.com/Masterminds/vcs@v1.13.2 |
Affected Products
vcsvcs_projectDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for github.com/Masterminds/vcs, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update github.com/Masterminds/vcs to 1.13.2 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2022-21235 is resolved across your whole dependency graph.
Workarounds
Stop passing untrusted input into the interpreter or shell: call the affected binary with an argument array rather than a composed command string, reject anything outside a strict allowlist of expected values, and run the component under an account that cannot reach beyond the work it legitimately does.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
In Red Hat OpenStack, the 'github.com/Masterminds/vcs' is a transitive dependency and is not used by operators directly which reduces the chances for successful exploitation. Hence, the impact for OpenStack is reduced to moderate.
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat OpenShift Container Platform 4.11 | openshift4/ose-agent-installer-csr-approver-rhel8:v4.11.0-202307072028.p0.gaa46748.assembly.stream | RHSA-2023:4053 |
| Red Hat OpenStack Platform 16.2 | rhosp-rhel8/osp-director-operator:1.3.0-8 | RHSA-2023:4694 |
| Red Hat OpenStack Platform 17.1 for RHEL 9 | rhosp-rhel9/osp-director-agent:1.3.1-10 | RHSA-2023:4582 |
Frequently Asked Questions
Is CVE-2022-21235 in your dependencies?
Find it across Go, including transitive dependencies.