Trivy Breached Twice in a Month via GitHub Actions


TL;DR

  • Supply-Chain Breach: Attackers hijacked 75 of 76 GitHub Actions tags for Aqua Security’s Trivy scanner, distributing credential-stealing malware through the trusted security tool.
  • Second Compromise: The attack stemmed from incomplete containment of an earlier March 1 breach, where non-atomic secret rotation left attackers with continued repository access.
  • npm Worm: A self-propagating worm called CanisterWorm compromised 47 npm packages using stolen tokens, spreading malicious code across the JavaScript ecosystem.
  • Recommended Action: Organizations should pin GitHub Actions to commit SHA hashes instead of version tags and rotate any credentials that transited affected pipelines.

Aqua Security revealed on March 21 that attackers hijacked 75 of 76 GitHub Actions tags for its Trivy vulnerability scanner, distributing credential-stealing malware through the widely used security tool for the second time in a single month. Malicious code rode alongside legitimate scans, targeting SSH keys, cloud tokens, and API secrets in CI/CD pipelines.

More than 10,000 GitHub workflow files rely on trivy-action, meaning any pipeline that pulled affected versions during the attack window may have had sensitive credentials exfiltrated. Beyond Trivy users, a self-propagating npm worm compromised 47 packages, extending the blast radius into the broader JavaScript ecosystem. Aqua Security disclosed in a GitHub Discussion that the incident stemmed from incomplete containment of an earlier March 1 breach involving a hackerbot-claw bot.

How Attackers Hijacked Trivy’s Build Pipeline

On March 1, a hackerbot-claw bot exploited a pull_request_target workflow to exfiltrate repository secrets from Trivy’s GitHub environment. Aqua Security rotated credentials after that first breach, but gaps in the rotation process left attackers with continued write access to the repository, setting the stage for the larger second compromise three weeks later.

Armed with that access, attackers swapped the entrypoint.sh in Trivy’s GitHub Actions with a 204-line script that prepended credential-stealing code before the legitimate scanner. Lines 4 through 105 contained the infostealer payload, while lines 106 through 204 ran Trivy as normal, making the compromise difficult to detect during routine scans. Security researcher Paul McCarty was the first to warn publicly that Trivy version 0.69.4 had been backdoored, with malicious container images and GitHub releases published to users.

According to Socket security researcher Philipp Burckhardt, attackers force-pushed 75 out of 76 tags in the trivy-action repository, turning trusted version references into infostealer distribution points. Commit metadata including author names, emails, and timestamps was spoofed to match legitimate patterns, but a key detection indicator remained: original commits carried GPG signatures from GitHub, while attacker commits lacked any signature. Socket generated 182 threat feed entries tied to malicious GitHub Actions associated with this campaign.