# GHSA-c7xh-gjv4-4jgv: kcp's impersonation allows access to global administrative groups

> Users with workspace cluster-admin roles can impersonate global admin groups to bypass authorization checks and escalate privileges.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 11 Dec 2024
- **Also known as:** GO-2024-3325

## What is GHSA-c7xh-gjv4-4jgv?

GHSA-c7xh-gjv4-4jgv is a vulnerability in github.com/kcp-dev/kcp, published on 11 Dec 2024. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

### Impact

[Impersonation](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#user-impersonation) is a feature of the Kubernetes API, allowing to override user information. As downstream project, kcp inherits this feature. As per the linked documentation a specific level of privilege (usually assigned to cluster admins) is required for impersonation.

The vulnerability in kcp affects kcp installations in which users are granted the `cluster-admin` ClusterRole (or comparably high permission levels that grant impersonation access; the verb in question is `impersonate`) within their respective workspaces. As kcp builds around self-service confined within workspaces, most installations would likely grant such workspace access to their users. Such users can impersonate special global administrative groups, which circumvent parts of the authorizer chains, e.g. [maximal permission policies](https://docs.kcp.io/kcp/v0.26/concepts/apis/exporting-apis/#maximal-permission-policy).

### Patches

The problem has been patched in #3206 and is available in kcp 0.26.1 and higher.

### Workarounds

- Not assigning the `cluster-admin` role (or any other role granting blanket impersonation permissions) to users.
- A reverse proxy between users and kcp to check for the `Impersonate-Group` header and reject requests that impersonate global administrative groups.

### References

See the pull request (#3206).

## Which versions are affected by GHSA-c7xh-gjv4-4jgv?

3 open source packages ship an affected version, including github.com/kcp-dev/kcp.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/kcp-dev/kcp` | Go | All versions | 0.26.1 |
| `github.com/kcp-dev/kcp` | Go | All versions | 0.26.1 |
| `github.com/kcp-dev/kcp` | Go | All versions | 0.26.1 |

## How do I fix GHSA-c7xh-gjv4-4jgv?

Upgrade github.com/kcp-dev/kcp to 0.26.1 or later.

## Is GHSA-c7xh-gjv4-4jgv being exploited?

There is no known exploitation of GHSA-c7xh-gjv4-4jgv in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-c7xh-gjv4-4jgv and fix it if it is affected.

What it is: GHSA-c7xh-gjv4-4jgv is a vulnerability in github.com/kcp-dev/kcp, published on 11 Dec 2024. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-c7xh-gjv4-4jgv in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/kcp-dev/kcp (Go): affected all versions; fixed in 0.26.1
- github.com/kcp-dev/kcp (Go): affected all versions; fixed in 0.26.1
- github.com/kcp-dev/kcp (Go): affected all versions; fixed in 0.26.1

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-c7xh-gjv4-4jgv/ (Markdown: https://insights.sbomify.com/GHSA-c7xh-gjv4-4jgv/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-c7xh-gjv4-4jgv

---
From sbomify Insights: https://insights.sbomify.com/GHSA-c7xh-gjv4-4jgv/
Summaries are generated and may contain mistakes; the official description above is the record.
