Skip to main content

Unexpected AI API usage: how to investigate a suspected stolen key

A spike in model API usage can come from a legitimate workload or a stolen key. Here’s how to tell them apart, preserve the evidence and contain the affected application.

Published
Reading time
3 min
Call the incident line: +91 22 4164 2220Answered 24/7 for active incidents.
On this page (4)

An unexpected spike in your AI bill leaves you with an immediate question. Which application made the requests? A legitimate batch job, a retry loop or a leaked key can all push up the same graph. If you can only see a total for the whole organisation, get to the level of an individual project or credential before drawing a conclusion.

In a November report, Amazon Threat Intelligence described a campaign in which stolen model credentials paid for more AI calls used in subsequent criminal activity. That puts unusual model usage on the incident response desk alongside unusual sign-ins or cloud activity. Here is how finance, engineering and security can work from the same evidence.

Match usage to the applications that should have generated it

Start with the provider’s usage records for the affected period. Note the time zone, the affected project, the model and the credential identifier, if your provider exposes it. Compare the activity export with your application or gateway logs for the same period. Look for changes you can account for, such as a deployment, a backlog replay or a switch to a different model. Keep any provider request IDs that help tie the two sides together.

Document how complete your logs are. A gap in application telemetry can leave legitimate requests unaccounted for. If several applications use the same key, list them and their owners, and compare their recorded activity before treating a mismatch as confirmed abuse. An invoice helps establish the amount billed. The activity and application records help establish what happened.

Preserve enough evidence to act on the right credential

Capture the relevant provider usage export, alert timestamp and project or key identifiers. Preserve the related gateway, application and secrets-management logs where available, along with the relevant changes to deployments and permissions. Record who collected each export and the time range it covers. Leave the secret value out of the incident ticket and any support request. If suspicious traffic is still running, start containment while someone else collects the records. See the guide to preserving evidence before rebuilding.

Work out what the affected credential could do. Some keys only call a model. Others can reach additional resources associated with a project. Review the key’s actual permissions and the provider's audit records before describing the incident as unauthorised consumption, access to stored data or both.

Revoke the suspect key and check what keeps working

Have the application owner and the responder coordinate revocation and recovery. When active misuse is likely, revoke the suspect key promptly and restore necessary workloads with scoped replacements. Confirm that expected traffic succeeds on the replacement and that the old credential can no longer make requests. Check the provider records again for unexplained usage, allowing for the provider’s normal reporting delay. Where a leaked secret may have sat alongside other credentials, widen the review to those credentials as well.

Alerting can buy time. Check whether a spend threshold only sends a notification or actually stops requests, who receives the alert and whether they can reach someone authorised to revoke a credential. An organisation-wide block may also stop healthy applications, so agree when that trade-off is justified.

Make the next alert easier to resolve

Give production workloads distinct, narrowly scoped credentials where the provider supports them. Keep a simple record of the application, its project, the key identifier, the owner and the person who can revoke it out of hours. During a drill, pick a workload and see whether the on-call team can trace activity to its owner and replace a test credential while a separate workload keeps running.

Carry the evidence, containment decisions and recovery checks into your incident timeline. A closed investigation should explain which usage you could account for, which calls remain unexplained, what access was removed and how you verified recovery.