← Insights
Note 002 6 min read 1,311 words

One stolen token: tracing blast radius in a GovCloud account

Zero trust starts with a simple exercise. Pick one credential, assume it leaked, and follow everywhere it can reach.

cloudzero-trust

Zero trust strategies tend to start with pillars and maturity levels. We like to start with a smaller exercise that produces a concrete answer in an afternoon: pick one credential, assume an adversary has it, and trace everything it can reach.

The answer is the blast radius of that credential. Shrinking it is most of what zero trust means in practice.

Pick a realistic credential

Don’t start with the root account. Start with something that leaks in real incidents:

  • An access key for a CI/CD service role, stored as a pipeline variable.
  • A developer’s federated session token, cached on a laptop.
  • The instance role attached to an internet-facing workload.

Each of these regularly ends up somewhere it shouldn’t be: a build log, a compromised workstation, a server-side request forgery bug that reaches the instance metadata service.

Write down the exact ARN before you start. In GovCloud that means the aws-us-gov partition, so a role looks like arn:aws-us-gov:iam::111122223333:role/ci-deploy. Tools and scripts copied from commercial-region examples often hard-code arn:aws: and silently match nothing.

Trace what it can do directly

For the chosen principal, list its effective permissions. In AWS that means the identity policies, any permission boundary, session policies, and service control policies above the account. Start with the raw material:

ROLE=ci-deploy
aws iam list-attached-role-policies --role-name "$ROLE"
aws iam list-role-policies --role-name "$ROLE"
aws iam get-role --role-name "$ROLE" --query 'Role.PermissionsBoundary'

Then ask the policy simulator about the actions that matter most for escalation:

aws iam simulate-principal-policy \
  --policy-source-arn "arn:aws-us-gov:iam::111122223333:role/$ROLE" \
  --action-names iam:PassRole iam:CreateAccessKey iam:AttachRolePolicy \
                 lambda:UpdateFunctionCode ec2:AuthorizeSecurityGroupIngress \
                 secretsmanager:GetSecretValue ssm:GetParameter \
  --query 'EvaluationResults[].[EvalActionName,EvalDecision]' --output table

The simulator and IAM Access Analyzer help, but read the policies yourself too. The simulator doesn’t see every resource policy or session condition, and wildcards hide in places tools summarize away.

Write the answer as actions on resources, not policy names: “can read every object in these four buckets,” “can pass any role to Lambda,” “can modify security groups in this VPC.”

Trace what it can become

This is where blast radius usually explodes. Look for paths from the starting principal to more privilege:

  • Role assumption. Which roles trust this principal, directly or through an overly broad trust policy?
  • Pass role. Can it hand a more powerful role to a compute service it can also create or update?
  • Resource policies. Do bucket, key or queue policies grant access to this principal outside its identity policy?
  • Secrets. Can it read parameters or secrets that contain other credentials?
  • Compute it can modify. If it can change a function’s code or an instance’s user data, it holds that compute’s role too.

For role assumption, pull every trust policy in the account once and search it:

aws iam get-account-authorization-details --filter Role \
  --query 'RoleDetailList[].{role:RoleName,trust:AssumeRolePolicyDocument}' \
  --output json > roles.json

jq -r --arg p "arn:aws-us-gov:iam::111122223333:role/ci-deploy" \
  '.[] | select((.trust | tostring | contains($p))
                or (.trust | tostring | contains(":root"))) | .role' roles.json

The second match is deliberate. A trust policy that names the account root lets any principal in the account with sts:AssumeRole permission take that role, and those are easy to miss when you only search for your role’s name. Open-source graph tools such as PMapper automate this step and are worth running, but check a few of their paths by hand before you trust the graph.

Follow each path until it stops. Then repeat from the new principal. The full graph is the real blast radius.

Trace where it can reach on the network

Identity is half the picture. If the credential can modify security groups, route tables or VPC endpoint policies, it can open network paths to systems its permissions never mention. Note any path from the starting workload into enclaves that hold mission data.

