# GHSA-qq97-vm5h-rrhg: OCI Manifest Type Confusion Issue

> Attackers can bypass image attestation checks by exploiting OCI manifest type confusion via Content-Type headers, affecting registry clients relying on digest equivalence.

- **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:** 8 Feb 2022
- **Also known as:** GO-2022-0379

## What is GHSA-qq97-vm5h-rrhg?

GHSA-qq97-vm5h-rrhg is a vulnerability in github.com/docker/distribution, published on 8 Feb 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Impact

Systems that rely on digest equivalence for image attestations may be vulnerable to type confusion.

### Patches

Upgrade to at least `v2.8.0-beta.1`  if you are running `v2.x` release. If you use the code from the `main` branch, update at least to the commit after [b59a6f827947f9e0e67df0cfb571046de4733586](https://github.com/distribution/distribution/commit/b59a6f827947f9e0e67df0cfb571046de4733586).

### Workarounds

There is no way to work around this issue without patching.

### References

Due to [an oversight in the OCI Image Specification](https://github.com/opencontainers/image-spec/pull/411) that removed the embedded `mediaType` field from manifests, a maliciously crafted OCI Container Image can cause registry clients to parse the same image in two different ways without modifying the image’s digest by modifying the `Content-Type` header returned by a registry. This can invalidate a common pattern of relying on container image digests for equivalence.

### For more information

If you have any questions or comments about this advisory:
* Open an issue in [distribution](https://github.com/distribution/distribution) 
* Open an issue in [distribution-spec](https://github.com/opencontainers/distribution-spec) 
* Email us at [cncf-distribution-security@lists.cncf.io](mailto:cncf-distribution-security@lists.cncf.io)

## Which versions are affected by GHSA-qq97-vm5h-rrhg?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/docker/distribution` | Go | All versions | 2.8.0 |
| `github.com/docker/distribution` | Go | All versions | 2.8.0 |
| `github.com/docker/distribution` | Go | All versions | 2.8.0+incompatible |

## How do I fix GHSA-qq97-vm5h-rrhg?

Upgrade github.com/docker/distribution to a fixed version for your release line: 2.8.0 or 2.8.0+incompatible.

## Is GHSA-qq97-vm5h-rrhg being exploited?

There is no known exploitation of GHSA-qq97-vm5h-rrhg in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-qq97-vm5h-rrhg and fix it if it is affected.

What it is: GHSA-qq97-vm5h-rrhg is a vulnerability in github.com/docker/distribution, published on 8 Feb 2022. 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-qq97-vm5h-rrhg in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/docker/distribution (Go): affected all versions; fixed in 2.8.0
- github.com/docker/distribution (Go): affected all versions; fixed in 2.8.0
- github.com/docker/distribution (Go): affected all versions; fixed in 2.8.0+incompatible

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-qq97-vm5h-rrhg/ (Markdown: https://insights.sbomify.com/GHSA-qq97-vm5h-rrhg/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-qq97-vm5h-rrhg

---
From sbomify Insights: https://insights.sbomify.com/GHSA-qq97-vm5h-rrhg/
Summaries are generated and may contain mistakes; the official description above is the record.
