AWS Credentials Used from GitHub Actions and Non-CI/CD Infrastructure
Attackers are stealing AWS credentials configured as GitHub Actions secrets and using them from non-CI/CD infrastructure, indicating potential credential theft and unauthorized access to AWS resources.
This threat involves the unauthorized use of AWS credentials stolen from GitHub Actions secrets. Attackers exfiltrate these credentials and use them from their own infrastructure, bypassing the intended CI/CD environment. The activity is detected by observing AWS access keys appearing in CloudTrail logs originating from both legitimate GitHub Actions runners (identified by Microsoft ASN or the github-actions user agent string) and suspicious infrastructure outside the expected CI/CD provider ASNs (Amazon, Google, Microsoft). This indicates a breach of GitHub repository or organization secrets, leading to potential unauthorized access and control over AWS resources. This activity can begin with compromised Github accounts.
Attack Chain
- An attacker gains unauthorized access to a GitHub repository or organization with AWS credentials stored as secrets.
- The attacker exfiltrates the AWS access key ID and secret access key, either manually or through automated means, such as modifying a GitHub Action workflow to expose the secrets.
- The attacker configures the stolen AWS credentials on their own infrastructure, using tools like the AWS CLI or boto3.
- The attacker attempts to authenticate to AWS using the stolen credentials. This generates CloudTrail logs with the attacker’s source IP address and ASN.
- The attacker performs reconnaissance activities, such as calling
sts:GetCallerIdentity,ListBuckets,DescribeInstances, orListUsers, to understand the AWS environment and identify potential targets. - The attacker attempts to escalate privileges or move laterally within the AWS environment by exploiting the compromised credentials.
- The attacker may create, modify, or delete AWS resources, such as EC2 instances, S3 buckets, or IAM roles, depending on the permissions associated with the stolen credentials.
Impact
Successful exploitation leads to unauthorized access to AWS resources, potentially resulting in data breaches, service disruptions, or financial losses. The impact depends on the permissions associated with the stolen AWS credentials. A single compromised credential could expose sensitive data, disrupt critical services, or allow attackers to deploy malicious infrastructure within the victim’s AWS environment. Identifying and responding to this threat quickly is vital to minimize damages.
Recommendation
- Deploy the Sigma rule “AWS Credentials Used from GitHub Actions and Non-CI/CD Infrastructure” to your SIEM and tune for your environment to detect suspicious usage patterns.
- Rotate the compromised AWS access key in IAM immediately and update the corresponding GitHub repository/organization secret as described in the rule documentation.
- Implement OIDC-based authentication (
aws-actions/configure-aws-credentialswithrole-to-assume) instead of long-lived access keys as mentioned in the rule documentation. - If using OIDC, add IP condition policies to the IAM role trust policy to restrict
AssumeRoleWithWebIdentityto known GitHub runner IP ranges, based on the information in the rule documentation.
Detection coverage 2
AWS Credentials Used from Non-CI/CD Infrastructure
highDetects AWS access keys used from non-CI/CD infrastructure, indicating potential credential theft.
AWS Credentials Used by GitHub Actions User Agent from Non-CI/CD Infrastructure
highDetects AWS access keys used by the GitHub Actions user agent string from non-CI/CD infrastructure.
Detection queries are kept inside the platform. Get full rules →