Vulnerabilities in pkg:golang/github.com/Masterminds/vcs
PACKAGECVE-2022-21235 is a CRITICAL (CVSS 9.8) command injection vulnerability with mercurial vulnerability (CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')) affecting Github.com/Masterminds/vcs libraries in the Go ecosystem. The issue involves command injection vulnerability with mercurial in vcs. Remediation is available by upgrading affected packages to version 1.13.2.
pkg:golang/github.com/Masterminds/vcs
Vulnerability advisories affecting package pkg:golang/github.com/Masterminds/vcs. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-6635-c626-vj4r | CVE-2022-21235 | CRITICAL | Command Injection Vulnerability with Mercurial in VCS |
CVE-2022-21235 at a Glance
Security Impact
CVSS: 9.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2022-21235
To remediate this vulnerability, upgrade all affected Github.com/Masterminds/vcs dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/Masterminds/vcs to 1.13.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/Masterminds/vcs
How to Check if You Are Affected
To determine whether your application is affected by CVE-2022-21235, inspect your project dependencies for Github.com/Masterminds/vcs:
inspect dependencies for github.com/Masterminds/vcs
Analyze the terminal output to locate any version of Github.com/Masterminds/vcs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.13.2), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection'), where the product constructs a string for a command to be executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string. In Github.com/Masterminds/vcs, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2022-21235 Affected Github.com/Masterminds/vcs Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/Masterminds/vcs
|
Go |
< 1.13.2
|
1.13.2
|
References
Frequently Asked Questions
What is CVE-2022-21235?
Which Github.com/Masterminds/vcs versions are affected?
What version fixes CVE-2022-21235?
Is github.com/Masterminds/vcs affected?
What is the CVSS score of CVE-2022-21235?
What CWE is associated with CVE-2022-21235?
How can I check Go dependencies for CVE-2022-21235?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-6635-c626-vj4r",
"modified" : "2024-05-20T21:29:38Z",
"published" : "2022-04-01T14:05:33Z",
"aliases" : [ "CVE-2022-21235" ],
"summary" : "Command Injection Vulnerability with Mercurial in VCS",
"details" : "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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/Masterminds/vcs"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.13.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/Masterminds/vcs/security/advisories/GHSA-6635-c626-vj4r"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-21235"
}, {
"type" : "WEB",
"url" : "https://github.com/Masterminds/vcs/pull/105"
}, {
"type" : "WEB",
"url" : "https://github.com/Masterminds/vcs/commit/922a5122330ea8fbe56352a0172ddb6bf019cd22"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/Masterminds/vcs"
}, {
"type" : "WEB",
"url" : "https://github.com/Masterminds/vcs/releases/tag/v1.13.2"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-GOLANG-GITHUBCOMMASTERMINDSVCS-2437078"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-77", "CWE-88" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2022-04-01T14:05:33Z",
"nvd_published_at" : "2022-04-01T16:15:00Z"
}
}