# GHSA-pwf7-47c3-mfhx: j178/prek-action vulnerable to arbitrary code injection in composite action

> Attackers can inject arbitrary code via action inputs to execute commands and steal secrets in GitHub Actions workflows.

- **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 Sep 2025

## What is GHSA-pwf7-47c3-mfhx?

GHSA-pwf7-47c3-mfhx is a code injection vulnerability in j178/prek-action, published on 29 Sep 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Summary
There are three potential attacks of arbitrary code injection vulnerability in the composite action at _action.yml_.

### Details
The GitHub Action variables `inputs.prek-version`, `inputs.extra_args`, and `inputs.extra-args` can be used to execute arbitrary code in the context of the action.

### PoC
```yaml
- uses: j178/prek-action@v1.0.5
  with:
    prek-version: $(printenv >> $GITHUB_STEP_SUMMARY && echo "0.2.2")
    extra_args: '&& echo "MY_SECRET with a character is: ${MY_SECRET:0:1}a${MY_SECRET:1}" >> $GITHUB_STEP_SUMMARY && echo ""'
  env:
    MY_SECRET: ${{ secrets.MY_SECRET }}
```

The previous example will print all the environment variables, and it will expose `MY_SECRET` environment variable value to the summary of the workflow. An attacker could potentially use this vector to compromise the security of the target repository, even passing unnotice because the action will run normally.

### Impact
Critical, CWE-94

## Which versions are affected by GHSA-pwf7-47c3-mfhx?

1 open source package ship an affected version, including j178/prek-action.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `j178/prek-action` | GitHub Actions | All versions | 1.0.6 |

## How do I fix GHSA-pwf7-47c3-mfhx?

Upgrade j178/prek-action to 1.0.6 or later.

## Is GHSA-pwf7-47c3-mfhx being exploited?

There is no known exploitation of GHSA-pwf7-47c3-mfhx in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-pwf7-47c3-mfhx and fix it if it is affected.

What it is: GHSA-pwf7-47c3-mfhx is a code injection vulnerability in j178/prek-action, published on 29 Sep 2025. 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-pwf7-47c3-mfhx in the wild and no public exploit code.

Affected packages and fixed versions:
- j178/prek-action (GitHub Actions): affected all versions; fixed in 1.0.6

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-pwf7-47c3-mfhx/ (Markdown: https://insights.sbomify.com/GHSA-pwf7-47c3-mfhx/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-pwf7-47c3-mfhx

---
From sbomify Insights: https://insights.sbomify.com/GHSA-pwf7-47c3-mfhx/
Summaries are generated and may contain mistakes; the official description above is the record.
