
LLMjacking: how to keep stolen credentials off your Amazon Bedrock bill
Attackers use stolen cloud credentials to run AI models and leave you with the bill. This guide picks up where the baseline controls stop: how attacks unfold, what keeps a leaked key from being used, alerts that fire in minutes, what to do in the first hour, and a checklist for this week.
If you do one thing today: delete the access keys nobody uses, then turn on GuardDuty AI Protection. If a key is already out there, GuardDuty tells you before your bill does.
WHAT is LLMjacking
LLMjacking is a cyberattack in which threat actors steal or exploit cloud credentials, API keys, or identity tokens to gain unauthorized access to large language models (LLMs) and AI infrastructure. Attackers want the model capacity more than the data. They resell it through proxy services, and the account owner pays for every token. MITRE ATT&CK tracks it as T1496.004, and AWS's threat technique catalog as T1496.A007 .
Mandiant saw six-figure single-day charges in 2026, and one victim was billed nearly a million dollars. On AWS, the median case DoiT handled ran to five figures. Most victims found out from the bill. For a startup, that can be months of runway gone in a few days. Both reports are worth reading in full for the attack details.
Start with the baseline. Protect your startup's AI workloads from LLMjacking covers an IAM role for each agent, AI spend alerts, and GuardDuty AI Protection. This guide assumes a key leaks anyway: what stops it from being used, what alerts you within minutes, and what to do in the first hour.
What's inside:
- HOW LLMjacking works
- PREVENT: leave nothing to leak, and nothing a leaked key can use
- DETECT: see abuse in minutes
- RESPOND: the first hour
- A CHECKLIST for this week
Part 1: HOW LLMjacking works
Where attacks come from

Figure 1: Five entry points that recur in incident reports, and the control that closes each.
Agent and MCP config files are the newest source: GitGuardian found 24,008 unique secrets in the ones it studied. Attack traffic tends to come from hosting providers, VPNs, and Tor. Mandiant suggests checking user agents such as
claude-cli and aws-sdk-go-v2 . Compare them against the tools your team actually uses, since your own coding agents can send the same strings.Accounts that don't use Bedrock are easy targets. Nobody watches AI spend there, and Mandiant found victims whose LLM services the attacker turned on. Deny Bedrock with an SCP in accounts that don't need it, and alert on any use.
How an attack unfolds

Figure 2: Every step before the spend is a chance to stop it.
Step | What the attacker does | What you'd see |
|---|---|---|
1. Find | Pulls keys from repos, CI logs, and agent configs | AWS Health event AWS_RISK_CREDENTIALS_EXPOSED , secret-scanning alerts |
2. Scout | Lists models in every Region and sends invalid or max_tokens=1 requests to confirm access cheaply. Can start weeks early | Model-listing calls and InvokeModel errors from unknown identities and IPs |
3. Expand | Gets a console session with GetFederationToken , adds keys and users, accepts model agreements, requests quota increases | CloudTrail GetFederationToken , CreateAccessKey , CreateUser , CreateFoundationModelAgreement , RequestServiceQuotaIncrease |
4. Monetize | Runs proxy traffic to the priciest models in every Region, around the clock | Token spikes, GuardDuty AI Protection findings |
How Bedrock credentials work

Figure 3: Four kinds of credentials can call Bedrock, through two endpoints with separate IAM namespaces.
The attacker doesn't break Bedrock. They sign in with your valid credentials, so under the shared responsibility model the controls that stop them are yours to operate. Three facts shape the controls that follow:
- Bedrock API keys are bearer tokens. Whoever holds the string can use it, from anywhere. AWS's guidance on securing Bedrock API keys covers both key types.
- There are two inference endpoints.
bedrock-runtimeuses thebedrock:IAM namespace andbedrock-mantleusesbedrock-mantle:, so a deny or alert for one misses the other. Plerion found that AWS's quarantine policy for leaked keys didn't block Mantle inference. Mantle inference is logged only as CloudTrail data events, which are off by default.
- Third-party models bill through AWS Marketplace, as "... (Amazon Bedrock Edition)". A budget filtered on the Bedrock service misses them.
Part 2: PREVENT: leave nothing to leak, and nothing a leaked key can use
Layer 1: replace static keys
Who needs access | Use instead |
|---|---|
People | IAM Identity Center , and aws login for the CLI |
CI/CD pipelines | OIDC federation to an IAM role |
Outside AWS | IAM Roles Anywhere |
Coding agents and MCP servers | An SSO profile or |
Tools that only take an API key | A short-term key minted at runtime with the
, or a gateway (below) |

