CVE-2024-35192: Trivy possibly leaks registry credential when scanning images from malicious registries
Impact 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).
Published May 20, 2024
Affected packages
github.com/aquasecurity/trivy
- Ecosystem
- Go
- Affected
- < 0.51.2
- Fixed in
- 0.51.2
- Check
go list -m github.com/aquasecurity/trivy
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Impact
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.
Taking AWS as an example, the leakage only occurs when Trivy is able to transparently obtain registry credentials from the default credential provider chain. You are affected if Trivy is executed in any of the following situations:
- The environment variables contain static AWS credentials (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN) that have access to ECR.
- Within a Pod running on an EKS cluster that has been assigned a role with access to ECR using an IAM Roles for Service Accounts (IRSA) annotation.
- etc.
You are not affected if the default credential provider chain is unable to obtain valid credentials. The same applies to GCP and Azure.
Workarounds
If you are using Trivy v0.51.2 or later, you are not affected. If you are using Trivy v0.51.1 or prior, you should ensure you only scan images from trusted registries.
This vulnerability only applies when scanning container images directly from a registry. If you use Docker, containerd or other runtime to pull images locally and scan them with Trivy, you are not affected. To enforce this behavior, you can use the --image-src flag to select which sources you trust.
Credited to lyoung-confluent.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Go vulnerabilities
All Go entriesCVE-2026-55092
Trivy has a path traversal via a crafted vulnerability database or other downloaded artifacts
high7.5Aug 25, 2026CVE-2026-63328
Trivy Plugin Manager has Path Traversal that Allows Arbitrary File Write
medium6.8Aug 18, 2026CVE-2026-54448
Trivy: Helm chart tar bomb causes OOM via unbounded io.ReadAll in parser
high8.7Jul 14, 2026CVE-2026-33634
Trivy ecosystem supply chain was briefly compromised
critical9.4ExploitedNo fixMar 24, 2026
