# GHSA-886v-mm6p-4m66: High severity vulnerability that affects gun

> An attacker can read arbitrary files from the server via path traversal in the static file server, potentially leaking sensitive environment variables and keys.

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

## What is GHSA-886v-mm6p-4m66?

GHSA-886v-mm6p-4m66 is a path traversal vulnerability in gun, published on 5 Jun 2019. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

## Urgent Upgrade

The static file server module included with GUN had a **serious vulnerability**:

 - Using `curl --path-as-is` allowed reads on any parent directory or files.

This did not work via the browser or via curl without as-is option.

 ### Fixed

This has been fixed since version `0.2019.416` and higher.

 ### Who Was Effected?

Most NodeJS users who use the default setup, such as:

 - `npm start`
 - `node examples/http.js`
 - `Heroku` 1-click-deploy
 - `Docker`
 - `Now`

If you have a custom NodeJS code then you are probably safe *unless* you have something like `require('http').createServer(Gun.serve(__dirname))` in it.

If you have not upgraded, it is **mandatory** or else it is highly likely your environment variables and AWS (or other) keys could be leaked.

 ### Credit

It was reported and fixed by [JK0N](https://github.com/amark/gun/pull/527), but I did not understand the `--path-as-is` condition.

Joonas Loppi from [function61](http://function61.com) rediscovered it and explained the urgency to me to fix it.

## Which versions are affected by GHSA-886v-mm6p-4m66?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `gun` | npm | All versions | 0.2019.416 |
| `gun` | npm | All versions | 0.2019.416 |

## How do I fix GHSA-886v-mm6p-4m66?

Upgrade gun to 0.2019.416 or later.

## Is GHSA-886v-mm6p-4m66 being exploited?

There is no known exploitation of GHSA-886v-mm6p-4m66 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-886v-mm6p-4m66 and fix it if it is affected.

What it is: GHSA-886v-mm6p-4m66 is a path traversal vulnerability in gun, published on 5 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-886v-mm6p-4m66 in the wild and no public exploit code.

Affected packages and fixed versions:
- gun (npm): affected all versions; fixed in 0.2019.416
- gun (npm): affected all versions; fixed in 0.2019.416

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-886v-mm6p-4m66/ (Markdown: https://insights.sbomify.com/GHSA-886v-mm6p-4m66/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-886v-mm6p-4m66

---
From sbomify Insights: https://insights.sbomify.com/GHSA-886v-mm6p-4m66/
Summaries are generated and may contain mistakes; the official description above is the record.
