Detection rules › Splunk

AWS Bedrock Claude excessive use of tokens

Status
production
Severity
low
Group by
"identity.arn", user
Author
Rod Soto
Source
github.com/splunk/security_content

Detects identities generating anomalously large model responses relative to their own historical baseline. For each identity, computes the average, maximum, and standard deviation of output token counts across all invocations, then flags any identity whose single largest response exceeds two standard deviations above their own mean. A statistically significant output spike from a single identity may indicate bulk data extraction, successful prompt injection producing verbose output, or a runaway agentic loop hitting context limits.

Known false positives

  • This detection may produce false positives for identities with low invocation history, legitimate large document summarization tasks, or automated pipeline sessions with naturally variable output token counts.

MITRE ATT&CK coverage

TacticTechniques
Privilege Escalation
Stealth

Rule body

name: AWS Bedrock Claude excessive use of tokens
id: a839a6f7-aaac-438b-9d99-be0b49481e17
version: 1
creation_date: '2026-07-06'
modification_date: '2026-07-06'
author: Rod Soto
status: production
type: Anomaly
description: Detects identities generating anomalously large model responses relative to their own historical baseline. For each identity, computes the average, maximum, and standard deviation of output token counts across all invocations, then flags any identity whose single largest response exceeds two standard deviations above their own mean. A statistically significant output spike from a single identity may indicate bulk data extraction, successful prompt injection producing verbose output, or a runaway agentic loop hitting context limits.
data_source:
    - AWS Bedrock Claude
search: |-
    `aws_bedrock_claude`
    | spath output="out_tokens" path="output.outputBodyJson.usage.output_tokens"
    | eval user = replace('identity.arn', ".*/", "")
    | stats count           AS invocations,
            avg(out_tokens) AS avg_out,
            max(out_tokens) AS max_out,
            stdev(out_tokens) AS stdev_out
      BY user, identity.arn
    | eval stdev_out  = coalesce(stdev_out, 0)
    | eval threshold  = avg_out + (2 * stdev_out)
    | where max_out > threshold
    | table
        user,
        identity.arn,
        invocations,
        avg_out,
        max_out,
        stdev_out,
        threshold
    | sort -max_out
    | `aws_bedrock_claude_excessive_use_of_tokens_filter`
how_to_implement: You must install and configure the Splunk Add-on for AWS (https://splunkbase.splunk.com/app/1876). Enable Amazon Bedrock model invocation logging in AWS so that Claude request/response payloads are delivered to S3 and/or CloudWatch Logs (see https://docs.aws.amazon.com/bedrock/latest/userguide/model-invocation-logging.html for setup steps), then ingest those logs into Splunk via the AWS TA. Configure the `aws_bedrock_claude` macro to point to the index and sourcetype (`json_no_timestamp`) where these logs land.
known_false_positives: This detection may produce false positives for identities with low invocation history, legitimate large document summarization tasks, or automated pipeline sessions with naturally variable output token counts.
references:
    - https://aws.amazon.com/blogs/apn/unlocking-the-power-of-splunk-with-amazon-bedrock-an-agentic-ai-approach-to-build-customized-splunk-assistants-using-bedrock-agents/
    - https://help.splunk.com/en/splunk-observability-cloud/observability-for-ai/splunk-ai-infrastructure-monitoring/set-up-ai-infrastructure-monitoring/amazon-bedrock
    - https://research.splunk.com/stories/aws_bedrock_security/
    - https://docs.aws.amazon.com/bedrock/latest/userguide/model-invocation-logging.html
intermediate_findings:
    entities:
        - field: user
          type: user
          score: 20
          message: Identity $user$ generated anomalously high output tokens in AWS Bedrock Claude with max output $max_out$ above threshold $threshold$.
analytic_story:
    - Suspicious AWS Bedrock Claude Activities
asset_type: Web Application
mitre_attack_id:
    - T1055
product:
    - Splunk Enterprise
    - Splunk Enterprise Security
    - Splunk Cloud
category: application
security_domain: endpoint

Stages and Predicates

Stage 1: search

`aws_bedrock_claude`

Stage 2: spath

| spath output="out_tokens" path="output.outputBodyJson.usage.output_tokens"

Stage 3: eval

| eval user = replace('identity.arn', ".*/", "")

Stage 4: stats

| stats count           AS invocations,
        avg(out_tokens) AS avg_out,
        max(out_tokens) AS max_out,
        stdev(out_tokens) AS stdev_out
  BY user, identity.arn

Stage 5: eval

| eval stdev_out  = coalesce(stdev_out, 0)

Stage 6: eval

| eval threshold  = avg_out + (2 * stdev_out)

Stage 7: where

| where max_out > threshold

Stage 8: table

| table
    user,
    identity.arn,
    invocations,
    avg_out,
    max_out,
    stdev_out,
    threshold

Stage 9: sort

| sort -max_out

Stage 10: search

| `aws_bedrock_claude_excessive_use_of_tokens_filter`

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
max_outcross_field_compare
  • threshold transforms: op:gt
field:"max_out" kind:cross_field_compare value:"threshold"
sourcetypeeq
  • json_no_timestamp
field:"sourcetype" kind:eq value:"json_no_timestamp"