GHSA-xcq4-m2r3-cmrj

Suggest an improvement
Source
https://github.com/advisories/GHSA-xcq4-m2r3-cmrj
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2024/05/GHSA-xcq4-m2r3-cmrj/GHSA-xcq4-m2r3-cmrj.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-xcq4-m2r3-cmrj
Aliases
Related
Published
2024-05-20T20:36:53Z
Modified
2024-05-22T17:44:36.679905Z
Severity
  • 5.5 (Medium) CVSS_V3 - CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:H/I:N/A:N CVSS Calculator
Summary
Trivy possibly leaks registry credential when scanning images from malicious registries
Details

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 (AWSACCESSKEYID, AWSSECRETACCESSKEY, AWSSESSIONTOKEN) 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.

References

Affected packages

Go / github.com/aquasecurity/trivy

Package

Name
github.com/aquasecurity/trivy
View open source insights on deps.dev
Purl
pkg:golang/github.com/aquasecurity/trivy

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.51.2