# GHSA-gm9x-q798-hmr4: Command Injection in git-tags-remote

> Attackers can execute arbitrary system commands by providing malicious repository URLs to the git-tags-remote library.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 29 Jul 2020

## What is GHSA-gm9x-q798-hmr4?

GHSA-gm9x-q798-hmr4 is a command injection vulnerability in git-tags-remote, published on 29 Jul 2020. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

All versions of `git-tags-remote ` are vulnerable to Command Injection. The package fails to sanitize the repository input and passes it directly to an `exec` call on the `get` function . This may allow attackers to execute arbitrary code in the system if the `repo` value passed to the function is user-controlled.  

The following proof-of-concept creates a file in `/tmp`:  
```
const gitTagsRemote = require('git-tags-remote');

gitTagsRemote.get('https://github.com/sh0ji/git-tags-remote.git; echo "Injection Success" > /tmp/command-injection.test')
.then(tags => console.log(tags));
```

## Which versions are affected by GHSA-gm9x-q798-hmr4?

2 open source packages ship an affected version, including git-tags-remote.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `git-tags-remote` | npm | All versions | 1.0.4 |
| `git-tags-remote` | npm | All versions | 1.0.4 |

## How do I fix GHSA-gm9x-q798-hmr4?

Upgrade git-tags-remote to 1.0.4 or later.

## Is GHSA-gm9x-q798-hmr4 being exploited?

There is no known exploitation of GHSA-gm9x-q798-hmr4 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-gm9x-q798-hmr4 and fix it if it is affected.

What it is: GHSA-gm9x-q798-hmr4 is a command injection vulnerability in git-tags-remote, published on 29 Jul 2020. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-gm9x-q798-hmr4 in the wild and no public exploit code.

Affected packages and fixed versions:
- git-tags-remote (npm): affected all versions; fixed in 1.0.4
- git-tags-remote (npm): affected all versions; fixed in 1.0.4

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/GHSA-gm9x-q798-hmr4/ (Markdown: https://insights.sbomify.com/GHSA-gm9x-q798-hmr4/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-gm9x-q798-hmr4

---
From sbomify Insights: https://insights.sbomify.com/GHSA-gm9x-q798-hmr4/
Summaries are generated and may contain mistakes; the official description above is the record.
