# GHSA-f698-m2v9-5fh3: Command Injection in opencv

> Attackers can execute arbitrary commands via unvalidated input in the find-opencv.js utility script of the OpenCV npm package.

- **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:** 4 Jun 2019

## What is GHSA-f698-m2v9-5fh3?

GHSA-f698-m2v9-5fh3 is a command injection vulnerability in opencv, published on 4 Jun 2019. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Versions of `opencv`prior to 6.1.0 are vulnerable to Command Injection. The utils/ script find-opencv.js does not validate user input allowing attackers to execute arbitrary commands.

## Recommendation

Upgrade to version 6.1.0.

## Which versions are affected by GHSA-f698-m2v9-5fh3?

2 open source packages ship an affected version, including opencv.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `opencv` | npm | All versions | 6.1.0 |
| `opencv` | npm | All versions | 6.1.0 |

## How do I fix GHSA-f698-m2v9-5fh3?

Upgrade opencv to 6.1.0 or later.

## Is GHSA-f698-m2v9-5fh3 being exploited?

There is no known exploitation of GHSA-f698-m2v9-5fh3 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-f698-m2v9-5fh3 and fix it if it is affected.

What it is: GHSA-f698-m2v9-5fh3 is a command injection vulnerability in opencv, published on 4 Jun 2019. 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-f698-m2v9-5fh3 in the wild and no public exploit code.

Affected packages and fixed versions:
- opencv (npm): affected all versions; fixed in 6.1.0
- opencv (npm): affected all versions; fixed in 6.1.0

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-f698-m2v9-5fh3/ (Markdown: https://insights.sbomify.com/GHSA-f698-m2v9-5fh3/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-f698-m2v9-5fh3

---
From sbomify Insights: https://insights.sbomify.com/GHSA-f698-m2v9-5fh3/
Summaries are generated and may contain mistakes; the official description above is the record.
