Context
Trivy transmits authentication credentials when scanning container images directly from a registry. A flaw referenced as CVE-2024-35192 (GHSA-xcq4-m2r3-cmrj, CWE-522) allows an attacker-controlled registry to intercept those credentials.
Vulnerability
When Trivy scans container images directly from a registry, it transmits authentication credentials through a method susceptible to interception. An attacker can exploit this by:
- Setting up a crafted malicious container registry.
- Inducing the target to scan an image hosted there (e.g., via a pull request that references the malicious image).
If the target system has valid cloud credentials accessible via default credential provider chains, those credentials are leaked:
- AWS: environment variables, EKS/IRSA role assumptions
- GCP: Application Default Credentials
- Azure: managed identity credentials
Impact
- Compromised credentials could allow the attacker to push or pull images from the victim's legitimate registries (AWS ECR, GCP Artifact/Container Registry, Azure ACR).
- Only affects scanning images directly from registries — scanning locally-pulled images through Docker or containerd is not affected.
Remediation
- Upgrade to Trivy v0.51.2 or later, which fixes the credential handling.
- Restrict image scanning to trusted registries only.
- Use the
--image-srcflag to enforce scanning from trusted sources.