# GHSA-j5vm-7qcc-2wwg: Kopia: Storage connection credentials written to console on "repository status" CLI command with JSON output

> Kopia CLI exposes storage credentials in console output when using JSON format, allowing local attackers to steal sensitive repository access keys.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 10 Apr 2024
- **Also known as:** GO-2024-2703

## What is GHSA-j5vm-7qcc-2wwg?

GHSA-j5vm-7qcc-2wwg is a vulnerability in github.com/kopia/kopia, published on 10 Apr 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

### Impact

_What kind of vulnerability is it? Who is impacted?_

Storage credentials are written to the console.

### Patches

_Has the problem been patched?_ Yes, see #3589
_What versions should users upgrade to?_
- Any version after or including commit 1d6f852cd6534f4bea978cbdc85c583803d79f77
- No release has been created yet.

### Workarounds
_Is there a way for users to fix or remediate the vulnerability without upgrading?_

- Be aware that `kopia repo status --json` will write the credentials to the output without scrubbing them.
- Avoid executing `kopia repo status` with the `--json` flag in an insecure environment where.
- Avoid logging the output of the `kopia repo status --json` command.

## Which versions are affected by GHSA-j5vm-7qcc-2wwg?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/kopia/kopia` | Go | All versions | 0.16.0 |
| `github.com/kopia/kopia` | Go | All versions | 0.16.0 |
| `github.com/kopia/kopia` | Go | All versions | 0.16.0 |

## How do I fix GHSA-j5vm-7qcc-2wwg?

Upgrade github.com/kopia/kopia to 0.16.0 or later.

## Is GHSA-j5vm-7qcc-2wwg being exploited?

There is no known exploitation of GHSA-j5vm-7qcc-2wwg in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-j5vm-7qcc-2wwg and fix it if it is affected.

What it is: GHSA-j5vm-7qcc-2wwg is a vulnerability in github.com/kopia/kopia, published on 10 Apr 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of GHSA-j5vm-7qcc-2wwg in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/kopia/kopia (Go): affected all versions; fixed in 0.16.0
- github.com/kopia/kopia (Go): affected all versions; fixed in 0.16.0
- github.com/kopia/kopia (Go): affected all versions; fixed in 0.16.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-j5vm-7qcc-2wwg/ (Markdown: https://insights.sbomify.com/GHSA-j5vm-7qcc-2wwg/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-j5vm-7qcc-2wwg

---
From sbomify Insights: https://insights.sbomify.com/GHSA-j5vm-7qcc-2wwg/
Summaries are generated and may contain mistakes; the official description above is the record.
