$npx -y skills add anyshift-io/sre-skills --skill iam-deceptive-escalation-auditorAudit the union of every IAM policy attached to one principal for privilege-escalation paths that no single statement reveals, and for apparent escalations that are already neutralised. Resolves the effective permission set across all attached policies (Allow minus blanket Deny),
| 1 | # iam-deceptive-escalation-auditor |
| 2 | |
| 3 | Privilege-escalation audit skill for one AWS IAM principal. Takes every permissions policy |
| 4 | attached to a role or user (plus the trust policy and permissions boundary if supplied), |
| 5 | resolves the effective permission set across all of them, and answers one question a |
| 6 | per-statement read cannot: can this principal escalate to a privilege it was not granted, |
| 7 | and is an apparent escalation real or already neutralised. It returns findings with severity |
| 8 | and a fix, then names exactly where a single principal's policy documents stop being able to |
| 9 | answer the question. |
| 10 | |
| 11 | The escalation combinations this skill exists to catch are precisely the ones that **span |
| 12 | two statements or two attached policies**, so that no single statement looks guilty on its |
| 13 | own. `iam:PassRole` in one policy and `sagemaker:CreateTrainingJob` in another are each |
| 14 | routine; together they let the principal launch compute with any role attached and inherit |
| 15 | it. A per-statement read clears every statement and misses the union. The other half of the |
| 16 | skill is the inverse discipline: an explicit `Deny`, a resource scope, a broken trust, or an |
| 17 | unsatisfiable `Condition` can **neutralise** an escalation that still reads as critical, and |
| 18 | the audit must not fabricate a finding the effective permissions do not support. |
| 19 | |
| 20 | ## When to invoke |
| 21 | |
| 22 | - An agent is asked to audit an IAM role or user for privilege escalation, over-broad |
| 23 | grants, or "can this principal become administrator." |
| 24 | - A policy is being shipped or reviewed and the question is whether two individually-fine |
| 25 | grants combine into an escalation. |
| 26 | - A policy *looks* dangerous (a full mutation kit, a cross-account assume, an `Action '*'`) |
| 27 | and the claim "but it's capped / scoped / denied" needs to be confirmed against the |
| 28 | effective permissions, not taken on trust. |
| 29 | - An incident assumes a principal is compromised and the question is what it can escalate to. |
| 30 | |
| 31 | ## What this skill reads, and what it does not |
| 32 | |
| 33 | It reads the static policy documents attached to **one principal**: every permissions policy, |
| 34 | plus the trust policy (`AssumeRolePolicyDocument`) and the permissions boundary if supplied. |
| 35 | That is the entire input. The audit is correct and complete *for the effective permissions |
| 36 | those documents express*, and it is explicit about the rest. Every audit ends by naming the |
| 37 | joins it cannot make: |
| 38 | |
| 39 | - It does **not** see the principal's *other* attached policies if only some were supplied. |
| 40 | Effective permissions are the union of every managed and inline policy. Join: principal to |
| 41 | its full set of attached policies. |
| 42 | - It does **not** know the **permissions boundary** unless one is supplied. A boundary caps |
| 43 | what any Allow can actually grant. Join: principal to its permissions boundary. |
| 44 | - It does **not** see **org SCPs**. A Service Control Policy can Deny actions this policy |
| 45 | Allows and is invisible from the account. Join: account to its organization's SCPs. |
| 46 | - It does **not** contain the **privileges of a targeted role**. An escalation that passes, |
| 47 | assumes, or hijacks a role only matters if that role is more privileged than this |
| 48 | principal, and those privileges live in *other* documents. Join: this policy to the roles |
| 49 | and resources it references. |
| 50 | |
| 51 | A clean (neutralised) policy still gets a boundary section, because a capped policy is not a |
| 52 | proven-safe principal. |
| 53 | |
| 54 | ## The model |
| 55 | |
| 56 | Build the **effective permission set** across all attached policies. An action is granted |
| 57 | when some Allow statement matches it (by case-insensitive glob on `Action`, or by |
| 58 | `NotAction`) **and** no blanket `Deny` (on `Resource "*"`) matches it. Deny w |