Techniques
Sample rules
AWS Bedrock AgentCore Code Interpreter Accesses Instance Metadata Credentials
- source: elastic
- technicques:
- T1552
Description
Identifies code or shell commands submitted to an Amazon Bedrock AgentCore Code Interpreter that attempt to retrieve IAM execution-role credentials from the microVM metadata service (MMDS), or a response that contains AWS temporary credentials. An attacker with permission to invoke a Code Interpreter that has an execution role can retrieve the role’s credentials and reuse them outside AgentCore. This can elevate the attacker to the permissions of the attached role.
Detection logic
from logs-aws_bedrock_agentcore.code_interpreter_application_logs-* metadata _id, _version, _index
| where aws.bedrock_agentcore.code_interpreter.operation == "InvokeCodeInterpreter" 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 TO_LOWER(aws.bedrock_agentcore.code_interpreter.request_payload.code) like (
"*169.254.169.254*",
"*fd00:ec2::254*",
"*/latest/api/token*",
"*/latest/meta-data/iam*",
"*security-credentials*",
"*x-aws-ec2-metadata-token*"
)
or (
aws.bedrock_agentcore.code_interpreter.response_payload.stdout like "*AccessKeyId*" and
aws.bedrock_agentcore.code_interpreter.response_payload.stdout like "*SecretAccessKey*" and
aws.bedrock_agentcore.code_interpreter.response_payload.stdout like ("*Token*", "*SessionToken*")
)
or (
aws.bedrock_agentcore.code_interpreter.response_payload.stderr like "*AccessKeyId*" and
aws.bedrock_agentcore.code_interpreter.response_payload.stderr like "*SecretAccessKey*" and
aws.bedrock_agentcore.code_interpreter.response_payload.stderr like ("*Token*", "*SessionToken*")
)
)
| keep _id, _version, _index, @timestamp, aws.*, cloud.*, event.*, process.*, data_stream.namespace