Security researchers at the Wiz Customer Incident Response Team (CIRT) have identified a sophisticated attack path they call "code-to-cloud," which allows threat actors to pivot from a compromised code repository into a production cloud environment. This attack leverages leaked or compromised GitHub Personal Access Tokens (PATs). Even a PAT with basic read-only permissions can be used to discover the names of GitHub Action Secrets, which often contain high-value credentials for Cloud Service Providers (CSPs). If the attacker obtains a PAT with write access, they can modify CI/CD workflows to exfiltrate these secrets and gain direct access to the victim's cloud infrastructure. This creates a stealthy and highly impactful attack vector that bypasses traditional network perimeter defenses.
The attack capitalizes on the tight integration between modern development platforms like GitHub and cloud environments (e.g., AWS, Azure, GCP). The core of the threat lies in the misuse of GitHub PATs, which are often over-provisioned and poorly monitored.
The attack flow proceeds as follows:
workflow write permissions, the attacker modifies an existing GitHub Actions workflow file or creates a new one. This malicious workflow is configured to access the discovered secrets and exfiltrate their values to an attacker-controlled server.This threat is exacerbated by poor security hygiene. Wiz data shows that 73% of organizations store CSP credentials in GitHub Action Secrets, and 45% have plain-text cloud keys in private code repositories.
This attack chain leverages several MITRE ATT&CK techniques:
T1552.006 - Unsecured Credentials: GitHub Personal Access Tokens. This is the entry point of the attack.T1598.003 - Spearphishing Link is not correct. It should be related to discovering cloud secrets. A better fit is T1552 - Unsecured Credentials as a general category, or a more specific discovery technique like T1087 - Account Discovery. The core action is discovering the existence of secrets.T1059.006 - Python or T1059.004 - Unix Shell within a malicious GitHub Actions workflow.T1530 - Data from Cloud Storage Object is not quite right. The action is collecting the secrets themselves. T1552.005 - Cloud Credentials is more appropriate as the goal.T1562.007 - Disable or Modify Cloud Firewall is not correct. A better fit is T1070.005 - Network Share Connection Removal or more generally T1564 - Hide Artifacts by deleting workflow logs/files.Let's refine the TTPs:
T1552.006 - Unsecured Credentials: GitHub Personal Access TokensT1059 - Command and Scripting Interpreter via CI/CD pipeline modification.T1552.005 - Cloud CredentialsA successful code-to-cloud attack can be catastrophic, as it bridges the gap between development and production environments. Potential impacts include:
| Type | Value | Description |
|---|---|---|
log_source |
GitHub Audit Logs | Monitor for PATs being created with overly broad permissions or PATs that have not been used recently becoming active. |
api_endpoint |
GET /repos/{owner}/{repo}/actions/secrets |
While the search call itself may not be logged, monitor for any available API logs showing access to list secrets. |
log_source |
GitHub Actions workflow logs | Look for workflows that are unexpectedly modified, or new workflows that contain commands like curl, wget, or network connections to unknown IPs. |
log_source |
CloudTrail / Azure Activity Logs | Correlate GitHub activity with cloud activity. Alert on cloud API calls made from unexpected sources shortly after a CI/CD run. |
repo, workflow), and PATs being used from anomalous IP addresses or geographic locations. This is an application of D3FEND's D3-UGLPA: User Geolocation Logon Pattern Analysis.workflows directory in GitHub. Alert on any commit that modifies a workflow file, especially those that add new steps involving shell commands or network requests. This is a form of D3-SFA: System File Analysis.D3-ANCI: Authentication Cache Invalidation.workflow or write permissions.While not directly protecting PATs, enforcing MFA on GitHub user accounts makes the initial compromise needed to create a PAT much harder.
Mapped D3FEND Techniques:
This is a proxy for identity management. The best mitigation is using OIDC for ephemeral, short-lived credentials instead of static PATs.
Mapped D3FEND Techniques:
The most effective defense against this 'code-to-cloud' attack is to eliminate the use of long-lived static credentials like GitHub PATs for cloud access. Implement OpenID Connect (OIDC) between your GitHub repository and your Cloud Service Provider (e.g., AWS, Azure, GCP). Configure a trust relationship that allows GitHub Actions workflows to assume a specific IAM role. This role will then grant short-lived, ephemeral credentials that are valid only for the duration of that specific workflow job. This approach ensures that even if an attacker compromises your repository, there are no persistent cloud credentials to steal. It completely removes the standing privilege that PATs with embedded CSP keys represent, directly mitigating the core threat of secret exfiltration.
For environments where PATs are still in use, implement robust monitoring of their activity. Ingest GitHub audit logs into your SIEM and establish a baseline of normal PAT usage. Create alerts for anomalous patterns, such as: 1) A PAT that has been dormant for a long period suddenly becomes active. 2) A PAT is used from a new or suspicious IP address or ASN. 3) A PAT associated with one repository is used to try and access another. 4) A PAT is used to modify a .github/workflows/ file outside of a pull request process. By analyzing access patterns, you can detect when a legitimate PAT has been compromised and is being used for malicious reconnaissance or to tamper with CI/CD pipelines.

Cybersecurity professional with over 10 years of specialized experience in security operations, threat intelligence, incident response, and security automation. Expertise spans SOAR/XSOAR orchestration, threat intelligence platforms, SIEM/UEBA analytics, and building cyber fusion centers. Background includes technical enablement, solution architecture for enterprise and government clients, and implementing security automation workflows across IR, TIP, and SOC use cases.
Help others stay informed about cybersecurity threats