LoFP LoFP / authorized security testing or troubleshooting may query the metadata service or print temporary credentials. confirm the caller and purpose. production workloads should not retrieve or return raw execution-role credentials.

Techniques

Sample rules

AWS Bedrock AgentCore Runtime Command Accesses Instance Metadata Credentials

Description

Identifies an Amazon Bedrock AgentCore Runtime command that attempts to retrieve IAM execution-role credentials from the microVM metadata service (MMDS), or command output that contains an AWS temporary credential response. The InvokeAgentRuntimeCommand API runs shell commands as root inside Runtime and Harness microVMs, bypassing the agent, model, tools, and guardrails. An attacker with permission to invoke this API can read the attached execution role’s credentials from MMDS and reuse them outside AgentCore.

Detection logic

from logs-aws_bedrock_agentcore.runtime_logs-* metadata _id, _version, _index
| where
    (
        event.action == "invoke-agent-runtime-command" and TO_LOWER(process.command_line) like (
            "*169.254.169.254*",
            "*fd00:ec2::254*",
            "*/latest/api/token*",
            "*/latest/meta-data/iam*",
            "*security-credentials*",
            "*x-aws-ec2-metadata-token*"
        )
    ) or (
        message like "*AccessKeyId*" and
        message like "*SecretAccessKey*" and
        message like ("*Token*", "*SessionToken*")
    )
| keep _id, _version, _index, @timestamp, aws.*, cloud.*, event.*, message, process.command_line