CloudTrail Lake SQLHunting query: tune before alertingCloud AI abuse: Amazon Bedrock (LLMjacking)
Bedrock reconnaissance burst: model, availability and logging checks in one hour
Before using a stolen key, LLMjacking tooling enumerates models (ListFoundationModels, ListInferenceProfiles), checks availability and agreement offers, and reads the logging configuration (GetModelInvocationLoggingConfiguration). This query finds principals that call several of these APIs, including at least one availability or logging check, within the same hour.
- 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 · AML.T0069 Discover LLM System Information
- MITRE ATT&CK
- T1526Cloud Service DiscoveryT1078.004Cloud Accounts
- Reviewed
- 2026-11-10
Query · CloudTrail Lake SQL
SELECT userIdentity.arn AS principal, sourceIPAddress,
date_trunc('hour', eventTime) AS hour_bucket,
count(DISTINCT eventName) AS distinct_apis,
array_agg(DISTINCT eventName) AS apis,
count(*) AS calls
FROM $EDS_ID
WHERE eventSource = 'bedrock.amazonaws.com'
AND eventType = 'AwsApiCall'
AND eventName IN ('ListFoundationModels', 'GetFoundationModelAvailability', 'ListFoundationModelAgreementOffers',
'ListInferenceProfiles', 'GetModelInvocationLoggingConfiguration', 'GetUseCaseForModelAccess',
'InvokeModel', 'InvokeModelWithResponseStream', 'Converse', 'ConverseStream')
AND eventTime > date_add('day', -7, now())
GROUP BY userIdentity.arn, sourceIPAddress, date_trunc('hour', eventTime)
HAVING count(DISTINCT eventName) >= 3
AND count_if(eventName IN ('GetModelInvocationLoggingConfiguration', 'GetFoundationModelAvailability',
'ListFoundationModelAgreementOffers')) > 0
ORDER BY distinct_apis DESC, calls DESC Other platforms
Microsoft Sentinel / Defender (KQL)
Microsoft Sentinel / Log Analytics: AWSCloudTrail (Amazon Web Services S3 connector)
let recon_apis = dynamic(["ListFoundationModels", "GetFoundationModelAvailability", "ListFoundationModelAgreementOffers",
"ListInferenceProfiles", "GetModelInvocationLoggingConfiguration", "GetUseCaseForModelAccess",
"InvokeModel", "InvokeModelWithResponseStream", "Converse", "ConverseStream"]);
let checks = dynamic(["GetModelInvocationLoggingConfiguration", "GetFoundationModelAvailability", "ListFoundationModelAgreementOffers"]);
AWSCloudTrail
| where TimeGenerated > ago(7d)
| where EventSource == "bedrock.amazonaws.com" and EventTypeName == "AwsApiCall"
| where EventName in (recon_apis)
| summarize DistinctApis = dcount(EventName), Apis = make_set(EventName), Calls = count(),
Checks = countif(EventName in (checks))
by UserIdentityArn, SourceIpAddress, HourBucket = bin(TimeGenerated, 1h)
| where DistinctApis >= 3 and Checks > 0
| order by DistinctApis desc, Calls 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 ("ListFoundationModels", "GetFoundationModelAvailability", "ListFoundationModelAgreementOffers",
"ListInferenceProfiles", "GetModelInvocationLoggingConfiguration", "GetUseCaseForModelAccess",
"InvokeModel", "InvokeModelWithResponseStream", "Converse", "ConverseStream")
earliest=-7d
| eval is_check=if(in(eventName, "GetModelInvocationLoggingConfiguration", "GetFoundationModelAvailability",
"ListFoundationModelAgreementOffers"), 1, 0)
| bin _time span=1h
| stats dc(eventName) AS distinct_apis values(eventName) AS apis count AS calls sum(is_check) AS checks
BY _time userIdentity.arn sourceIPAddress
| where distinct_apis >= 3 AND checks > 0
| sort - distinct_apis - calls Expected false positives
- Administrators exploring Bedrock in the console (console sessions also call these APIs)
- Cloud security posture tools that inventory Bedrock settings
Sources
- Sysdig: LLMjacking — stolen cloud credentials used in new AI attack (May 2024)
- Sysdig: The growing dangers of LLMjacking (Sep 2024)
- Permiso: Exploiting hosted models — LLMjacking on Amazon Bedrock (Oct 2024)
- AWS docs: CloudTrail Lake SQL constraints (Trino SQL)
Reviewed against vendor documentation, not tested in your environment. Defensive use only.