For an instance role, check how the credential gets issued in the first place. If the instance still allows IMDSv1, a single SSRF bug in the application hands over the role’s session credentials. Requiring session tokens closes that path:

aws ec2 modify-instance-metadata-options \
  --instance-id i-0abc123def4567890 --http-tokens required --http-endpoint enabled

Set the same requirement in the launch template so new instances don’t come up with the old default.

Shrink it

With the graph drawn, the fixes are usually clear and rarely expensive:

  1. Replace static keys with short-lived credentials through federation or workload identity.
  2. Scope trust policies to specific principals and add conditions on source and session tags.
  3. Remove iam:PassRole on wildcards; name the exact roles.
  4. Move secrets behind resource policies that name their single consumer.
  5. Add detection on the steps an attacker must take: unusual role assumption, policy changes, new access keys.

For a GitLab pipeline, the first two fixes combine. The pipeline requests an OIDC token and assumes the role directly, and the trust policy names the one project and branch allowed to do it:

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": { "Federated": "arn:aws-us-gov:iam::111122223333:oidc-provider/gitlab.com" },
    "Action": "sts:AssumeRoleWithWebIdentity",
    "Condition": {
      "StringEquals": {
        "gitlab.com:aud": "https://gitlab.com",
        "gitlab.com:sub": "project_path:my-group/my-project:ref_type:branch:ref:main"
      }
    }
  }]
}

The aud value has to match what the job requests in its id_tokens block. Use StringEquals, not StringLike with a wildcard. A wildcard on sub is how one trusted project quietly becomes every project in the group.

For pass role, name the role and the service:

{
  "Effect": "Allow",
  "Action": "iam:PassRole",
  "Resource": "arn:aws-us-gov:iam::111122223333:role/app-lambda-exec",
  "Condition": { "StringEquals": { "iam:PassedToService": "lambda.amazonaws.com" } }
}

For detection, CloudTrail already records the events that matter: CreateAccessKey, AttachRolePolicy, PutRolePolicy, UpdateAssumeRolePolicy, Lambda code updates and security group ingress changes. GuardDuty’s UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS finding catches instance credentials used from outside AWS. If a key does leak, aws cloudtrail lookup-events --lookup-attributes AttributeKey=AccessKeyId,AttributeValue="$KEY_ID" gives you its recent history in one call.

Then run the exercise again from the same starting point. If the graph is smaller, you made measurable progress, and you can show it.

Where the exercise goes wrong

  • Testing the policy you meant to write. Infrastructure code says one thing and the account says another after a console change. Trace the live account, then compare it to the code.
  • Stopping at the account boundary. Cross-account trust policies and shared KMS keys carry blast radius into accounts you didn’t plan to look at.
  • Ignoring humans. A developer’s federated session often has more reach than any service role. Run the exercise on one of those too.
  • Fixing without detection. A smaller graph is still a graph. If nobody alerts on the remaining paths, the first sign of use is the incident.

Where this lands in the standards

The DoD Zero Trust Strategy and the DoD Zero Trust Reference Architecture organize the work into seven pillars. This exercise sits mostly in the User pillar and the Applications and Workloads pillar, with the detection work under Visibility and Analytics. NIST SP 800-207 describes the same model in civilian terms: access granted per session, with the least privilege the task needs. NIST SP 800-53 AC-6 and NIST SP 800-171 r2 requirement 3.1.5 both call for least privilege, and a blast-radius graph is the most direct evidence I know that you’ve applied it to a specific credential.

Make it routine

We run this exercise at the start of every cloud engagement because it turns an abstract maturity model into a list of specific changes. You can run it yourself quarterly on your highest-risk credentials. The first time takes a day. After that, the difference between this quarter’s graph and last quarter’s is the most honest zero trust metric you’ll have.

If you want it run with an engineer who does this for a living, it’s part of my cloud and zero trust work. For a smaller first step, the threat-model workshop maps the same paths for one system in about a week. Not sure which fits? Book a free 30-minute fit call.

End of note 002 · 2 of 7