How Attackers Use GitHub PATs to Move from Repositories into Cloud Environments

· Original article ↗

Summary

Wiz CIRT describes incidents where attackers used compromised GitHub PATs to find Actions secrets, run malicious workflows, obtain cloud credentials, move into cloud environments and delete evidence. The article also highlights audit-log gaps and investigation steps.

Key points

  • Wiz CIRT reports multiple incidents in which attackers used compromised GitHub PATs with standard developer permissions to abuse trust between repositories and cloud accounts.
  • Attackers can search repository code for GitHub Actions secret names even without admin-level access to enumerate the secrets themselves.
  • With write permissions, a compromised PAT can be used to create workflows that run attacker-controlled code and access Actions secrets.
  • Wiz observed attackers bypassing GitHub’s secret masking by encoding secret values multiple times, or exfiltrating them to attacker-controlled webhooks.
  • Attackers used obtained cloud credentials for lateral movement and, in some cases, created new cloud keys for persistent access.
  • PATs with write scopes can also be used to delete workflow logs, runs, pull requests and branches, hindering investigation.
  • Wiz says code-search API calls are not logged and IP tracking is opt-in; it recommends real-time enterprise audit-log streaming and enabling IP tracking for investigations.

Article Details

Attack Vectors
  • Attackers use compromised GitHub Personal Access Tokens (PATs) to search repository code for GitHub Actions secret names, then create or modify workflows to access those secrets.
  • PATs with write permissions can be used to create workflows and pull requests that run attacker-controlled code on GitHub Actions, with results retrieved from workflow logs.
  • Attackers can bypass GitHub Actions secret masking by encoding a secret twice with Base64, or exfiltrate secrets to an attacker-controlled webhook endpoint.
  • Cloud credentials obtained through Actions secrets can be used to create additional cloud credentials and move laterally into the victim's cloud environment.
  • Attackers may use a compromised PAT to delete workflow logs, workflow runs, pull requests, and branches to hinder investigation.
  • The article describes the tj-actions/changed-files supply-chain attack as involving a malicious payload that leaked secrets from affected repositories into logs.
Defensive Notes
  • Grant principals associated with GitHub Actions secrets the minimum permissions necessary and manage stored cloud credentials cautiously.
  • Enable real-time GitHub Enterprise audit log streaming and opt-in IP tracking to preserve API request details for investigations.
  • Use secret scanning across repository code, Git history, and branches; rotate or revoke exposed secrets.
  • Prevent secrets from being committed with pre-commit hooks, IDE extensions, and CI/CD or VCS scanning.
  • Monitor abnormal PAT behavior, unusual Actions usage, high-volume activity, and workflow-based secret exfiltration.

MITRE ATT&CK

People

Vendors

Products

Tools

Related Articles