CloudTrail Lake SQLHunting query: tune before alertingCloud AI abuse: Amazon Bedrock (LLMjacking)
Bedrock calls from a long-term access key with a browser, empty or scripting user agent
Permiso found Bedrock abuse from long-term keys (AKIA…) with no user agent, browser-style Mozilla user agents (rare for programmatic keys) and HTTP-library agents such as axios, aiohttp and urllib3. This hunt lists those combinations so they can be compared with the user agents your own applications send.
- Log source
- AWS CloudTrail Lake event data store (management events)
- Techniques
- LLM10 Unbounded Consumption · AML.T0034 Cost Harvesting · AML.T0012 Valid Accounts
- MITRE ATT&CK
- T1078.004Cloud AccountsT1496.004Cloud Service Hijacking
- Reviewed
- 2026-11-10
Query · CloudTrail Lake SQL
SELECT userIdentity.accessKeyId AS access_key_id, userIdentity.arn AS principal, userAgent,
count(*) AS calls, count(DISTINCT eventName) AS distinct_apis,
array_agg(DISTINCT sourceIPAddress) AS source_ips,
min(eventTime) AS first_seen, max(eventTime) AS last_seen
FROM $EDS_ID
WHERE eventSource = 'bedrock.amazonaws.com'
AND eventType = 'AwsApiCall'
AND userIdentity.accessKeyId LIKE 'AKIA%'
AND (userAgent IS NULL OR userAgent = ''
OR userAgent LIKE 'Mozilla/%'
OR userAgent LIKE 'axios/%'
OR userAgent LIKE '%aiohttp%'
OR userAgent LIKE 'python-urllib3/%')
AND eventTime > date_add('day', -30, now())
GROUP BY userIdentity.accessKeyId, userIdentity.arn, userAgent
ORDER BY calls DESC Other platforms
Microsoft Sentinel / Defender (KQL)
Microsoft Sentinel / Log Analytics: AWSCloudTrail (Amazon Web Services S3 connector)
AWSCloudTrail
| where TimeGenerated > ago(14d)
| where EventSource == "bedrock.amazonaws.com" and EventTypeName == "AwsApiCall"
| where UserIdentityAccessKeyId startswith "AKIA"
| where isempty(UserAgent) or UserAgent startswith "Mozilla/" or UserAgent startswith "axios/"
or UserAgent contains "aiohttp" or UserAgent startswith "python-urllib3/"
| summarize Calls = count(), DistinctApis = dcount(EventName), SourceIPs = make_set(SourceIpAddress, 50),
FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated)
by UserIdentityAccessKeyId, UserIdentityArn, UserAgent
| order by 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"
userIdentity.accessKeyId="AKIA*" earliest=-14d
| fillnull value="" userAgent
| where userAgent="" OR like(userAgent, "Mozilla/%") OR like(userAgent, "axios/%")
OR like(userAgent, "%aiohttp%") OR like(userAgent, "python-urllib3/%")
| stats count AS calls dc(eventName) AS distinct_apis values(sourceIPAddress) AS source_ips
min(_time) AS first_seen max(_time) AS last_seen BY userIdentity.accessKeyId userIdentity.arn userAgent
| convert ctime(first_seen) ctime(last_seen)
| sort - calls Expected false positives
- Internal services that call Bedrock through a plain HTTP library with an IAM user key
- Proxies or gateways that strip or rewrite the user agent
Sources
- Permiso: Exploiting hosted models — LLMjacking on Amazon Bedrock (Oct 2024)
- AWS docs: Monitor Amazon Bedrock API calls using CloudTrail
Reviewed against vendor documentation, not tested in your environment. Defensive use only.