# CVE-2024-35192: Trivy possibly leaks registry credential when scanning images from malicious registries

> Trivy may leak cloud registry credentials when scanning images from malicious registries, allowing attackers to access legitimate container repositories.

- **Severity:** Medium 5.5 (`CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:H/I:N/A:N`)
- **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:** 20 May 2024
- **Updated:** 2 Aug 2024
- **Also known as:** GHSA-xcq4-m2r3-cmrj, GO-2024-2870, openSUSE-SU-2024:14030-1

## What is CVE-2024-35192?

CVE-2024-35192 is a medium-severity vulnerability in aquasecurity trivy, published on 20 May 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

Trivy is a security scanner. Prior to 0.51.2, if a malicious actor is able to trigger Trivy to scan container images from a crafted malicious registry, it could result in the leakage of credentials for legitimate registries such as AWS Elastic Container Registry (ECR), Google Cloud Artifact/Container Registry, or Azure Container Registry (ACR). These tokens can then be used to push/pull images from those registries to which the identity/user running Trivy has access. Systems are not affected if the default credential provider chain is unable to obtain valid credentials. This vulnerability only applies when scanning container images directly from a registry. This vulnerability is fixed in 0.51.2.

Weakness: CWE-522 (Insufficiently Protected Credentials)

## Which versions are affected by CVE-2024-35192?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/aquasecurity/trivy` | Go | All versions | 0.51.2 |
| `github.com/aquasecurity/trivy` | Go | All versions | 0.51.2 |
| `github.com/aquasecurity/trivy` | Go | All versions | 0.51.2 |
| `trivy` | openSUSE:Tumbleweed | All versions | 0.52.0-1.1 |

## How do I fix CVE-2024-35192?

Upgrade github.com/aquasecurity/trivy to 0.51.2 or later.

## Is CVE-2024-35192 being exploited?

There is no known exploitation of CVE-2024-35192 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-35192 and fix it if it is affected.

What it is: CVE-2024-35192 is a medium-severity vulnerability in aquasecurity trivy, published on 20 May 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 CVE-2024-35192 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/aquasecurity/trivy (Go): affected all versions; fixed in 0.51.2
- github.com/aquasecurity/trivy (Go): affected all versions; fixed in 0.51.2
- github.com/aquasecurity/trivy (Go): affected all versions; fixed in 0.51.2

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/CVE-2024-35192/ (Markdown: https://insights.sbomify.com/CVE-2024-35192/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-35192
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-35192
- OSV: https://osv.dev/vulnerability/CVE-2024-35192

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-35192/
Summaries are generated and may contain mistakes; the official description above is the record.
