# Empirical: Empirical: a stale Terraform key opened every secret in the runner account

> **Safety notice:** Runs 100% offline inside LocalStack using synthetic decoy credentials.

- **Incident date:** Nov 28, 2026
- **Disclosed:** Nov 30, 2026
- **Source disclosure:** https://empirical.run/blog/nov-2026-security-incident

## Reproduction lab
Replays the exact CloudTrail discovery, secret-dump and throwaway Lambda sequence against LocalStack with decoy secrets, so you can test the OIDC trust policy and EventBridge rule without touching a real AWS account.

```bash
# 8 decoy secrets, 3 SSM parameters, one IAM user with a static key
docker run -d --name breachident-lab -p 4566:4566 localstack/localstack:3.8
AWS_ENDPOINT_URL=http://localhost:4566 aws secretsmanager create-secret \
  --name tool-execute-service/llm-keys --secret-string '{"ANTHROPIC":"sk-decoy"}'

# replay steps 1 to 3 against LocalStack and verify the EventBridge rule fires
python3 simulate_probe.py --endpoint http://localhost:4566
```

## Lab files

### `simulate_probe.py`
```python
import argparse, boto3

parser = argparse.ArgumentParser()
parser.add_argument("--endpoint", default="http://localhost:4566")
args = parser.parse_args()

kw = dict(endpoint_url=args.endpoint, region_name="us-east-1",
          aws_access_key_id="test", aws_secret_access_key="test")
sts = boto3.client("sts", **kw)
print("[06:04] GetCallerIdentity:", sts.get_caller_identity()["Arn"])

sm = boto3.client("secretsmanager", **kw)
for sec in sm.list_secrets().get("SecretList", []):
    val = sm.get_secret_value(SecretId=sec["ARN"])
    print("[06:16] Dumped:", sec["Name"], len(val["SecretString"]), "bytes")
```

## Policies and detection rules

### `github-oidc-trust.json`
Trust policy for the deploy role. CI gets a one-hour session from GitHub OIDC pinned to the main branch instead of a stored IAM user key. Stops step 1.

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "GitHubActionsDeployOnly",
      "Effect": "Allow",
      "Principal": {
        "Federated": "arn:aws:iam::<account-id>:oidc-provider/token.actions.githubusercontent.com"
      },
      "Action": "sts:AssumeRoleWithWebIdentity",
      "Condition": {
        "StringEquals": {
          "token.actions.githubusercontent.com:aud": "sts.amazonaws.com",
          "token.actions.githubusercontent.com:sub": "repo:<org>/<repo>:ref:refs/heads/main"
        }
      }
    }
  ]
}
```

### `detect-iam-user-secret-reads.json`
EventBridge pattern on CloudTrail matching IAM user reads on Secrets Manager plus Bedrock and Marketplace model agreement activations. Route GuardDuty CredentialAccess:IAMUser findings to the same target. Catches steps 2 and 4.

```json
{
  "source": [
    "aws.secretsmanager",
    "aws.bedrock",
    "aws.agreement-marketplace"
  ],
  "detail-type": ["AWS API Call via CloudTrail"],
  "detail": {
    "eventSource": [
      "secretsmanager.amazonaws.com",
      "bedrock.amazonaws.com",
      "agreement-marketplace.amazonaws.com"
    ],
    "eventName": [
      "GetSecretValue",
      "BatchGetSecretValue",
      "PutFoundationModelEntitlement",
      "CreateFoundationModelAgreement",
      "AcceptAgreementRequest"
    ],
    "userIdentity": {
      "type": ["IAMUser"]
    }
  }
}
```

## Indicators of compromise
- **ip:** `111.88.126.50` (06:04 UTC GetCallerIdentity (Python urllib), 06:16 UTC Secrets Manager and SSM dump (boto3) and tmp-cred-validate Lambda.)
- **ip:** `139.162.62.217` (08:55 UTC Bedrock model listing, 5 Marketplace agreement acceptances, retention flip and 5 test prompts.)
- **lambda:** `tmp-cred-validate (runtime python3.12, memory 128 MB, role tmp-cred-validate-role)` (Throwaway execution role and function created, invoked once and deleted at 06:16 UTC.)
- **hash:** `McIbfRG0aZY8d+wfg3RXuijdtAklkzIRAWTuQOanu7o=` (Base64 SHA-256 code digest reported by AWS Lambda for tmp-cred-validate.)
- **log:** `/aws/lambda/tmp-cred-validate` (CloudWatch log group left behind after function deletion.)
