Skip to content

GitHub Actions Secret Theft: Attack Patterns, Investigation, and Response

Interactive Diagram

새 탭 ↗

When a GitHub token is stolen, secrets in repositories where it can change workflows are also at risk. An attacker can plant a malicious workflow to target the secrets available to a job that is allowed to run.

This post covers four public attack reports and an anonymized GitHub and Azure incident. It examines the incident timeline and established scope, then explains how to check repositories, respond, and reduce the risk of a repeat.

CaseEntry pointHow secrets leaveWhere traces remain
tj-actions/changed-files (2025-03)Tampered tags of a widely used ActionRead from runner memory and printed to the logWorkflow run logs
Shai-Hulud (2025-09)npm package install scriptStolen PAT plants a workflow that sends secrets outNew workflow file in the repository
GhostAction (2025-09, 2026-08 to 10)Workflow pushed with a hijacked accountReads the secret names the existing workflows use and sends them outCommits, outbound requests
Gheist (2026-09 onward)Workflow pushed with a stolen tokenBase32 into its own log, log downloaded, run deletedCommits (branches are deleted)
Anonymized GitHub and Azure incidentMalicious pushes using account permissions; initial exposure path unresolvedSecret references and base32 output code recoveredCommits, cloud sign-in and management records

Action tag tampering, npm install scripts, and stolen tokens converge on CI secret theft

Figure 1. Different entry points target secrets available during execution. Original conceptual diagram based on the GitHub advisory and the Checkmarx, GitGuardian, and Wiz reports cited in the cases below.

tj-actions/changed-files: a third-party Action as the entry point

Section titled “tj-actions/changed-files: a third-party Action as the entry point”

On March 14 and 15, 2025, an attacker repointed several version tags of tj-actions/changed-files to a malicious commit. According to the GitHub security advisory, more than 23,000 repositories used this Action. The malicious code printed the secrets of the running runner into the workflow log. For public repositories, anyone could read those logs. The incident was registered as CVE-2025-30066.

In this case, the repository owners did nothing wrong. Pinning an Action by tag, such as @v45, follows the tag wherever it moves.

An npm worm that appeared in September 2025. According to Checkmarx’s analysis, infected packages collected GitHub tokens, npm tokens and cloud credentials from the developer environment in an install script. They then used the stolen token to plant shai-hulud-workflow.yml in every repository it could reach. That workflow sent the repository’s secrets to the attacker’s webhook.

It started on a developer machine and spread into CI. A PAT stored in plain text in a development environment can travel this way.

GitGuardian reported this attack in September 2025. 3,325 secrets left 817 repositories across 327 accounts. The attacker used hijacked accounts to push a workflow named “Github Actions Security”. The workflow read the secret names the repository’s existing workflows already used and sent them to an external server with curl.

It came back in 2026. According to GitGuardian, it targeted 772 public repositories between August 31 and September 30, and on October 8 and 9 it spread to more than 30,000 repositories of 3,000 users and organizations. GitHub started blocking the workflow from running on October 9.

Wiz has tracked this attack since September 15, 2026. More than 13,500 branches were found across more than 850 accounts. With a stolen token, the tool creates a ci-sync- branch and commits a sync-check.yml workflow. The workflow base32-encodes secrets and prints them into its own run log. The tool downloads the log through the API and deletes the run seconds later.

Six steps from a stolen-token workflow push to base32 log output, log download, and run deletion

Figure 2. The run log acts as the exfiltration channel instead of an external server. Original diagram based on Wiz’s Gheist analysis. Secret access here is limited to what the job is allowed to read; the diagram does not imply automatic bypass of environment approval rules.

GitHub Actions job log showing the menu used to download logs

Figure 3. An ordinary job log example supplied by GitHub, not an attack capture. Logs can be downloaded through the UI or API, so a value printed there has left secret storage. Source: GitHub Docs, Using workflow run logs, GitHub, Inc., CC BY 4.0, used unchanged.

Wiz explains three details that make it work.

  • GitHub masks a secret in logs only when it appears verbatim. A base32-encoded value is not masked.
  • permissions: {} restricts only GITHUB_TOKEN. It does not restrict the secrets context.
  • If the repository has deployment environments, the tool builds one job per environment and reads environment secrets too.

According to Wiz, a recent GitHub control blocks this attack in public repositories. In private repositories and GitHub Enterprise environments, however, it has succeeded.

Unfamiliar workflows appeared across several repositories under a developer’s GitHub account. The branches were soon deleted, and the relevant workflow runs were no longer available when the investigation took place. At almost the same time, Azure recorded an application identity, a service principal, signing in, model deployment changes, and API key operations.

Account names, repository names, organization names, and addresses are omitted. The records in this case are incident material separate from the public reports cited above.

Taking the first malicious push as the reference point produces the following timeline. The relative times describe the order of observed events, not a proven credential transfer.

TimeObserved recordSource
About one hour earlierSimilar workflows were pushed to other repositories under another member’s account.GitHub events and commits
Reference pointA malicious workflow was pushed under the account being investigated.GitHub events and commits
About two minutes after the first pushAn anomalous cloud service principal sign-in was identified.Azure sign-in records
About one to two minutes after each pushThe newly created branches were deleted.GitHub events
Over roughly thirty minutesMalicious workflows were pushed to eight repositories under the account being investigated.Repository events and commits
At investigation timeThe relevant Actions runs were unavailable, while Azure retained model deployment and API key operations.Run listings and Azure management records

Evidence map linking malicious GitHub commits with Azure sign-ins and management operations

