AWS Bedrock Model Prompt or Completion Containing Credentials

Last updated 2 months ago on 2026-07-08
Created 2 months ago on 2026-07-08

About

Identifies an Amazon Bedrock model invocation whose prompt or completion contains an AWS access key identifier (AKIA long-term or ASIA temporary/STS, followed by 16 characters), an Amazon Bedrock API key (ABSK bearer token), or a PEM private-key block. Credentials in the model input mean an application or user is sending secrets to the model, exposing them to invocation logging, the model provider, and prompt history; credentials in the model output mean the model is emitting secrets, which can result from training-data leakage, poisoned context, or a prompt-injection-driven exfiltration attempt. Either case is a credential-exposure event that warrants immediate rotation of the affected secret.
Tags
Domain: LLMData Source: AWS BedrockData Source: Amazon Web ServicesUse Case: Threat DetectionMitre Atlas: LLM06Tactic: Credential AccessLanguage: esql
Severity
medium
Risk Score
47
MITRE ATT&CK™

Credential Access (TA0006)(external, opens in a new tab or window)

False Positive Examples
Prompts or completions that reference example or documentation keys (for example the AWS sample access key ending in EXAMPLE) match the access-key pattern. Review the matched value in "gen_ai.prompt" or "gen_ai.completion" and confirm whether it is a live credential before responding.
License
Elastic License v2(external, opens in a new tab or window)

Definition

Integration Pack
Prebuilt Security Detection Rules
Related Integrations

aws_bedrock(external, opens in a new tab or window)

Query
text code block:
from logs-aws_bedrock.invocation-* metadata _id, _version, _index | where event.action in ("ConverseStream", "Converse") AND ( gen_ai.prompt rlike """.*(AKIA|ASIA)[A-Z0-9]{16}.*""" or gen_ai.completion rlike """.*(AKIA|ASIA)[A-Z0-9]{16}.*""" or gen_ai.prompt rlike """.*-----BEGIN [A-Z ]*PRIVATE KEY-----.*""" or gen_ai.completion rlike """.*-----BEGIN [A-Z ]*PRIVATE KEY-----.*""" or gen_ai.prompt rlike """.*ABSK[A-Za-z0-9+/=]{20}.*""" or gen_ai.completion rlike """.*ABSK[A-Za-z0-9+/=]{20}.*""" or gen_ai.prompt rlike """.*gh[pousr]_[A-Za-z0-9]{36}.*""" or gen_ai.completion rlike """.*gh[pousr]_[A-Za-z0-9]{36}.*""" or gen_ai.prompt rlike """.*github_pat_[A-Za-z0-9_]+.*""" or gen_ai.completion rlike """.*github_pat_[A-Za-z0-9_]+.*""" or gen_ai.prompt rlike """.*glpat-[A-Za-z0-9_\\-]+.*""" or gen_ai.completion rlike """.*glpat-[A-Za-z0-9_\\-]+.*""") | keep _id, _version, _index, @timestamp, gen_ai.*, aws_bedrock.*, user.*, cloud.*, event.*

Install detection rules in Elastic Security

Detect AWS Bedrock Model Prompt or Completion Containing Credentials in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).