agentleFS
kaandgnshkaandgnsh/Claude-Blue/skills/aws-security/aws-credential-compromise/SKILL.md

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.

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
  1. Distinctive:

    If the instance profile credentials were stolen (IMDS), revoking role sessions affects the legitimate instance too — plan a restart/new …

    line 30
  2. Very specific:

    Delete attacker resources (after evidence export), remove persistence (users/keys/roles/trusts/IdPs), rotate other credentials that were …

    line 41

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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)

  1. Query all regions and all accounts reachable (the key's account + any role it assumed) for the key/session (cloudtrail-investigation). Include AccessDenied attempts — they reveal intent.
  2. 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.
  3. Determine data access: S3 data events, GetSecretValue, RDS snapshots, DynamoDB exports.
  4. 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

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.