aws-credential-compromise
Skill0 starsChanged 12 days agoMITView on GitHub
Respond to compromised AWS credentials — leaked access keys (e.g. in GitHub), stolen role session tokens, console account takeover — by containing (deactivate keys, revoke role sessions, deny policies), scoping actions in CloudTrail across regions/accounts, removing persistence and recovering. Use when an AWS key is exposed, AWS sends a compromised-key notice, or GuardDuty flags credential misuse.
In this repository273 other files it gives its agents.
- ad-attack-path-analysisSkill
- adcs-security-reviewSkill
- ad-privileged-access-reviewSkill
- dcsync-detectionSkill
- gpo-security-reviewSkill
- kerberos-attack-detectionSkill
- agent-tool-permission-reviewSkill
- ai-incident-responseSkill
- llm-gateway-controlsSkill
- llm-security-evaluationSkill
- mcp-server-security-reviewSkill
- model-artifact-securitySkill
- prompt-injection-reviewSkill
- rag-security-reviewSkill
- api-abuse-detectionSkill
- api-authorization-testingSkill
- api-inventorySkill
- api-schema-securitySkill
- dast-baselineSkill
- sast-triageSkill
- sca-dependency-riskSkill
- secure-code-reviewSkill
- security-requirementsSkill
- threat-modelingSkill
- asset-criticality-tieringSkill
- asset-inventory-reconciliationSkill
- external-attack-surface-reviewSkill
- shadow-it-discoverySkill
- aws-iam-reviewSkill
- aws-org-guardrailsSkill
- cloudtrail-investigationSkill
- guardduty-triageSkill
- s3-exposure-reviewSkill
- azure-activity-investigationSkill
- azure-rbac-reviewSkill
- conditional-access-reviewSkill
- entra-audit-investigationSkill
- entra-signin-investigationSkill
- backup-assuranceSkill
- critical-service-mappingSkill
- ransomware-recoverySkill
- recovery-exerciseSkill
- cloud-exposure-reviewSkill
- cloud-incident-responseSkill
- cloud-logging-baselineSkill
- cloud-posture-assessmentSkill
- audit-evidence-packageSkill
- continuous-control-monitoringSkill
- control-mappingSkill
- control-testing-samplingSkill
- container-incidentSkill
- dockerfile-hardeningSkill
- image-scanningSkill
- runtime-detection-falcoSkill
- db-audit-loggingSkill
- db-exfiltration-investigationSkill
- db-hardeningSkill
- db-privilege-reviewSkill
- data-classificationSkill
- data-discoverySkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
If the instance profile credentials were stolen (IMDS), revoking role sessions affects the legitimate instance too — plan a restart/new …
- Very specific: line 41
Delete attacker resources (after evidence export), remove persistence (users/keys/roles/trusts/IdPs), rotate other credentials that were …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AWS Credential Compromise
Contain (minutes)
# Long-term key (AKIA...): deactivate (don't delete yet — keep for investigation)
aws iam update-access-key --user-name <user> --access-key-id AKIA... --status Inactive
# Find the owning user if unknown
aws iam list-access-keys --user-name <user> # or: aws sts get-access-key-info --access-key-id AKIA... (returns account)
# Role sessions (ASIA...): revoke all sessions issued before now via the console "Revoke active sessions",
# which attaches the AWSRevokeOlderSessions inline policy, or attach an equivalent deny:
cat > revoke.json <<'J'
{"Version":"2012-10-17","Statement":[{"Effect":"Deny","Action":"*","Resource":"*",
"Condition":{"DateLessThan":{"aws:TokenIssueTime":"2025-03-01T12:00:00Z"}}}]}
J
aws iam put-role-policy --role-name <role> --policy-name RevokeOlderSessions --policy-document file://revoke.json
# Console user: remove login profile / reset password, enforce MFA
aws iam delete-login-profile --user-name <user>If the instance profile credentials were stolen (IMDS), revoking role sessions affects the legitimate instance too — plan a restart/new role.
Scope (hours)
- Query all regions and all accounts reachable (the key's account + any role it assumed) for the key/session (
cloudtrail-investigation). IncludeAccessDeniedattempts — they reveal intent. - List everything created/modified: users, keys, roles, policies, trust changes, EC2 instances (cryptomining in many regions), Lambda functions, security groups, snapshots shared, S3 policies, SES/SNS (spam abuse), billing anomalies.
- Determine data access: S3 data events,
GetSecretValue, RDS snapshots, DynamoDB exports. - Find the exposure source: public repo, CI logs, developer laptop, SSRF to IMDSv1.
Eradicate & recover
Delete attacker resources (after evidence export), remove persistence (users/keys/roles/trusts/IdPs), rotate other credentials that were accessible (Secrets Manager, Parameter Store, database passwords), enforce IMDSv2, add SCP guardrails (aws-org-guardrails), respond to the AWS Support case (AWS may restrict the account until resolved).
Output
Key/session | Owner | Exposure source | First malicious use | Regions/accounts | Actions taken by attacker | Resources created | Data accessed | Containment time | Remediation
Related skills
cloudtrail-investigation, secret-leak-response, guardduty-triage, cloud-incident-response
References
- AWS: What to do if you inadvertently expose an access key: https://repost.aws/knowledge-center/potential-account-compromise
- Revoking IAM role temporary credentials: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_revoke-sessions.html
- AWS Customer Playbook Framework: https://github.com/aws-samples/aws-customer-playbook-framework
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

