Codecov’s uploader script is altered to steal CI secrets

Placement and access31 January to 1 April 2021

For two months, a script that thousands of companies fetched into their build pipelines was altered to send each pipeline’s environment, including secrets, to an attacker. A customer noticed when the script’s checksum did not match.

Position
A script fetched at run time from the vendor’s storage
Reach
Customers among more than 29,000 using the uploader; hundreds of networks reportedly breached afterwards

What happened

An error in Codecov's Docker image build let an attacker extract a credential for the cloud storage holding the company's Bash Uploader script, which customers' build pipelines downloaded each time they ran. From 31 January 2021 the attacker altered the script from time to time so that it sent the pipeline's environment variables and git remotes to a server the attacker controlled, exposing tokens, keys and other secrets. The GitHub Action and other integrations that used the script were affected too. A customer noticed on 1 April when the script's checksum did not match the published value. Codecov disclosed on 15 April and CISA issued an alert.

The ATG nexus

The pipeline fetched code from a trusted address each time it ran, and executed whatever came back. That is the Static Resource Assumption at work in a build system: the address is treated as if it stood for fixed content. The attacker changed the content intermittently, which made it harder to catch, and the one control that caught it was a customer comparing a checksum.

Limits of the comparison

The target was build infrastructure and the secrets in it. No screen was altered, and the harm came from what attackers did later with stolen credentials.

On this site

Sources

  1. Bash Uploader Security UpdateCodecov, 15 April 2021Primary source
  2. Codecov Releases Security UpdateCISA, 22 April 2021Primary source
  3. Hundreds of networks reportedly hacked in Codecov supply-chain attackBleepingComputer, 20 April 2021

Back to this event on the timeline