AWS Builder Center
LLMjacking: how to keep stolen credentials off your Amazon Bedrock bill

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

Five places cloud AI credentials leak from, each with the control that closes it

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

Four steps from a leaked key to a bill, find, scout, expand, and spend, each with the control that b

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

Four credential types, two using SigV4 and two bearer tokens, can all call both Bedrock inference en

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:
  • There are two inference endpoints.  bedrock-runtime  uses the  bedrock:  IAM namespace and   bedrock-mantle   uses  bedrock-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

Control 1 of the  baseline article  covers roles for agents and workloads on AWS. The other callers:
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)
A door keypad with the code 1024 written on a note taped above it, and the 1, 0, 2, and 4 keys worn

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

Callers hold capped gateway keys; only the gateway's IAM role calls Amazon Bedrock

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:Model  condition key for Mantle, and remember that  global inference profiles  are evaluated with  aws:RequestedRegion  set to  unspecified .
  • 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:CreateAccessKey  on users named  BedrockAPIKey-* .
  • 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 , and  aws-marketplace:Subscribe  to 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:PutModelInvocationLoggingConfiguration  and  bedrock:DeleteModelInvocationLoggingConfiguration  to 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



Timeline: GuardDuty, token alarms, and CloudTrail rules fire within minutes; Budgets and Cost Anomal

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



Decision tree: identify the leaked credential by its prefix, then take the matching containment acti

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.

Part 5: A CHECKLIST for this week



  1. 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.
  1. Delete long-lived credentials nobody owns, including Bedrock API keys and their  BedrockAPIKey-*  users. IAM Access Analyzer lists unused ones.
  1. Attach the guardrail SCPs from Part 2 to your workload organizational units (OUs).
  1. 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.
  1. Log Mantle, or block it. Log CloudTrail data events for  AWS::BedrockMantle::Project , or deny  bedrock-mantle:*  if nothing uses it.
  1. Add the tripwires from Part 3, which fire in minutes rather than hours.
  1. 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.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article