# GHSA-9phh-r37v-34wh: lakeFS vulnerable to Arbitrary JavaScript Injection via Direct Link to HTML Files

> Attackers with upload access can inject malicious JavaScript into HTML files, leading to session hijacking or data theft when victims open direct links.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 14 Aug 2023
- **Also known as:** GO-2023-2012

## What is GHSA-9phh-r37v-34wh?

GHSA-9phh-r37v-34wh is a cross-site scripting vulnerability in github.com/treeverse/lakefs, published on 14 Aug 2023. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

### Official description

### Impact
The browser renders the resulting HTML when opening a direct link to an HTML file via lakeFS. Any JavaScript within that page is executed within the context of the domain lakeFS is running in.  
An attacker can inject a malicious script inline, download resources from another domain, or make arbitrary HTTP requests. This would allow the attacker to send information to a random domain or carry out lakeFS operations while impersonating the victim.  

Note that to carry out this attack, an attacker must already have access to upload the malicious HTML file to one or more repositories. It also depends on the victim receiving and opening the link to the malicious HTML file.

### Patches
This is fixed in lakeFS version 0.106.0

### Workarounds
There are no known workarounds at this time.

## Which versions are affected by GHSA-9phh-r37v-34wh?

3 open source packages ship an affected version, including github.com/treeverse/lakefs.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/treeverse/lakefs` | Go | All versions | 0.106.0 |
| `github.com/treeverse/lakefs` | Go | All versions | 0.106.0 |
| `github.com/treeverse/lakefs` | Go | All versions | 0.106.0 |

## How do I fix GHSA-9phh-r37v-34wh?

Upgrade github.com/treeverse/lakefs to 0.106.0 or later.

## Is GHSA-9phh-r37v-34wh being exploited?

There is no known exploitation of GHSA-9phh-r37v-34wh in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-9phh-r37v-34wh and fix it if it is affected.

What it is: GHSA-9phh-r37v-34wh is a cross-site scripting vulnerability in github.com/treeverse/lakefs, published on 14 Aug 2023. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of GHSA-9phh-r37v-34wh in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/treeverse/lakefs (Go): affected all versions; fixed in 0.106.0
- github.com/treeverse/lakefs (Go): affected all versions; fixed in 0.106.0
- github.com/treeverse/lakefs (Go): affected all versions; fixed in 0.106.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-9phh-r37v-34wh/ (Markdown: https://insights.sbomify.com/GHSA-9phh-r37v-34wh/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-9phh-r37v-34wh

---
From sbomify Insights: https://insights.sbomify.com/GHSA-9phh-r37v-34wh/
Summaries are generated and may contain mistakes; the official description above is the record.