Figure 4. Original evidence map based on the incident records. Solid boxes represent recovered evidence and established scope; the dashed connection indicates proximity in time. Unresolved questions are grouped below. It does not depict a proven credential transfer. The PlantUML source is stored alongside the image.

QuestionAssessmentEvidence and remaining scope
Were malicious workflows pushed?ConfirmedEvents and commits established the pushes.
Did the workflows target secrets?ConfirmedThe recovered code referenced secrets and printed base32 output.
Were all requested secrets actually exfiltrated?UnresolvedNeither the run output nor the values received by the attacker were recovered.
Were cloud credentials abused?ConfirmedAn anomalous sign-in and subsequent management operations were identified.
Was the PAT obtained from another member’s secret?InferredThe timing and secret purpose align, but the token used was not identified.
Were repository contents exfiltrated in bulk?UnresolvedAvailable clone statistics showed no sign of bulk cloning. Those statistics cannot reveal file reads through the API.
How much was the service used, and what was the financial impact?UnresolvedManagement records alone cannot establish service request volume or billing impact.
  • It may run before a merge. A workflow triggered by a push may run without merging into the default branch. Trigger conditions and approval settings determine whether it executes.
  • It targets secrets available to the job. Repository and organization secret access rules and environment protections matter.
  • Transformed values may escape redaction. Do not assume encoded output will be masked automatically.
  • It reduces visible traces. Deleted branches and runs become harder to find in the interface. Missing records alone do not establish whether a workflow ran.
  • It looks like normal work. Commits carry the victim’s own name, and branch names and messages look ordinary.

Scope and limits of account events, malicious commits, clone statistics, and cloud logs

Figure 5. Original diagram of what each investigation source can show. Correlate these sources using the commands and methods in the sections below.

The account events API shows branch creation, pushes and deletions from the last 90 days. Be suspicious of “create branch, push, delete branch” repeated across several repositories in a short time.

Terminal window
gh api "users/<user>/events?per_page=100" --paginate \
--jq '.[] | [.created_at, .type, .repo.name, (.payload.ref // "")] | @tsv'

Deleting a branch does not make its commit unreachable right away. Use the head SHA recorded in the PushEvent to recover the malicious workflow.

Terminal window
gh api repos/<owner>/<repo>/commits/<sha> --jq '.files[].filename'
gh api "repos/<owner>/<repo>/contents/<workflow-path>?ref=<sha>" --jq .content | base64 -d

Match the secret names the malicious workflow read against where the repository’s original workflows use each one. Secret values cannot be read through the API, but names and usage tell you a lot.

Usage in the original workflowWhat it tells you
gitops_token: ${{ secrets.X }}A GitHub PAT that pushes to another repository
argocd_auth_token: ${{ secrets.X }}An Argo CD API token, not a GitHub PAT
password: ${{ secrets.X }} (docker login)A registry password

Identify the token’s owner through the person who registered the secret, issuance records, and audit evidence. Neither organization member counts nor secret names establish that a PAT belongs to a particular person.

If a cloud credential is suspected, check Azure service principal sign-ins and Activity Log operations such as listKeys, regenerateKey, and deployment creation. Compare the caller, timing, and source IP with normal automation. Timing and IP alone do not establish how a particular secret was transferred.

The Traffic API shows git clones per day for the last 14 days. It tells you whether a private repository with no usual clones was cloned during the attack.

Terminal window
gh api repos/<owner>/<repo>/traffic/clones --jq '.clones[] | [.timestamp, .count, .uniques] | @tsv'

However, reading file contents through the API does not show up here. No clones does not mean nobody read the contents.

In your account’s Settings, Security log, look at events such as oauth_authorization, oauth_access, user.add_email and two_factor_authentication. Not every entry is suspicious. A GitHub App such as Copilot, for example, creates a token when you sign in (oauth_access.create) and may issue it again (oauth_access.regenerate). If the IP is yours and the app is one you use, it is normal.

The audit log API and git events such as clones are GitHub Enterprise Cloud features, so Free organizations cannot use them. Who read what with which token can only be answered by GitHub Support.

  1. Revoke tokens and sessions. Every PAT, unknown OAuth app and GitHub App authorizations, SSH keys, signed-in sessions.
  2. Rotate exposed secrets at their issuer. Deleting the GitHub secret is not enough. A value that already got out stays valid until you revoke it in the cloud, registry, database or external API.
  3. Check for persistence. Deploy keys, webhooks, self-hosted runners, app installations, organization invitations, outside collaborators.
  4. Check usage of keys that cost money. LLM API keys and cloud AI service keys can be used heavily right after theft.
  5. Clean secrets out of git history. How to do that is covered in Finding and Removing Secrets from Git History.
  • Use fewer classic PATs. Use fine-grained PATs or GitHub App tokens with short expiry. Do not put your PAT in the secrets of repositories other people use.
  • Switch cloud access to OIDC. Azure and AWS both support GitHub Actions OIDC. There is no stored secret left to steal.
  • Keep deployment secrets in environments. With approval rules and branch restrictions, not every branch can read them.
  • Tighten organization settings. Require 2FA, set GITHUB_TOKEN to read by default, restrict allowed Actions, lower the default member permission.
  • Pin third-party Actions to a commit SHA. The tj-actions case shows that tags can move.
  • The numbers and behavior for each case are as of when each report was published. The attacks keep changing.
  • GitHub’s control was reported for public repositories. For private repositories, check for yourself.
  • The anonymized case did not establish attribution to a specific campaign or operator.
  • Azure Activity Log primarily records management operations. Model calls and data reads require other evidence such as resource logs; management records alone cannot establish the full extent of data access or cost impact.