· 7 min read Software Engineering
Get the AWS Keys Off Your Computer
Black October put AI-found bugs in the headlines, and the same month, package malware went after AWS keys on developer machines. Here is a Claude Code prompt that replaces long-lived keys with short-lived credentials, and what the switch still leaves exposed.

October 2026 picked up a name: “Black October”. It was a name that was circulating X (formerly twitter) to describe the deluge of cybersecurity incidents since frontier models started finding serious bugs.
AWS keys on developer machines are a major target, and we need to start taking cybersecurity seriously.
What AI Changed
AI models are finding serious bugs. CNBC reports that researchers at Wiz and Calif found the PHP flaws with AI models, and former CISA director Chris Krebs told CNBC that “3% of all critical vulnerabilities ever discovered have been found in the last month.”
A stolen credential skips that work. Wiz says most of its incidents are still being analyzed, but Fireworks, Zeabur, and Lightning “all attribute their incident root causes to credential access.”
October’s package malware went looking for AWS keys and AI tool sessions. Aikido lists ~/.aws/credentials among the targets of tensorlake 0.5.144. Datadog says the litellm 1.107.0 malware collects AWS credentials and “sessions for Claude, Codex, Gemini, Cursor, Copilot and other AI coding tools”.
What aws login Changes
AWS docs say aws login issues credentials that refresh every 15 minutes, for a session of at most 12 hours. They still land on disk, in ~/.aws/login/cache. I infer a stolen cache works until the session ends, up to 12 hours, but I didn’t test that. Wiz says the Shai-Hulud 2.0 malware also looks for short-lived tokens.
The Old Key Still Wins
After aws login, the old key still wins until you remove it, because the AWS CLI 2.39.3 source checks the shared credentials file before login. So aws sts get-caller-identity, the check in AWS’s own walkthrough, passes against the old key and proves nothing.
The CLI also refuses a login on a profile that holds a key, so hide the file: AWS_SHARED_CREDENTIALS_FILE=/dev/null aws login.
The Claude Code Prompt
Read it before you paste it.
Move this machine off long-lived AWS access keys for one target:
- AWS account ID: ACCOUNT_ID
- AWS CLI profile: PROFILE
Safety rules:
- Never print secret values, full access key IDs, or the raw contents of ~/.aws. Show only profile names, setting names, and the last 4 characters of a key ID.
- Call AWS only with the target profile. Other keys might belong to clients or former employers.
- Don't deploy, publish, or delete a key.
- If a permission check blocks an action, stop and tell me. Don't look for another route.
1. Audit with read-only commands:
- The AWS CLI version. `aws login` needs 2.32.0 or later.
- Profiles in ~/.aws/credentials and ~/.aws/config. Flag keys stored in config, profiles that share a key, and profiles that use `role_arn`, `sso_*`, `credential_process`, or `web_identity_token_file`.
- AWS_* environment variable names, and shell startup files that export keys.
- The credential report: run `aws iam generate-credential-report`, then `aws iam get-credential-report`. It contains no key IDs. Use it for the target user's console password, MFA, key age, and last use. Also use it for root MFA, root keys, and other IAM users with active keys.
- The target user's direct and group policies.
- AWS Organizations status and IAM Identity Center status.
- How the current repo's deploy and CI authenticate, and which tools use this profile.
2. Recommend an approach:
- Use `aws login` for one person in one account. An IAM user needs a console password.
- Use IAM Identity Center only if I want one sign-in across several accounts I own. It needs AWS Organizations to grant access to AWS accounts.
- Show me the findings and the plan, then wait for my go-ahead.
3. Check permissions:
- Run `aws iam simulate-principal-policy` for `signin:AuthorizeOAuth2Access` and `signin:CreateOAuth2Token`.
- Pass both action names on the command line, not in a shell variable, because zsh doesn't split an unquoted variable.
- Propose attaching `SignInLocalDevelopmentAccess` only if the simulator denies one of them.
4. Confirm that the profile has a region. If it doesn't, ask me for one and run `aws configure set region REGION --profile PROFILE`. Without a region, `aws login` prompts for one and can fail without a terminal.
5. Ask me to run this command. Drop `--profile` if the target is `default`.
`! AWS_SHARED_CREDENTIALS_FILE=/dev/null aws login --profile PROFILE`
- The `!` prefix runs the command in this Claude Code session.
- The CLI refuses to add a login to a profile that already has a key.
- This command hides ~/.aws/credentials, so the key stays in place until the login is verified.
- It doesn't help if the profile has a key or role settings in ~/.aws/config. In that case, stop and ask me.
6. Confirm the login with `AWS_SHARED_CREDENTIALS_FILE=/dev/null` set on both commands. Add `--profile PROFILE` unless the target is `default`:
- `aws sts get-caller-identity` returns the expected user.
- `aws configure list` reports the credential type as `login`.
Without the variable, the old key wins: the first check still returns the expected user, and the second reports `shared-credentials-file`.
7. Remove every profile that uses the target key from ~/.aws/credentials:
- Write the new file to a temporary path with mode 600.
- Check its profile names and key count, and confirm that the old key is absent.
- Replace the original with `/bin/mv -f`, because `mv` might be aliased to `mv -i`.
- Keep no backup of the secret.
- Tell me which profile names you removed.
8. Without the variable, confirm that the normal credential chain reports type `login`. Also check that a new shell has no `AWS_ACCESS_KEY_ID` set. Naming `--profile` makes the CLI skip key environment variables, so it hides a leftover export.
9. Test the deploy path without publishing:
- Run its S3 commands with `--dryrun`.
- Run read-only calls against the other services it uses.
- Simulate its write actions with `aws iam simulate-principal-policy`. The simulator doesn't read bucket policies, so an `allowed` result is partial evidence.
10. Deactivate the old key, then confirm that the login session still works. Don't delete the key.
11. Report:
- What changed and how you verified it.
- What's still unverified, including any real deploy and any tool on an older AWS SDK.
- Which keys remain on this machine.
- Any key in the account that something else might depend on.
Then ask me which remaining profiles I still own. Remind me to delete the old key after a few days with no breakage.Doing It by Hand
The AWS CLI guide has the aws login steps, and the IAM guide covers deactivating and deleting a key. Keep this order: sign in with AWS_SHARED_CREDENTIALS_FILE=/dev/null, run aws configure list with the same override and require type login, remove the key from ~/.aws/credentials, repeat the check without the override, deactivate the key in IAM, and delete it after a few days with no breakage.
Trade-offs
aws login still leaves live credentials on disk. I found no AWS doc on revoking a session, and aws logout only clears the local cache. Some tools can break: on 2026-11-06, the AWS SDK reference table lists login credentials as unsupported in 4 of its 17 SDKs and tools, including the SDK for Go V2 and the SDK for JavaScript 2.x. Check which SDK your deploy tool uses.
For several accounts, use IAM Identity Center. For CI, use GitHub’s OIDC integration, not stored keys. For one person in one account, pick aws login. The tradeoff: you sign in again at least every 12 hours, and a tool on an unsupported SDK needs another credential source.
Resources and References
- CNBC: “Black October” and the AI-found PHP flaws
- NBC News: the early read on successful attacks
- BleepingComputer: the CISA listing
- Wiz on Black October: the AI developer platform attacks
- Aikido: the
tensorlakecompromise - Datadog: the
litellmcompromise - Wiz on Shai-Hulud 2.0: behavior and credential counts
- AWS Security Blog: the
aws loginwalkthrough - AWS SDK reference: the SDK support table
- AWS CLI 2.39.3 source:
ProfileProviderBuilder.providers()lists the shared credentials file before login - Identity Center instances: what it needs
- GitHub OIDC in AWS: Actions without stored keys