CVE-2024-35192: Github.com/aquasecurity/trivy Trivy Possibly Leaks Registry Credential Vulnerability

MODERATE
Advisory Identifier: GHSA-xcq4-m2r3-cmrj
CVSS 5.5
CWE-522
Published
Advisory Summary

CVE-2024-35192 is a MODERATE (CVSS 5.5) trivy possibly leaks registry credential vulnerability (CWE-522: Insufficiently Protected Credentials) affecting Github.com/aquasecurity/trivy libraries in the Go ecosystem. The issue involves trivy possibly leaks registry credential when scanning images from malicious registries. Remediation is available by upgrading affected packages to version 0.51.2.

CVE-2024-35192 at a Glance

CVE Identifier CVE-2024-35192
GHSA Identifier GHSA-xcq4-m2r3-cmrj
Severity MODERATE
CVSS v3.1 Base Score 5.5
CWE Classification CWE-522: Insufficiently Protected Credentials
Affected Product Github.com/aquasecurity/trivy
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:H/I:N/A:N).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2024-35192

To remediate this vulnerability, upgrade all affected Github.com/aquasecurity/trivy dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/aquasecurity/trivy fixed: 0.51.2
Upgrade github.com/aquasecurity/trivy to 0.51.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/aquasecurity/trivy

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-35192, inspect your project dependencies for Github.com/aquasecurity/trivy:

inspect dependencies for github.com/aquasecurity/trivy

Analyze the terminal output to locate any version of Github.com/aquasecurity/trivy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.51.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-522: Insufficiently Protected Credentials, where the product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval. In Github.com/aquasecurity/trivy, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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](https://aws.github.io/aws-sdk-go-v2/docs/configuring-sdk/#specifying-credentials). 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](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html) (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.

CVE-2024-35192 Affected Github.com/aquasecurity/trivy Versions

1 component(s)
Fixed Versions:
0.51.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/aquasecurity/trivy
Go
< 0.51.2
0.51.2

References

Frequently Asked Questions

What is CVE-2024-35192?
CVE-2024-35192 is a security vulnerability in Github.com/aquasecurity/trivy involving Trivy possibly leaks registry credential when scanning images from malicious registries under CWE-522: Insufficiently Protected Credentials.
Which Github.com/aquasecurity/trivy versions are affected?
Affected versions include releases prior to 0.51.2 across affected packages: github.com/aquasecurity/trivy.
What version fixes CVE-2024-35192?
Upgrading to 0.51.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/aquasecurity/trivy affected?
Yes, github.com/aquasecurity/trivy is affected in releases prior to 0.51.2. Upgrade your dependency to 0.51.2 or later.
What is the CVSS score of CVE-2024-35192?
CVE-2024-35192 has a CVSS v3.1 base score of 5.5 (MODERATE) with vector string CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:H/I:N/A:N.
What CWE is associated with CVE-2024-35192?
CVE-2024-35192 is classified under CWE-522: Insufficiently Protected Credentials (The product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval.).
How can I check Go dependencies for CVE-2024-35192?
Run the dependency tree command: 'inspect dependencies for github.com/aquasecurity/trivy'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-xcq4-m2r3-cmrj",
  "modified" : "2024-05-20T22:07:21Z",
  "published" : "2024-05-20T20:36:53Z",
  "aliases" : [ "CVE-2024-35192" ],
  "summary" : "Trivy possibly leaks registry credential when scanning images from malicious registries",
  "details" : "## Impact\nIf 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.\n\nTaking AWS as an example, the leakage only occurs when Trivy is able to transparently obtain registry credentials from the default [credential provider chain](https://aws.github.io/aws-sdk-go-v2/docs/configuring-sdk/#specifying-credentials). You are affected if Trivy is executed in any of the following situations:\n\n- The environment variables contain static AWS credentials (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN) that have access to ECR.\n- 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](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html) (IRSA) annotation.\n- etc.\n\nYou are not affected if the default credential provider chain is unable to obtain valid credentials. The same applies to GCP and Azure.\n\n## Workarounds\nIf 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.\n\nThis 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. \n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/aquasecurity/trivy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.51.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/aquasecurity/trivy/security/advisories/GHSA-xcq4-m2r3-cmrj"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-35192"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aquasecurity/trivy/commit/e7f14f729de259551203f313e57d2d9d3aa2ff87"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/aquasecurity/trivy"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-522" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-05-20T20:36:53Z",
    "nvd_published_at" : "2024-05-20T21:15:09Z"
  }
}