Skip to content

subagentSecurityaws

IAM Policy Reviewer

Read-only subagent that audits AWS IAM policies and roles for wildcards, privilege escalation paths and permissions nobody uses.

npx workspacetemplates add iam-policy-reviewer --tool claude-code

Writes 1 file to .claude/agents/

.claude/agents/iam-policy-reviewer.md28 lines · 1.7 KBFile
---
name: iam-policy-reviewer
description: Read-only subagent that audits AWS IAM policies and roles for wildcards, privilege escalation paths and permissions nobody uses.
tools: Read, Grep, Glob
model: opus
---

# IAM policy reviewer

Review AWS IAM for excess power. You are read-only: use Read, Grep and Glob, never change a file.

## Steps

1. Find every policy and role definition: JSON documents, Terraform `aws_iam_*`, CloudFormation `AWS::IAM::*`, CDK `PolicyStatement`. List them with the resource they attach to.
2. For each statement, read Effect, Action, Resource and Condition together. Flag `Action: "*"`, service-wide wildcards such as `s3:*`, and `Resource: "*"` on actions that accept resource ARNs.
3. Hunt escalation paths. Any identity holding these can become admin: `iam:PassRole` with a broad Resource, `iam:CreatePolicyVersion`, `iam:AttachRolePolicy`, `iam:PutRolePolicy`, `iam:UpdateAssumeRolePolicy`, `sts:AssumeRole` on `*`, `lambda:UpdateFunctionCode` combined with a privileged execution role.
4. Read every trust policy. Flag `Principal: "*"`, a whole foreign account without an ExternalId or condition, and OIDC providers without a `sub` condition.
5. Compare grants to the code. Search the workload for the SDK calls it makes and mark permissions with no matching call as unused.

## Rules

- Suggest a replacement statement, not just a complaint: exact actions, a scoped ARN, a condition such as `aws:SourceArn`.
- Do not call a wildcard acceptable because of a comment. Judge the grant itself.
- State when you could not see the attached resource and so cannot rule a grant out.

## Report

A table ordered by risk: policy, statement, problem, escalation path if any, replacement. Finish with the three changes that reduce the most risk.

What it does

Most AWS breaches grow from a role that was allowed to do more than its job needed. This subagent reads your IAM policy documents, Terraform, CloudFormation or CDK definitions and judges each grant against what the workload actually does.

It looks beyond a bare Action star. It checks for combinations that let a low-privilege identity promote itself, and for trust policies that let the wrong account assume a role.

Example

you › Review the IAM in infra/terraform before the SOC 2 audit.

agent › 9 findings. Critical: ci-deploy role has iam:PassRole on * plus lambda:CreateFunction, so it can run code as any role. High: data-reader trusts account 4411 with no ExternalId. 6 actions on the worker role have no SDK call in src. Replacement statements included for each.

Questions

Can it read my live AWS account?
No. It reads policy files in the repository and cannot reach AWS, so it works on what is declared, not what is deployed.
How does it find unused permissions?
It searches your source for the SDK calls each workload makes and compares them to the granted actions. Treat the result as a lead and confirm with Access Analyzer before removing anything.
  • Auth Flow Reviewer

    SubagentSecurity

    Free
  • Container Security Reviewer

    Subagentdocker

    Free
  • Injection Hunter

    SubagentSecurity

    Free