Illustration: It's an easy shortcut to take when you're moving fast. A key pasted into an MCP config is the same shortcut, and the worn buttons are a reminder that a code in use for years leaves traces even after the note comes down.
Put a gateway in front of tools that need keys

Figure 4: With a gateway, the only identity that can call Bedrock is the gateway's IAM role.
AWS's Guidance for Multi-Provider Generative AI Gateway deploys LiteLLM this way, and the Claude apps gateway does it for Claude Code. Treat the gateway as a high-value target: keep its keys out of config files, require authentication on it, and patch it. Mandiant saw attackers use a LiteLLM flaw ( CVE-2026-40217 ) to turn ordinary keys into admin keys.
Layer 2: guardrails a stolen key can't remove
- Separate accounts. Give AI workloads their own accounts, deny Bedrock everywhere else, and keep workloads out of the management account, where SCPs don't apply. My guide on untangling a single AWS account helps if you're starting from one.
- Allowlist models and Regions in both namespaces. Use the
bedrock-mantle:Modelcondition key for Mantle, and remember that global inference profiles are evaluated withaws:RequestedRegionset tounspecified.
- Bind credentials to your network with
aws:SourceVpceoraws:SourceIp, so a copied credential fails elsewhere. AWS's post on controls that help prevent access from unexpected networks shows how.
- Put AI spend in one Cost Category with two rules, the Bedrock service and the Marketplace billing entity, and run budgets from the management account.
The guardrail SCP
A service control policy (SCP) caps permissions in every account it's attached to, and nobody inside the account can remove it. AWS publishes sample SCPs for Amazon Bedrock for the most common goals. Pick the ones that match how your teams use Bedrock:
- No Bedrock API keys at all, short-term or long-term
- Short-term keys only, with long-term keys blocked
- Long-term keys for a team that needs them, capped at 30 days
- Only approved models
Attackers also use four moves that AWS doesn't publish samples for yet. Each is a short deny statement you can add to the same SCP:
- Turning an API-key user into a full credential: deny
iam:CreateAccessKeyon users namedBedrockAPIKey-*.
- Getting a console session from a stolen key: deny
sts:GetFederationToken. Check CloudTrail first that nothing legitimate calls it.
- Enabling new models: deny
bedrock:CreateFoundationModelAgreement,bedrock:PutUseCaseForModelAccess, andaws-marketplace:Subscribeto everyone except your platform role. This also blocks other Marketplace purchases, so attach it to AI OUs or exempt your procurement role.
- Switching off prompt logging: deny
bedrock:PutModelInvocationLoggingConfigurationandbedrock:DeleteModelInvocationLoggingConfigurationto everyone except your security role.
Attach any SCP to a non-production OU first, confirm your workloads still run, then roll it out.
Part 3: DETECT: see abuse in minutes

