ghtier
← Back to Organization plane incidents
OrganizationAugust 2025

Nx "s1ngularity"

The injected script extracted a read/write GitHub token, a consequence of the workflow permissions setting, then created a branch replacing the CI script, triggered the publish workflow against that branch via the API using workflow_dispatch, and deleted branches and workflow runs to clean up. When publish ran, it had NPM_TOKEN in scope and exfiltrated it. The PR targeted an outdated branch that still carried the vulnerable workflow after it had been reverted on master. In phase two, the stolen GitHub tokens were used to flip thousands of private repositories to public. Downstream, one threat-intel group rode the consequences to full AWS administrator access at a victim org in under 72 hours, via OIDC trust chains and a CloudFormation IAM capability chain. No zero-days were involved.

Permissions abused

Read/write GITHUB_TOKEN (permissive workflow default)actions:write (workflow_dispatch)NPM_TOKEN

On the permission reference

Reported by: Mandiant (UNC6426, downstream follow-on)

How it unfolded

  1. 1

    An injected script extracts a read/write token

    A malicious script running in CI took advantage of a permissive workflow-level default and pulled out a GITHUB_TOKEN scoped for both read and write.

  2. 2

    The CI script itself is replaced on a new branch

    Using that token, the attacker created a new branch that swapped in a tampered version of the legitimate CI script.

  3. 3

    The publish workflow is triggered directly via the API

    Rather than waiting for a normal push, the attacker invoked workflow_dispatch through the GitHub API to run the publish workflow against their tampered branch — one that still carried a vulnerable workflow definition already reverted on master.

  4. 4

    NPM_TOKEN is exfiltrated during the tampered publish

    Because the publish workflow had NPM_TOKEN in scope, running it against the attacker's branch exfiltrated that token directly. The attacker then deleted the branch and workflow run history to reduce the trail.

  5. 5

    Phase two: stolen tokens flip repos public

    With the stolen GitHub tokens, the attacker flipped thousands of private repositories to public within a short window.

  6. 6

    Downstream: an OIDC trust chain reaches full AWS admin

    A separate threat-intel group rode the exposure to full AWS administrator access at a victim org in under 72 hours, chaining OIDC trust relationships with a CloudFormation IAM capability — no zero-day involved.

Mitigations

  • Set the default GITHUB_TOKEN permission to read-only at the org level — a compromised workflow can't write branches or trigger further jobs on its own

  • Require CODEOWNERS review on CI/CD script changes — a replaced build script can't merge unseen

  • Restrict who can trigger workflow_dispatch on publish/release workflows — limit it to a minimal, protected set of actors

  • Prevent branch and workflow-run deletion on protected branches — cleanup steps can't erase the trail

  • Migrate cloud credentials from static keys to OIDC federation scoped tightly to repo + branch — closes off the trust-chain pivot into cloud infrastructure

Frameworks

Part of

Contained. First seen August 2025. Mapping by ghtier, not yet reviewed. Threat landscape