threatdeck
Live 13:45 UTC ·

Detection library

CloudTrail Lake SQLHunting query: tune before alertingCloud AI abuse: Amazon Bedrock (LLMjacking)

Bedrock invocation volume far above a principal's own baseline

Stolen credentials are resold for prompt generation, so abuse shows up as a sudden rise in InvokeModel, InvokeModelWithResponseStream, Converse and ConverseStream calls (Converse does not produce InvokeModel events, so all four are counted). The query scores each hour of the last day against the principal's hourly average over the 13 days before it (the scored window is excluded from the baseline, so a spike cannot hide itself), and flags principals with no history at all. It keeps only eventType AwsApiCall: streaming calls also emit an AwsServiceEvent stream-completion record with the same eventName that would double-count.

Log source
AWS CloudTrail Lake event data store (management events)
Techniques
LLM10 Unbounded Consumption · AML.T0034 Cost Harvesting · AML.T0040 AI Model Inference API Access
MITRE ATT&CK
T1496.004Cloud Service Hijacking
Reviewed
2026-11-10

Query · CloudTrail Lake SQL

SELECT h.principal, h.hour_bucket, h.invocations, h.models, h.regions, b.baseline_avg, b.baseline_hours
FROM (
  SELECT userIdentity.arn AS principal,
         date_trunc('hour', eventTime) AS hour_bucket,
         count(*) AS invocations,
         count(DISTINCT element_at(requestParameters, 'modelId')) AS models,
         count(DISTINCT awsRegion) AS regions
  FROM $EDS_ID
  WHERE eventSource = 'bedrock.amazonaws.com'
    AND eventType = 'AwsApiCall'
    AND eventName IN ('InvokeModel', 'InvokeModelWithResponseStream', 'Converse', 'ConverseStream')
    AND errorCode IS NULL
    AND eventTime > date_add('day', -1, now())
  GROUP BY userIdentity.arn, date_trunc('hour', eventTime)
) h
LEFT JOIN (
  SELECT principal, avg(invocations) AS baseline_avg, count(*) AS baseline_hours
  FROM (
    SELECT userIdentity.arn AS principal, date_trunc('hour', eventTime) AS hour_bucket, count(*) AS invocations
    FROM $EDS_ID
    WHERE eventSource = 'bedrock.amazonaws.com'
      AND eventType = 'AwsApiCall'
      AND eventName IN ('InvokeModel', 'InvokeModelWithResponseStream', 'Converse', 'ConverseStream')
      AND errorCode IS NULL
      AND eventTime > date_add('day', -14, now())
      AND eventTime <= date_add('day', -1, now())
    GROUP BY userIdentity.arn, date_trunc('hour', eventTime)
  ) past
  GROUP BY principal
) b ON h.principal = b.principal
WHERE h.invocations > 100
  AND (b.baseline_avg IS NULL OR h.invocations > 5 * b.baseline_avg)
ORDER BY h.invocations DESC

Other platforms

Microsoft Sentinel / Defender (KQL)

Microsoft Sentinel / Log Analytics: AWSCloudTrail (Amazon Web Services S3 connector)

// Last day's hours compared with each principal's hourly average over the 13 days before it.
let window = 1d;
let hourly = AWSCloudTrail
    | where TimeGenerated > ago(14d)
    | where EventSource == "bedrock.amazonaws.com" and EventTypeName == "AwsApiCall"
    | where EventName in (dynamic(["InvokeModel", "InvokeModelWithResponseStream", "Converse", "ConverseStream"])) and isempty(ErrorCode)
    | summarize Invocations = count(), Models = dcount(tostring(parse_json(RequestParameters).modelId)),
                Regions = dcount(AWSRegion)
        by Principal = UserIdentityArn, HourBucket = bin(TimeGenerated, 1h);
let baseline = hourly
    | where HourBucket < ago(window)
    | summarize BaselineAvg = avg(Invocations), BaselineHours = count() by Principal;
hourly
| where HourBucket >= ago(window)
| join kind=leftouter baseline on Principal
| where Invocations > 100 and (isnull(BaselineAvg) or Invocations > 5 * BaselineAvg)
| project Principal, HourBucket, Invocations, Models, Regions, BaselineAvg, BaselineHours
| order by Invocations desc

Splunk (SPL)

Splunk: AWS CloudTrail (Splunk Add-on for AWS, sourcetype aws:cloudtrail) · Set index= to the index that holds your CloudTrail data.

index=aws sourcetype=aws:cloudtrail eventSource="bedrock.amazonaws.com" eventType="AwsApiCall"
    eventName IN ("InvokeModel", "InvokeModelWithResponseStream", "Converse", "ConverseStream") earliest=-14d@h
| where isnull(errorCode)
| eval principal='userIdentity.arn'
| bin _time span=1h
| stats count AS invocations dc(requestParameters.modelId) AS models dc(awsRegion) AS regions BY principal _time
| eval in_window=if(_time >= relative_time(now(), "-1d@h"), 1, 0)
| eval baseline_invocations=if(in_window=0, invocations, null())
| eventstats avg(baseline_invocations) AS baseline_avg count(baseline_invocations) AS baseline_hours BY principal
| where in_window=1 AND invocations > 100 AND (isnull(baseline_avg) OR invocations > 5 * baseline_avg)
| fields _time principal invocations models regions baseline_avg baseline_hours
| sort - invocations

Expected false positives

  • Batch jobs, evaluations or product launches that legitimately raise volume
  • New applications with no history (baseline_avg is empty): confirm the owner before dismissing, since a brand-new stolen key looks the same
  • The baseline averages only hours with activity, so bursty low-volume principals score lower than their daily total suggests

Sources

Reviewed against vendor documentation, not tested in your environment. Defensive use only.

Following

Follow the vendors, products, AI tools, techniques and actors you care about. Matching stories, CVEs and exploited bugs are marked, a Following tab appears in the feed, and returning visits show what changed. Saved only in this browser.

Presets

Get updates

A personal RSS feed of new stories on everything you follow. Paste it into any feed reader, Slack or Teams RSS app.