Skip to content

Command Injection Vulnerability with Mercurial in VCS

Critical severity GitHub Reviewed Published Mar 30, 2022 in Masterminds/vcs • Updated May 20, 2024

Package

gomod github.com/Masterminds/vcs (Go)

Affected versions

< 1.13.2

Patched versions

1.13.2

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.

References

@mattfarina mattfarina published to Masterminds/vcs Mar 30, 2022
Published to the GitHub Advisory Database Apr 1, 2022
Reviewed Apr 1, 2022
Published by the National Vulnerability Database Apr 1, 2022
Last updated May 20, 2024

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

EPSS score

0.131%
(49th percentile)

CVE ID

CVE-2022-21235

GHSA ID

GHSA-6635-c626-vj4r

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.