# CVE-2024-6257: HashiCorp go-getter Vulnerable to Code Execution On Git Update Via Git Config Manipulation

> Attackers can achieve arbitrary code execution by manipulating Git configuration to trigger malicious updates in the HashiCorp go-getter library.

- **Severity:** High 8.4 (`CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 25 Jun 2024
- **Updated:** 1 Aug 2024
- **Also known as:** AZL-42982, BELL-CVE-2024-6257, DEBIAN-CVE-2024-6257, GHSA-xfhp-jf8p-mh5w, GO-2024-2948, ROOT-APP-GOBINARY-CVE-2024-6257, UBUNTU-CVE-2024-6257, openSUSE-SU-2024:14183-1, openSUSE-SU-2024:14190-1

## What is CVE-2024-6257?

CVE-2024-6257 is a high-severity command injection vulnerability in HashiCorp Shared library, published on 25 Jun 2024. An attacker needs administrator access to exploit it, and only if a user opens a file or follows a link.

### Official description

HashiCorp’s go-getter library can be coerced into executing Git update on an existing maliciously modified Git Configuration, potentially leading to arbitrary code execution.

Weakness: CWE-77 (Improper Neutralization of Special Elements used in a Command)

## Which versions are affected by CVE-2024-6257?

3 open source packages ship an affected version, including github.com/hashicorp/go-getter. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/hashicorp/go-getter` | Go | All versions | 1.7.5 |
| `github.com/hashicorp/go-getter` | Go | All versions | 1.7.5 |
| `github.com/hashicorp/go-getter` | Go | All versions | 1.7.5 |
| `conftest` | openSUSE:Tumbleweed | All versions | 0.54.0-1.1 |
| `trivy` | openSUSE:Tumbleweed | All versions | 0.53.0-1.1 |

Products: Hashicorp Go-Getter.

## How do I fix CVE-2024-6257?

Upgrade github.com/hashicorp/go-getter to 1.7.5 or later.

## Is CVE-2024-6257 being exploited?

There is no known exploitation of CVE-2024-6257 in the wild and no public exploit code.

## Other vulnerabilities in HashiCorp Shared library

- [CVE-2024-3817](https://insights.sbomify.com/CVE-2024-3817/): HashiCorp go-getter Vulnerable to Argument Injection When Fetching Remote Default Git Branches (critical 9.8)
- [CVE-2022-26945](https://insights.sbomify.com/CVE-2022-26945/): Server-side request forgery in n/a (critical 9.8)
- [CVE-2022-30321](https://insights.sbomify.com/CVE-2022-30321/): Path traversal in n/a (high 8.6)
- [CVE-2022-30322](https://insights.sbomify.com/CVE-2022-30322/): Denial of service in n/a (high 8.6)
- [CVE-2022-30323](https://insights.sbomify.com/CVE-2022-30323/): Denial of service in n/a (high 8.6)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-6257 and fix it if it is affected.

What it is: CVE-2024-6257 is a high-severity command injection vulnerability in HashiCorp Shared library, published on 25 Jun 2024. An attacker needs administrator access to exploit it, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2024-6257 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/hashicorp/go-getter (Go): affected all versions; fixed in 1.7.5
- github.com/hashicorp/go-getter (Go): affected all versions; fixed in 1.7.5
- github.com/hashicorp/go-getter (Go): affected all versions; fixed in 1.7.5

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-6257/ (Markdown: https://insights.sbomify.com/CVE-2024-6257/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-6257
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-6257
- OSV: https://osv.dev/vulnerability/CVE-2024-6257

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-6257/
Summaries are generated and may contain mistakes; the official description above is the record.
