# GHSA-p799-q2pr-6mxj: go.rgst.io/stencil/v2 vulnerable to Path Traversal

> A path traversal vulnerability in the stencil library allows attackers to execute code or modify files via malicious archives.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 29 Mar 2025
- **Also known as:** GO-2025-3584

## What is GHSA-p799-q2pr-6mxj?

GHSA-p799-q2pr-6mxj is a path traversal vulnerability in go.rgst.io/stencil, published on 29 Mar 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

### Impact

The library used to extract archives (github.com/jaredallard/archives) was vulnerable to the "zip slip" vulnerability. This is used to extract native extension archives and repository source archives. A native extension or repository archive could be crafted in such a way where a remote code execution or modification/reading of a file is possible using the user who is running stencil.

The severity is marked as "medium" because native extensions have always considered to be "unsafe" to run when not trusted. Native extensions are arbitrary code being ran, which could always do this same exploit with less steps. The medium severity is to reflect that this could be done even when a user is _not_ using a native extension, for example a repository source archive. However, one would need to mutate the archives provided by Github or perform some hackery with links, which may not be possible. Thus, "medium" is used out of an abundance of caution where I would've labeled this as "low".

### Patches

Patched in 2.3.0 and above.

### Workarounds

No workarounds are present.

### References

https://github.com/jaredallard/archives/security/advisories/GHSA-j95m-rcjp-q69h

## Which versions are affected by GHSA-p799-q2pr-6mxj?

4 open source packages ship an affected version, including go.rgst.io/stencil/v2 and go.rgst.io/stencil.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `go.rgst.io/stencil/v2` | Go | All versions | 2.3.0 |
| `go.rgst.io/stencil/v2` | Go | All versions | 2.3.0 |
| `go.rgst.io/stencil/v2` | Go | All versions | 2.3.0 |
| `go.rgst.io/stencil` | Go | All versions | None |

## How do I fix GHSA-p799-q2pr-6mxj?

Upgrade go.rgst.io/stencil/v2 to 2.3.0 or later.

## Is GHSA-p799-q2pr-6mxj being exploited?

There is no known exploitation of GHSA-p799-q2pr-6mxj in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-p799-q2pr-6mxj and fix it if it is affected.

What it is: GHSA-p799-q2pr-6mxj is a path traversal vulnerability in go.rgst.io/stencil, published on 29 Mar 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of GHSA-p799-q2pr-6mxj in the wild and no public exploit code.

Affected packages and fixed versions:
- go.rgst.io/stencil/v2 (Go): affected all versions; fixed in 2.3.0
- go.rgst.io/stencil/v2 (Go): affected all versions; fixed in 2.3.0
- go.rgst.io/stencil/v2 (Go): affected all versions; fixed in 2.3.0
- go.rgst.io/stencil (Go): affected all versions; no fix listed

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-p799-q2pr-6mxj/ (Markdown: https://insights.sbomify.com/GHSA-p799-q2pr-6mxj/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-p799-q2pr-6mxj

---
From sbomify Insights: https://insights.sbomify.com/GHSA-p799-q2pr-6mxj/
Summaries are generated and may contain mistakes; the official description above is the record.
