GHSA-fqfh-778m-2v32 GitHub CLI can execute a git binary from the current directory

Not scored Published

GitHub CLI on Windows executes a malicious git binary from the current directory, allowing code execution when run in untrusted locations.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is GHSA-fqfh-778m-2v32?

GHSA-fqfh-778m-2v32 is a command injection vulnerability in github.com/cli/cli, published on 11 Feb 2022. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

Official description

Impact

GitHub CLI depends on a git.exe executable being found in system %PATH% on Windows. However, if a malicious .\git.exe or .\git.bat is found in the current working directory at the time of running gh, the malicious command will be invoked instead of the system one.

Windows users who run gh inside untrusted directories are affected.

Patches

Users should upgrade to GitHub CLI v1.2.1.

Workarounds

Other than avoiding untrusted repositories, there is no workaround.

References

https://github.com/golang/go/issues/38736

Which versions are affected by GHSA-fqfh-778m-2v32?

3 open source packages ship an affected version, including github.com/cli/cli.

PackageAffectedFixed in
github.com/cli/cli GoAll versions1.2.1
github.com/cli/cli GoAll versions1.2.1
github.com/cli/cli GoAll versions1.2.1

How do I fix GHSA-fqfh-778m-2v32?

Upgrade github.com/cli/cli to 1.2.1 or later.

Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.

Is GHSA-fqfh-778m-2v32 being exploited?

There is no known exploitation of GHSA-fqfh-778m-2v32 in the wild and no public exploit code.

Sources

Also known as GO-2022-0395.

Is GHSA-fqfh-778m-2v32 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free