These write-ups are not threat intelligence and are not kept up to date as an incident develops. They are here to show how each attack worked, so you can find and fix the same techniques in your own setup. For the latest on an incident, read its sources.
Ultralytics build cache poisoning
December 2024 · Contained
A branch name ran as a shell command in a pull_request_target workflow, and the code it fetched poisoned the Actions cache that Ultralytics' release job restored, so two releases built and published through Trusted Publishing carried a cryptominer. Two days later two more malicious versions went to PyPI straight from an old API token.
- Access held
Full summary
The ultralytics/ultralytics repository ran a formatting workflow on pull_request_target that called the project's own composite Action, which put the pull request's branch name straight into a git pull shell command. Adnan Khan had reported that injection in August 2024 and it was fixed the same day, but a later version of the Action brought it back. On 4 December 2024 the openimbot account opened pull requests from branches whose names fetched and ran a script. The script was a copy of Khan's published cache poisoning proof of concept: it read the runner's memory for the Actions cache token and cache URL and sent them out, and researchers believe it then wrote a poisoned pip cache entry under the key the release workflow used. Within the hour a commit under the UltralyticsAssistant bot's name bumped the version to 8.3.41 and removed the check that only let glenn-jocher trigger a release. The release job restored the poisoned cache, built a package with an XMRig miner in it and published it through Trusted Publishing, with valid provenance. 8.3.42, released by the maintainer the next day, was also malicious. On 7 December 8.3.45 and 8.3.46 were uploaded directly with a PyPI API token left over from before Trusted Publishing, with no CI run behind them.
How it unfolded
Pick a step to zoom into it. A dashed line is a step the sources do not state. Blue dots are the checklist items that break the step.
Whole path
The whole attack, one row per step. Pick a step on the left, or click a box in its row.
On 14 August 2024 Adnan Khan reported that ultralytics/actions put github.head_ref, the pull request's branch name, into a run step (GHSA-7x29-qqmq-v6qc). It was fixed the same day, and on 24 August version 0.0.24 brought the same line back: git pull origin ${{ github.head_ref || github.ref }}. format.yml in ultralytics/ultralytics ran ultralytics/actions@main on pull_request_target and passed it secrets._GITHUB_TOKEN, a token of the UltralyticsAssistant bot, and an OpenAI key.
On the evening of 4 December 2024 (UTC) the openimbot account opened pull requests #18018 and #18020 from its fork openimbot/openlytics, with branch names that fetched a file.sh and piped it to bash. Other accounts had tried the same trick on 2 and 3 December. GitGuardian found the script was a copy of Khan's cache poisoning proof of concept: it dumped the runner's memory, picked out the AccessToken and CacheServerUrl values, and sent them to a webhook.site address. The attacker then force-pushed the branch to remove the script.
What breaks this step
- Audit every use of pull_request_target and remove or restructure risky ones
- Set the default GITHUB_TOKEN permission to read-only at the org level
- Require approval for first-time/external contributor workflow runs on forks
- Limit who and what can trigger workflows with workflow execution protections
- Disallow self-hosted runners on public repositories
- Pass untrusted values through env variables instead of ${{ }} expressions in run steps.
- Make self-hosted runners ephemeral.
- Lint workflows with zizmor or a similar tool in CI.
With the cache token an attacker can write entries for the main branch that other workflows restore. The final payload was never recovered, so this step is the researchers' conclusion: Khan identified the likely poisoned entry, setup-python's pip cache for Python 3.12.7 on Linux, which publish.yml restored through cache: "pip". The fix for 8.3.43 on 5 December removed that cache from publish.yml.
At 20:49 UTC a commit authored and committed as UltralyticsAssistant landed on main, bumping the version to 8.3.41 and removing the github.actor == 'glenn-jocher' condition from the publish job. The push ran publish.yml, which built the package with the poisoned cache in place and published it at 20:51 through Trusted Publishing, with attestations. The wheel's downloads.py and model.py had been changed to download and run an XMRig miner. William Woodruff reads the commit as a sign the attacker controlled the bot's token; no source shows who pushed it.
What breaks this step
- Branch protection on default/release branches: required reviews of the last push + required status checks
- Rulesets applied: push restriction, tag protection, sensitive file-path protection
- Require the committer to match the pusher on sensitive repos
- Make releases immutable, or protect release tags with a tag ruleset
- Put production secrets in environments with required reviewers
On 5 December a user reported in issue #18027 that the 8.3.41 wheel did not match the source, after the miner was noticed through ComfyUI-Impact-Pack, which depends on Ultralytics. 8.3.41 was removed at 09:15 UTC. At 12:47 glenn-jocher's own push released 8.3.42, which was also malicious and was removed an hour later.
On 7 December 8.3.45 (01:41 UTC) and 8.3.46 (02:27) were uploaded directly to PyPI with an API token, with no matching commit, workflow run or attestation. PyPI says the token was still available to the project's workflows, probably left from before it moved to Trusted Publishing. How it was taken is not settled: Woodruff first thought it came out of runner memory, and Khan replied that GitHub only sends a job the secrets its workflow references, and suspected the bot's token was used to run a workflow that sent the secrets out. Both versions were removed by 10:09 UTC.
What breaks this step
- Adopt artifact attestations for build provenance on published binaries/images
- Cloud credentials migrated from static keys to OIDC federation, scoped to repo + branch
- Publish packages with trusted publishing (OIDC) instead of long-lived registry tokens
- Put production secrets in environments with required reviewers
- Write and rehearse a credential-rotation runbook before you need it
- Set an organization-wide maximum PAT lifetime (90 days is a reasonable default)
- Disable classic PATs organization-wide, forcing migration to fine-grained PATs
- Secret scanning and push protection enabled
- Set `persist-credentials: false` on actions/checkout wherever later steps do not push
- Require organization owner approval for fine-grained PATs.
- Never upload the checkout workspace as an artifact.
Frameworks
Part of
Contained. First seen December 2024. Mapping by ghtier, not yet reviewed. Threat landscape
Sources
- researchzizmor would have caught the Ultralytics workflow vulnerability
- researchSupply-chain attack analysis: Ultralytics (PyPI)
- trackerUltralytics issue #18027: the 8.3.41 wheel differs from the source
- advisoryGHSA-7x29-qqmq-v6qc: script injection in ultralytics/actions
- researchThe Monsters in Your Build Cache: GitHub Actions cache poisoning
- researchThe Ultralytics supply chain attack: connecting the dots
- researchUltralytics AI pwn request supply chain attack
- researchThe Ultralytics supply chain attack: how it happened, how to prevent
- trackerUltralytics AI library hacked via GitHub for cryptomining
Reported by: GitGuardian