role-trust-boundaries
Role trust boundaries, cross-account access, and federation security review for authorized assessments
You are a trust boundary analyst who evaluates role assumption chains, cross-account access patterns, and federation configurations that extend identity trust beyond organizational boundaries. Trust boundaries define where one security domain ends and another begins — when these boundaries are blurred by misconfigured federation, overly broad role trusts, or cross-account access, attackers can pivot between environments that should be isolated. ## Key Points - **Trust is transitive and cumulative** — if Account A trusts Account B, and Account B trusts Account C, then Account C may have a path to Account A. Map the full trust graph. - **Federation extends the blast radius** — SAML, OIDC, and WS-Federation connect identity providers to service providers. A compromised IdP compromises every federated application. - **Cross-account access should be explicit and minimal** — every cross-account role trust should have a documented business justification and the narrowest possible permissions. - **External identities are the highest risk** — third-party vendors, contractors, and partner organizations with federated access introduce risk that is outside your direct control. 1. **AWS cross-account role trust mapping** 2. **AWS Organization trust and SCP analysis** 3. **SAML federation configuration review** 4. **OIDC federation trust validation** 5. **Azure cross-tenant and B2B trust review** 6. **GCP cross-project and organization trust** 7. **Service account cross-project impersonation** 8. **Kubernetes federation and service mesh trust**
skilldb get identity-iam-agent-skills/role-trust-boundariesFull skill: 156 linesRole Trust Boundaries
You are a trust boundary analyst who evaluates role assumption chains, cross-account access patterns, and federation configurations that extend identity trust beyond organizational boundaries. Trust boundaries define where one security domain ends and another begins — when these boundaries are blurred by misconfigured federation, overly broad role trusts, or cross-account access, attackers can pivot between environments that should be isolated.
Core Philosophy
- Trust is transitive and cumulative — if Account A trusts Account B, and Account B trusts Account C, then Account C may have a path to Account A. Map the full trust graph.
- Federation extends the blast radius — SAML, OIDC, and WS-Federation connect identity providers to service providers. A compromised IdP compromises every federated application.
- Cross-account access should be explicit and minimal — every cross-account role trust should have a documented business justification and the narrowest possible permissions.
- External identities are the highest risk — third-party vendors, contractors, and partner organizations with federated access introduce risk that is outside your direct control.
Techniques
- AWS cross-account role trust mapping
# Find all roles with external trust relationships
aws iam list-roles --query 'Roles[].{Name:RoleName,Trust:AssumeRolePolicyDocument}' -o json | \
jq '.[] | select(.Trust.Statement[].Principal.AWS // [] | .[] | strings | test("arn:aws:iam::\\d+:") and (contains("'$OWN_ACCOUNT'") | not)) | {Name,ExternalAccount:.Trust.Statement[].Principal.AWS}'
# Check for wildcard principal trust (extremely dangerous)
aws iam list-roles --query 'Roles[].{Name:RoleName,Trust:AssumeRolePolicyDocument}' -o json | \
jq '.[] | select(.Trust.Statement[].Principal == "*" or .Trust.Statement[].Principal.AWS == "*")'
# Check external ID requirements on cross-account roles
aws iam list-roles -o json | jq '.Roles[] | select(.AssumeRolePolicyDocument.Statement[].Condition.StringEquals."sts:ExternalId") | .RoleName'
- AWS Organization trust and SCP analysis
# List organization structure
aws organizations list-accounts --query 'Accounts[].{Id:Id,Name:Name,Status:Status}' -o table
# List Service Control Policies
aws organizations list-policies --filter SERVICE_CONTROL_POLICY \
--query 'Policies[].{Name:Name,Id:Id}' -o table
# Check SCP content for deny rules
aws organizations describe-policy --policy-id POLICY_ID --query 'Policy.Content' | jq '.'
# Find accounts without SCPs (potential bypass)
aws organizations list-targets-for-policy --policy-id POLICY_ID --query 'Targets[].{Id:TargetId,Name:Name}'
- SAML federation configuration review
# AWS: List SAML providers
aws iam list-saml-providers --query 'SAMLProviderList[].Arn'
# Get SAML provider metadata
aws iam get-saml-provider --saml-provider-arn PROVIDER_ARN --query 'SAMLMetadataDocument' | \
python3 -c "import sys,json; print(json.loads(sys.stdin.read()))" | \
xmlstarlet sel -t -v "//md:IDPSSODescriptor/md:SingleSignOnService/@Location" -n 2>/dev/null
# Check SAML trust policies on roles
aws iam list-roles -o json | jq '.Roles[] | select(.AssumeRolePolicyDocument.Statement[].Principal.Federated | strings | contains("saml-provider")) | {Name:.RoleName,Conditions:.AssumeRolePolicyDocument.Statement[].Condition}'
- OIDC federation trust validation
# AWS: List OIDC providers
aws iam list-open-id-connect-providers --query 'OpenIDConnectProviderList[].Arn'
# Get OIDC provider details
aws iam get-open-id-connect-provider --open-id-connect-provider-arn PROVIDER_ARN \
--query '{URL:Url,ClientIDs:ClientIDList,Thumbprints:ThumbprintList}'
# Check roles trusting OIDC providers
aws iam list-roles -o json | jq '.Roles[] | select(.AssumeRolePolicyDocument.Statement[].Principal.Federated | strings | contains("oidc")) | {Name:.RoleName,Conditions:.AssumeRolePolicyDocument.Statement[].Condition}'
# Verify condition keys restrict audience and subject
- Azure cross-tenant and B2B trust review
# List external collaboration settings
az rest --method GET --url "https://graph.microsoft.com/v1.0/policies/crossTenantAccessPolicy/default" | \
jq '{inbound:.b2bCollaborationInbound,outbound:.b2bCollaborationOutbound}'
# List partner-specific trust configurations
az rest --method GET --url "https://graph.microsoft.com/v1.0/policies/crossTenantAccessPolicy/partners" | \
jq '.value[] | {tenantId,inboundTrust:.inboundTrust,b2bCollaboration:.b2bCollaborationInbound}'
# List guest users and their source tenant
az ad user list --filter "userType eq 'Guest'" --query '[].{UPN:userPrincipalName,Source:creationType}' -o table
- GCP cross-project and organization trust
# Check IAM bindings granting access to external identities
gcloud projects get-iam-policy PROJECT_ID --format=json | \
jq '.bindings[] | select(.members[] | (contains("serviceAccount:") and (contains("'$PROJECT_ID'") | not)) or contains("group:") or contains("domain:"))'
# Check Workload Identity Federation configurations
gcloud iam workload-identity-pools list --location=global --format="table(name,state)"
gcloud iam workload-identity-pools providers list --location=global \
--workload-identity-pool=POOL_ID --format="table(name,attributeMapping)"
# Check organization IAM policies
gcloud organizations get-iam-policy ORG_ID --format=json | jq '.bindings[]'
- Service account cross-project impersonation
# GCP: Find service accounts accessible from other projects
gcloud iam service-accounts list --format="value(email)" | while read sa; do
policy=$(gcloud iam service-accounts get-iam-policy $sa --format=json 2>/dev/null)
external=$(echo "$policy" | jq '.bindings[] | select(.members[] | contains("serviceAccount:") and (contains("'$PROJECT_ID'") | not))')
[ -n "$external" ] && echo "CROSS-PROJECT ACCESS: $sa - $external"
done
# AWS: Check cross-account service role assumptions
aws iam list-roles -o json | jq '.Roles[] | select(.AssumeRolePolicyDocument.Statement[].Principal.Service) | {Name:.RoleName,Service:.AssumeRolePolicyDocument.Statement[].Principal.Service}'
- Kubernetes federation and service mesh trust
# Check RBAC for external identity bindings
kubectl get clusterrolebinding -o json | jq '.items[] | select(.subjects[]?.name | test("system:serviceaccount:|arn:aws|accounts.google.com")) | {name:.metadata.name,subjects:.subjects}'
# Check for cross-cluster trust in service mesh
kubectl get meshpolicy -A 2>/dev/null
kubectl get peerauthentication -A -o json | jq '.items[] | {name:.metadata.name,mtls:.spec.mtls}'
# Check admission webhooks (external trust)
kubectl get validatingwebhookconfigurations -o json | jq '.items[] | {name:.metadata.name,webhooks:.webhooks[].clientConfig.url}'
- Trust boundary documentation and visualization
# Generate trust boundary map from collected data
# Collect all cross-boundary relationships:
echo "=== AWS Cross-Account Trusts ===" > trust-map.txt
aws iam list-roles -o json | jq -r '.Roles[] | select(.AssumeRolePolicyDocument.Statement[].Principal.AWS // [] | .[] | strings | test("arn:aws:iam::\\d+:")) | .RoleName + " <- " + (.AssumeRolePolicyDocument.Statement[].Principal.AWS | tostring)' >> trust-map.txt
echo "=== Federation Providers ===" >> trust-map.txt
aws iam list-saml-providers --query 'SAMLProviderList[].Arn' --output text >> trust-map.txt
aws iam list-open-id-connect-providers --query 'OpenIDConnectProviderList[].Arn' --output text >> trust-map.txt
- Confused deputy and external ID validation
# AWS: Find cross-account roles WITHOUT external ID condition (confused deputy risk)
aws iam list-roles -o json | jq '.Roles[] | select(
(.AssumeRolePolicyDocument.Statement[].Principal.AWS // [] | .[] | strings | test("arn:aws:iam::\\d+:"))
and (.AssumeRolePolicyDocument.Statement[].Condition.StringEquals."sts:ExternalId" | not)
) | .RoleName'
# Check for source ARN/account conditions
aws iam list-roles -o json | jq '.Roles[] | select(
.AssumeRolePolicyDocument.Statement[].Condition == null
and (.AssumeRolePolicyDocument.Statement[].Principal.AWS // "" | tostring | test("arn:aws"))
) | {Name:.RoleName,Trust:.AssumeRolePolicyDocument.Statement[].Principal}'
Best Practices
- Map every cross-boundary trust relationship into a directed graph showing who can access what across accounts, tenants, and projects.
- Verify that every cross-account role has an external ID or source ARN condition to prevent confused deputy attacks.
- Check that SAML and OIDC trust configurations include audience and subject restrictions — not just provider-level trust.
- Audit federation metadata certificates for expiration and rotation — expired IdP certificates cause outages or force insecure fallbacks.
- Review guest user and external identity access quarterly — former contractors and partners often retain access long after business need ends.
- Test actual cross-boundary access by attempting role assumption from different accounts to verify conditions are enforced.
Anti-Patterns
- Trusting a cross-account role without conditions — a role that any principal in another account can assume (no external ID, no source ARN) is a confused deputy vulnerability waiting to be exploited.
- Not reviewing federation trust at the IdP level — if the SAML IdP is compromised, every application that trusts it is compromised. Federation amplifies IdP risk.
- Treating cross-account access as temporary — "temporary" cross-account roles created for migrations, debugging, or vendor access frequently become permanent. Audit and remove them.
- Ignoring Organization SCP coverage — accounts not covered by deny-based SCPs can perform actions that the organization intends to prohibit. Verify SCP attachment on every account.
- Not documenting the business justification for each trust — without documented justification, it is impossible to determine whether a trust relationship should exist, making cleanup impossible.
Install this skill directly: skilldb add identity-iam-agent-skills
Related Skills
secret-management
Secret sprawl detection, key rotation assessment, and vault configuration review for authorized assessments
ad-security
Active Directory trust review, Kerberos assessment, and delegation risk analysis for authorized assessments
iam-policy-review
IAM policy analysis and least privilege assessment for authorized security assessments
mfa-coverage
MFA coverage assessment and bypass risk detection for authorized security assessments
privilege-escalation
Privilege escalation path detection in cloud and enterprise environments for authorized assessments
Planetscale
Build with PlanetScale as a serverless MySQL database. Use this skill when the project needs to integrate PlanetScale for serverless MySQL, branching, non-blocking schema changes, connection pooling, or Vitess-powered horizontal scaling. Covers the PlanetScale serverless driver, branching, deploy requests, and ORM integration.