Figure 5: Only the tripwires fire in minutes. Billing alerts are the backstop.
The baseline article covers GuardDuty AI Protection findings and billing alerts. Add these faster signals:
Signal | Where it shows up |
|---|---|
AWS found an exposed key | AWS Health event AWS_RISK_CREDENTIALS_EXPOSED , or a quarantine policy on a user (
) |
Root used | CloudTrail events where userIdentity.type is Root (
) |
Logging turned off | GuardDuty DefenseEvasion:IAMUser/BedrockLoggingDisabled , CloudTrail DeleteModelInvocationLoggingConfiguration |
Scouting | ValidationException or AccessDenied errors on InvokeModel , or ListFoundationModels calls, from unknown identities |
New key, user, model, or quota | CloudTrail CreateServiceSpecificCredential , CreateAccessKey , CreateUser , CreateFoundationModelAgreement , RequestServiceQuotaIncrease |
API key used | CloudTrail field callWithBearerToken: true (in additionalEventData for bedrock-runtime , in
), from an identity or IP you don't expect |
Token spike | CloudWatch token metrics in AWS/Bedrock and AWS/BedrockMantle , in every Region |
Test each alert with one call from a short-term key in a sandbox account. Once a quarter, rehearse the whole thing: leak a sandbox key, see who gets paged, attach the emergency SCP from Part 4, and time it.
Part 4: RESPOND: the first hour

Figure 6: The prefix tells you what leaked and how to contain it.
1. Contain on suspicion. Charges accrue while you investigate. Follow Figure 6, and for
AKIA keys also revoke active sessions on every role the user could assume. If you're not sure what leaked, attach an emergency SCP that denies bedrock:* and bedrock-mantle:* to everyone except your incident-response role. Write and test it before you need it, and leave it unattached. To switch off a leaked key, deactivate it first and delete it once anything legitimate that used it has a replacement. AWS's guides cover IAM access keys and Bedrock API keys . For a long-term Bedrock key, also delete its BedrockAPIKey-* user, which deleting the key leaves behind.2. Scope it in every Region, including ones you never use. Search CloudTrail from when the key leaked, not when you noticed. CloudTrail records the caller's identity on every call it logs. If you turned on IAM principal cost allocation in CUR 2.0 beforehand, Bedrock costs also show which principal ran up the tokens.
3. Hunt for persistence: new IAM users, keys, and roles (Mandiant saw backdoor accounts named like internal billing tools), Marketplace subscriptions, GPU instances, SES, and changes to your account contacts.
4. Work with AWS on one case. If AWS hasn't opened one, open a case from the affected account and say it's a security incident. The AWS Customer Incident Response Team (CIRT) helps at no additional charge, on any support plan .
5. Fix the source, then rotate everything nearby. DoiT saw a second wave arrive six days into an incident through a key nobody rotated.
For the full procedure, follow GuardDuty's Remediating potentially compromised AWS credentials and the Bedrock security response playbook .
Part 5: A CHECKLIST for this week
- Point AWS's notices at a team, and lock down root. Set the billing, operations, and security alternate contacts to distribution lists in every account. Send the root email to a group alias on a domain you own, protect root with a passkey or security key , and centralize root access for member accounts. Root user best practices cover the rest.
- Delete long-lived credentials nobody owns, including Bedrock API keys and their
BedrockAPIKey-*users. IAM Access Analyzer lists unused ones.
- Attach the guardrail SCPs from Part 2 to your workload organizational units (OUs).
- Put the baseline in place: GuardDuty AI Protection, AI spend budgets, and Cost Anomaly Detection, from Controls 2 and 3 of the baseline article . Enable GuardDuty from a delegated administrator with auto-enable on, set repeat-finding notifications to 15 minutes, and include Marketplace charges in the budget.
- Log Mantle, or block it. Log CloudTrail data events for
AWS::BedrockMantle::Project, or denybedrock-mantle:*if nothing uses it.
- Add the tripwires from Part 3, which fire in minutes rather than hours.
- Pre-stage the emergency SCP from Part 4, unattached, and agree who can attach it.
If you work in VS Code, Cursor, or Kiro, AWS Startup Advisor alerts you when AWS has quarantined one of your leaked keys or the account has no billing alerts.
These are recommendations, not a guarantee of security. Verify service behavior against current AWS documentation before you make production changes.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article