KMS Key Policy Auditor
Mindset
One-line takeaway: the verdict is always the worst finding across
all dimensions, and three KMS actions are in a class of their own —
kms:Decrypt (blast-radius multiplier), kms:ScheduleKeyDeletion
(one-way door), and kms:CreateGrant (silent delegation vector).
KMS is the root of trust for data-at-rest encryption. A KMS key policy is
the authorisation gate for every ciphertext ever produced under that key.
kms:Decrypt is a blast-radius multiplier: one permission grants
read access to all encrypted data, not one record.
kms:ScheduleKeyDeletion is a one-way door: deleted key material is
permanently unrecoverable after the window expires.
kms:CreateGrant is a delegation vector: it can widen access beyond
what the key policy text shows (grants are a separate auth layer).
Quick reference — severity thresholds
| Condition |
Verdict |
Rule |
KeyState: PendingDeletion + PendingWindowInDays <= 7 |
CRITICAL |
Step 1 |
Principal: "*" + kms:Decrypt/kms:*/* + no strong condition |
CRITICAL |
Rule 5a/5b |
Cross-account + kms:Decrypt/kms:* + no strong condition |
CRITICAL |
Rule 5c/5d |
Cross-account + kms:PutKeyPolicy/kms:ScheduleKeyDeletion |
CRITICAL |
Rule 5d |
Principal: "*" + kms:CreateGrant + no strong condition |
CRITICAL |
Rule 5e |
Cross-account + kms:Encrypt/kms:CreateGrant + no strong condition |
HIGH |
Rule 5g/5h |
Principal: "*" + kms:Encrypt + no strong condition |
HIGH |
Rule 5f |
EnableKeyRotation: false on customer-managed SYMMETRIC_DEFAULT key |
HIGH |
Step 6 |
KeyState: PendingDeletion + PendingWindowInDays 8-30 |
HIGH |
Step 1 |
| Cross-account + any action + STRONG condition |
MEDIUM (downgrade) |
Rule 5k |
Cross-account + kms:Describe*/kms:List* only |
MEDIUM |
Rule 5j |
| Same-account only + named actions + rotation enabled + not pending deletion |
OK |
Step 7 |
See the ordered steps below for edge cases. Deep KMS authorization
internals (evaluation pipeline, grant chaining, policy versioning) are in
the Deep reference section
at the end.
Pre-flight: key metadata gate (run before policy classification)
Before evaluating the key policy, classify the key itself. Several key
attributes short-circuit the audit — misclassifying them produces false
positives that erode trust.
Pagination note + live-account pre-flight checks moved verbatim to
references/diagnostic-commands.md (load on demand).
| Attribute |
Value |
Effect on audit |
KeyManager |
AWS |
AWS-managed key (aws/s3, aws/ebs, etc.). Policy is managed by AWS — skip policy audit. Rotation is automatic (annual). Verdict: OK unless pending deletion (rare for AWS-managed keys). |
KeyManager |
CUSTOMER |
Proceed with full audit. |
KeySpec |
RSA_*, ECC_*, SM2 |
Asymmetric key. Automatic rotation is NOT supported. Do NOT flag EnableKeyRotation: false — it is a false positive. Still audit the policy. |
KeySpec |
HMAC_* |
HMAC key. No rotation concept. Do NOT flag rotation. Still audit the policy. |
KeySpec |
SYMMETRIC_DEFAULT |
Symmetric key. Rotation is supported — flag if disabled. |
Origin |
EXTERNAL |
Imported key material. Automatic rotation is N/A (you manage rotation by re-importing). Do NOT flag EnableKeyRotation: false. Still audit the policy. |
Origin |
AWS_CLOUDHSM |
Custom key store. Rotation is supported but managed via the HSM. Flag if EnableKeyRotation: false on a symmetric key. |
MultiRegion |
true |
Multi-Region key. Each replica has an INDEPENDENT key policy and INDEPENDENT rotation setting. Audit each replica separately — a policy change on the primary does NOT propagate to replicas. |
KeyState |
PendingDeletion |
Key scheduled for deletion. Jump to Step 1 (deletion window evaluation) — this is the highest-priority finding regardless of policy state. |
KeyState |
Disabled |
Key is administratively disabled — kms:Encrypt/Decrypt fail. Note as operational risk but not a security verdict driver unless combined with other findings. |
If the key policy JSON is malformed (invalid JSON, missing Statement,
missing Principal or Action/NotAction), output:
KEY: <key-id>
VERDICT: ERROR
REASON: Key policy document is not valid JSON or is missing required fields — cannot classify.
REMEDIATION: Retrieve the canonical policy with `aws kms get-key-policy --key-id <id> --policy-name default --output json` and re-audit.
Process — Classification logic (apply in order, aggregate worst)
Step 0: Expert knowledge — non-obvious KMS behaviors that change classification
Step-0 expert behaviors moved verbatim to references/advanced-patterns.md
(aliases, Resource semantics, Sign, ReEncrypt, grants, ViaService, more).
Step 1: Key deletion window (highest priority — irrecoverable data loss)
If KeyState is PendingDeletion, extract PendingWindowInDays:
PendingWindowInDays <= 7 → CRITICAL. The key becomes permanently
unrecoverable in 7 days or fewer. Any data encrypted under this key that
has no re-encryption path is on a countdown to permanent loss. More
importantly, kms:Encrypt and kms:Decrypt fail immediately when a
key enters PendingDeletion — the blast radius starts NOW, not at
expiry. Any live workload depending on this key is already experiencing
an outage.
PendingWindowInDays 8-30 → HIGH. The key is recoverable
(kms:CancelKeyDeletion) during the window, but the clock is ticking.
Identify all data dependencies and either cancel deletion or initiate
re-encryption to a replacement key.
The deletion window is evaluated first because it is the only finding that
produces time-irreversible data loss. A cross-account decrypt grant can
be revoked; a deleted key cannot be restored.
Step 2: Principal scope classification
For each Effect: Allow statement in the key policy, classify the principal:
WILDCARD_PRINCIPAL — Principal is "*", {"AWS": "*"}, or any
construct that resolves to all principals (including "*" nested under
Service or Federated). Note: Principal: {"AWS": "*"} is
functionally equivalent to Principal: "*" — both mean every AWS
account holder.
CROSS_ACCOUNT — Principal includes an ARN whose 12-digit account ID
differs from the key's owning account (the account in the key ARN).
Example: key ARN arn:aws:kms:us-east-1:111111111111:key/abc with
principal arn:aws:iam::222222222222:role/external-app is cross-account.
SAME_ACCOUNT — All principals share the key's owning account ID.
This includes the account root (arn:aws:iam::111111111111:root),
same-account roles, users, and services.
A statement with BOTH same-account and cross-account principals is
classified by the widest scope — CROSS_ACCOUNT.
Step 3: Action danger classification
Classify the action set in each Allow statement by danger level. A single
statement may span multiple levels — classify by the highest danger
action present:
| Danger level |
Actions |
Why |
| DATA_ACCESS |
kms:Decrypt, kms:DecryptDataKey, kms:GenerateDataKey*, kms:*, * |
Can read all ciphertext encrypted under this key. kms:Decrypt is a blast-radius multiplier — one permission, full data exposure. kms:GenerateDataKey* returns plaintext key material to the caller. |
| KEY_CONTROL |
kms:PutKeyPolicy, kms:ScheduleKeyDeletion, kms:Delete*, kms:DisableKey, kms:Update* |
Can modify the key policy (lockout attack), schedule deletion (data-loss vector), or disable the key (availability attack). |
| DELEGATION |
kms:CreateGrant, kms:RetireGrant (less dangerous) |
kms:CreateGrant delegates subset permissions to other principals — a privilege-widening vector similar to iam:PassRole. Grants can chain if the grant itself includes kms:CreateGrant. |
| DATA_WRITE |
kms:Encrypt, kms:ReEncrypt*, kms:GenerateMac |
Can encrypt/inject data under the key. Less dangerous than Decrypt (no data exfiltration) but enables ciphertext injection and re-encryption abuse. |
| METADATA |
kms:Describe*, kms:List*, kms:Get*, kms:Sign, kms:Verify |
Information disclosure (key spec, policy, grants). Sign/Verify apply to asymmetric signing keys. Low severity but still sensitive in aggregate. |
NotAction in an Allow statement is an inverse wildcard — it grants every
KMS action EXCEPT the listed ones. Treat as DATA_ACCESS + KEY_CONTROL +
DELEGATION (worst case) because new KMS APIs are automatically included.
Step 4: Condition strength evaluation
If an Allow statement includes a Condition block, evaluate whether the
condition genuinely restricts access or is bypassable:
STRONG conditions (downgrade severity by one level):
kms:ViaService (e.g., s3.us-east-1.amazonaws.com) — the request must
come through the named AWS service's infrastructure. The caller cannot
forge this; it is set by the AWS service layer. This is the strongest
KMS-specific condition because it couples key use to a known service
integration.
aws:SourceAccount with StringEquals — request must originate from
the named account. Set by the AWS service when a resource in that account
accesses the key.
aws:SourceArn with StringEquals/StringLike — request must
originate from the named resource ARN. Even tighter than SourceAccount.
kms:CallerAccount — KMS-specific: restricts to the named account.
Equivalent to aws:SourceAccount but set by KMS itself.
kms:EncryptionContext:* with StringEquals — for Decrypt, requires
the ciphertext to have been encrypted with a matching encryption context
pair. STRONG when the context is service-controlled (e.g., S3 sets the
bucket ARN as context); WEAK when the caller controls the context value
(see below).
WEAK conditions (do NOT downgrade — treat as no condition):
aws:SourceIp / aws:SourceIp containing 0.0.0.0/0 — IP-based
restrictions are bypassable by callers who control their egress. A
0.0.0.0/0 CIDR is the entire internet. Do NOT treat as a restriction.
kms:EncryptionContext:* when the caller controls the encryption
context — if the encrypting service lets the caller set arbitrary
context values, the caller can encrypt with a chosen context and then
decrypt with the same context. Only treat as STRONG when the context is
set by a service the caller does not control (e.g., S3, EBS).
aws:Referer, aws:UserAgent — trivially forgeable by any HTTP client.
Never treat as a restriction.
- Any condition wrapped in
IfExists — weakens the assertion; evaluate
the underlying key but flag the IfExists semantics.
Step 5: Cross-reference — the severity matrix
Combine the principal scope (Step 2), action danger (Step 3), and condition
strength (Step 4) to determine the statement's severity. Apply this matrix
in order — the first matching row is the statement severity:
| # |
Principal |
Action danger |
Condition |
Severity |
Rule citation |
| 5a |
WILDCARD_PRINCIPAL |
DATA_ACCESS |
None/weak |
CRITICAL |
Rule 5a: wildcard decrypt — any AWS account holder can read all encrypted data |
| 5b |
WILDCARD_PRINCIPAL |
KEY_CONTROL |
None/weak |
CRITICAL |
Rule 5b: wildcard key control — any account can replace the policy or schedule deletion |
| 5c |
CROSS_ACCOUNT |
DATA_ACCESS |
None/weak |
CRITICAL |
Rule 5c: cross-account decrypt — external account can read all encrypted data |
| 5d |
CROSS_ACCOUNT |
KEY_CONTROL |
None/weak |
CRITICAL |
Rule 5d: cross-account key control — external account can lock out the owner |
| 5e |
WILDCARD_PRINCIPAL |
DELEGATION |
None/weak |
CRITICAL |
Rule 5e: wildcard CreateGrant — any account can delegate access to anyone |
| 5f |
WILDCARD_PRINCIPAL |
DATA_WRITE |
None/weak |
HIGH |
Rule 5f: wildcard encrypt — any account can inject ciphertext under this key |
| 5g |
CROSS_ACCOUNT |
DELEGATION |
None/weak |
HIGH |
Rule 5g: cross-account CreateGrant — external principal can widen access via grants |
| 5h |
CROSS_ACCOUNT |
DATA_WRITE |
None/weak |
HIGH |
Rule 5h: cross-account encrypt — external principal can inject ciphertext |
| 5i |
WILDCARD_PRINCIPAL |
METADATA |
None/weak |
MEDIUM |
Rule 5i: wildcard metadata — any account can enumerate key config |
| 5j |
CROSS_ACCOUNT |
METADATA |
None/weak |
MEDIUM |
Rule 5j: cross-account metadata — external principal can enumerate key config |
| 5k |
WILDCARD or CROSS |
Any above |
STRONG |
Downgrade one level |
Rule 5k: strong condition narrows exposure — fragile but currently restricted |
| 5l |
SAME_ACCOUNT |
Any |
Any |
MEDIUM at worst |
Rule 5l: same-account — IAM policies still apply; not a cross-account exposure |
Special case — the account-root statement: The default KMS key policy
includes a statement allowing Principal: {AWS: "arn:aws:iam::ACCOUNT:root"}
with Action: "kms:*". This is the root-of-trust statement — it delegates
key management to the account's IAM policies. Without it, the key is only
accessible via the key policy (not IAM), which can surprise operators. This
statement is NORMAL and required — do NOT flag it as WILDCARD or HIGH.
Classify as SAME_ACCOUNT / OK unless the action is kms:* on Principal: "*"
(which is different from root).
The kms:* to root vs kms:* to "*" distinction:
Principal: {"AWS": "arn:aws:iam::111111111111:root"} + kms:* →
NORMAL (delegates to IAM within the account). Not flagged.
Principal: "*" + kms:* → CRITICAL (any AWS account has full key
control). Flagged per Rule 5a/5b.
Step 6: Rotation status evaluation
Evaluate EnableKeyRotation only for keys where rotation is applicable
(see Pre-flight gate):
- Customer-managed symmetric key +
EnableKeyRotation: false →
HIGH (additive finding). The key material never changes — if the
key material is ever compromised, all past and future ciphertext is
exposed indefinitely. Annual rotation limits the blast window.
- Customer-managed symmetric key +
EnableKeyRotation: true →
OK for this dimension (no finding).
- Asymmetric / HMAC / EXTERNAL origin → N/A. Do NOT flag. Emit a note:
"Rotation N/A for KeySpec= / Origin= — automatic rotation
not supported."
- AWS-managed key → Rotation is automatic (annual). OK.
Multi-Region keys: check EnableKeyRotation on EACH replica
independently. A primary with rotation enabled but a replica with rotation
disabled is HIGH for the replica.
Rotation timing expert note moved verbatim to
references/advanced-patterns.md (load on demand).
Step 7: Aggregation — worst finding wins
The final verdict is the maximum severity across all findings from all
steps, where CRITICAL > HIGH > MEDIUM > OK:
verdict = max(all_statement_severities, rotation_severity, deletion_window_severity)
If no findings (all dimensions OK), the verdict is OK.
Output format (per key)
KEY: <key-id or alias>
VERDICT: CRITICAL | HIGH | MEDIUM | OK
REASON: <1-2 sentences citing the worst finding and its rule number>
FINDINGS:
- [CRITICAL] <finding description (Rule Na)>
- [HIGH] <finding description (Rule Nb)>
- [OK] <dimension that passed>
REMEDIATION: <specific action per finding, or "None required" if OK>
Worked example — cross-account decrypt with rotation disabled
KEY: arn:aws:kms:us-east-1:111111111111:key/abc-123
VERDICT: CRITICAL
REASON: Statement 1 grants kms:Decrypt to a cross-account principal
(222222222222) with no restrictive condition — external account can read all
ciphertext encrypted under this key (Rule 5c). Rotation is also disabled.
FINDINGS:
- [CRITICAL] Cross-account kms:Decrypt to 222222222222 with no condition (Rule 5c)
- [HIGH] EnableKeyRotation is false on a customer-managed symmetric key (Step 6)
REMEDIATION:
1. Remove the cross-account principal from Statement 1, or add a strong
condition (kms:ViaService, aws:SourceAccount) to scope the grant.
2. Enable rotation: aws kms enable-key-rotation --key-id abc-123.
Edge-case handling
Edge-case detail moved verbatim to references/advanced-patterns.md
(malformed statements, Deny conflicts, NotPrincipal, empty policy, more).
Anti-Patterns — NEVER
NEVER classify a Principal: "*" grant with kms:Decrypt as anything
other than CRITICAL. kms:Decrypt is a blast-radius multiplier — one
permission grants read access to every ciphertext encrypted under the
key, across every service that uses it (S3, EBS, RDS, Secrets Manager).
This is not "broad access" — it is total data exposure.
NEVER treat Principal: {"AWS": "arn:aws:iam::ACCOUNT:root"} + kms:*
as a vulnerability. This is the default root-of-trust statement that
delegates key management to the account's IAM policies. Removing it makes
the key accessible only via the key policy (IAM is bypassed), which
breaks IAM-based access patterns. Flagging it as WILDCARD is a
false positive that causes unnecessary policy churn.
NEVER flag EnableKeyRotation: false on an asymmetric key
(KeySpec RSA_*, ECC_*, SM2) or HMAC key (KeySpec HMAC_*).
These key types do not support automatic rotation — the flag is always
false and flagging it is a false positive. Check KeySpec before
evaluating rotation.
NEVER flag EnableKeyRotation: false on a key with Origin: EXTERNAL
(imported key material). Rotation for imported keys is managed by
re-importing new key material — the automatic-rotation flag is
permanently false and irrelevant.
NEVER skip auditing multi-region replica keys. Each replica has an
independent key policy and independent rotation setting. A primary with
a clean policy does NOT imply replicas are clean — a common mistake is
auditing only the primary and missing a cross-account grant on a replica
in another region.
NEVER classify a Principal: "*" grant with a STRONG condition
(kms:ViaService, aws:SourceAccount, kms:CallerAccount,
aws:SourceArn) as CRITICAL. The condition narrows access to a known
service or account. Downgrade one level per Rule 5k. Classifying it as
CRITICAL conflates "currently restricted" with "unrestricted" and
produces alert fatigue.
NEVER treat aws:SourceIp with 0.0.0.0/0 as a real condition. This
CIDR is the entire internet and provides zero restriction. Treat the
statement as if the condition is absent.
NEVER treat kms:EncryptionContext as unconditionally STRONG when the
caller controls the encryption context. If the calling service lets the
principal set arbitrary context values, the principal can encrypt with a
chosen context and decrypt with the same context — the condition is
self-satisfiable. Only treat as STRONG when the context is set by
infrastructure the caller does not control (e.g., S3 bucket ARN, EBS
volume ID).
NEVER assume a key in PendingDeletion can still decrypt data. KMS
rejects all kms:Encrypt and kms:Decrypt calls the moment a key
enters PendingDeletion — the blast radius starts at scheduling, not
at window expiry. A key in PendingDeletion with live data dependencies
is an active outage, not a future risk.
NEVER recommend deleting a KMS key as remediation without first
verifying that no resources are encrypted under it. Key deletion is
irreversible after the window expires. Run
aws kms list-resource-tags, check CloudTrail for recent
kms:Encrypt/GenerateDataKey calls, and confirm with application
owners before scheduling deletion. This is a one-way door.
NEVER recommend replacing a cross-account key policy grant with an
AWS-managed key (aws/s3, aws/ebs) without explaining the trade-off.
AWS-managed keys are shared across all accounts in the region — they
cannot be restricted to specific principals. The remediation for
cross-account exposure is to tighten the customer-managed key policy,
not to downgrade to a shared AWS-managed key.
NEVER ignore the kms:CreateGrant permission. It is a delegation vector
— a principal with kms:CreateGrant can create grants that delegate
Decrypt/Encrypt to other principals, widening access beyond what the key
policy text shows. Treat as DELEGATION danger level and apply the
severity matrix.
NEVER classify a same-account-only policy with named actions as worse
than MEDIUM. Same-account access is governed by IAM policies (identity-
based + resource-based intersection for cross-principal), which provides
a second layer of authorisation. The key policy is not the only gate.
NEVER overlook NotPrincipal in an Allow statement. NotPrincipal
grants to every principal EXCEPT the listed one — the inverse of the
intended scope, and almost always a typo or copy-paste error. In a key
policy, an Allow with NotPrincipal: {AWS: "arn:aws:iam::111:root"}
grants KMS access to every AWS account EXCEPT 111. This is a
CRITICAL-severity finding on any DATA_ACCESS action (treat as
WILDCARD_PRINCIPAL), and the remediation is to replace NotPrincipal
with an explicit Principal listing the intended grantees. The same
logic applies to NotAction in an Allow (inverse wildcard — grants
every action except the listed ones); classify as DATA_ACCESS +
KEY_CONTROL + DELEGATION worst-case.
NEVER assume the key policy is the complete access picture when
kms:CreateGrant is present. Grants are a separate authorisation
layer evaluated after the key policy and IAM. A principal with
kms:CreateGrant can create a grant that delegates Decrypt to another
principal — even if that delegatee has no IAM or key-policy grant.
Grants can chain up to 2 levels deep (a grantee can create a sub-grant
if CreateGrant is in their grant). Always enumerate live grants with
aws kms list-grants --key-id <id> when CreateGrant appears in the
policy — the key policy text alone does not show grant-based access.
NEVER treat aws:SourceIp restrictions as equivalent to
kms:ViaService or aws:SourceAccount. SourceIp is caller-controlled
in practice: any principal with a VPC NAT gateway, a proxy, or a VPN
can route through an allowed CIDR. ViaService and SourceAccount are set
by the AWS service infrastructure — the caller cannot forge them.
SourceIp downgrades cross-account severity by zero levels (treat as no
condition); ViaService/SourceAccount downgrade by one level.
NEVER assume the key policy alone reflects the complete access picture
when kms:CreateGrant is in the policy. Grants are a separate
authorisation layer — a grantee can access the key even with zero IAM
or key-policy permissions. The only way to see grant-based access is
aws kms list-grants --key-id <id>. An audit that checks only the key
policy text misses every live grant. When kms:CreateGrant is present,
always enumerate grants and flag any grantee not also named in the
policy.
NEVER attempt to modify the policy of an AWS-managed key
(KeyManager: AWS, aliases like aws/s3, aws/ebs, aws/rds).
AWS-managed key policies are not customer-editable — kms:PutKeyPolicy
returns AccessDeniedException. If the input shows a custom policy on
a key with KeyManager: AWS, the input is either stale (the policy was
changed by AWS since the snapshot) or the KeyManager field is
misidentified. Re-fetch with aws kms describe-key before acting.
Pre-flight safety checks (run before any remediation CLI)
Pre-flight safety checks moved verbatim to
references/diagnostic-commands.md (load on demand).
Remediation guidance
Remediation ordering principle: always prefer additive changes over
destructive changes. Add a Deny statement (blocks access immediately,
reversible by removing the Deny) BEFORE removing an Allow statement
(which may break a workload you did not anticipate). The safe sequence
for any CRITICAL policy finding is: (1) back up policy, (2) add a Deny
that blocks the exposed principal/action, (3) verify the Deny is effective
via aws kms describe-key + IAM policy simulator, (4) only then remove
the offending Allow statement. This ordering prevents a window where
neither the old nor new policy is in effect.
Per-severity remediation runbooks moved verbatim to
references/error-handling.md (load on demand).
Condition strength reference (KMS-specific)
Condition strength table moved verbatim to
references/advanced-patterns.md (load on demand).
Deep reference: KMS authorization internals
Authorization internals moved verbatim to
references/advanced-patterns.md (load on demand).
Recent AWS features (2024-2026)
Recent-feature notes moved verbatim to
references/advanced-patterns.md (load on demand).
References (load on demand)
references/advanced-patterns.md — Step-0 expert KMS behaviors, rotation timing, edge-case handling, condition-strength table, authorization internals, recent AWS features.
references/diagnostic-commands.md — account-wide sweep pagination, live-account pre-flight checks, pre-flight safety checks (confirmation gate, backups).
references/error-handling.md — remediation guidance by severity (CRITICAL/HIGH/MEDIUM/OK runbooks).
Domain
AWS CloudOps / KMS Encryption Security & Compliance.
AWS documentation
1---2name: kms-key-policy-auditor3description: Audits AWS KMS key policies and key metadata for cross-account or external principals, wildcard kms:* grants, the kms:Decrypt blast-radius multiplier, automatic-key-rotation status, and key-deletion window exposure. Emits a deterministic severity verdict (CRITICAL | HIGH | MEDIUM | OK) per key with enumerated findings and specific remediation. Use when reviewing KMS key policies, checking for cross-account decrypt access, validating rotation enablement, auditing key deletion windows, or hardening encryption key posture before production deployment.4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). No AWS CLI required for offline policy-document classification. Live-account audits use aws kms describe-key, aws kms get-key-policy, and aws kms list-keys (AWS CLI v2, SSO or key-based credentials).6metadata:7 source: https://skillmd.com/skills/jhkchan/kms-key-policy-auditor8 domain: aws-cloudops9 complexity: high10 requires_llm: 'true'11 phase: '2'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: Security15 verdict_shape: CRITICAL | HIGH | MEDIUM | OK16 when_to_use: Reviewing a KMS key policy before production deployment, checking for cross-account or external principal access, auditing wildcard kms:* grants, validating automatic key rotation, inspecting a key deletion window, or hardening encryption-key posture across an account.17 activation_triggers: audit this KMS key policy, is my KMS key exposed cross-account, check kms:Decrypt blast radius, review key deletion window, is key rotation enabled, harden KMS key policy, who can kms:Decrypt, kms key policy too permissive18 invocation_schema: 'Input: either (a) a KMS key policy JSON document, optionally paired with describe-key metadata, OR (b) a key-id/ARN for live-account audit. Output: deterministic KEY/VERDICT/REASON/FINDINGS/REMEDIATION block per key, where VERDICT ∈ {CRITICAL, HIGH, MEDIUM, OK, ERROR}.'19 version: 0.2.020 author: Jacky Chan — AWS Community Builder21 keywords: KMS, key policy, cross-account, kms:Decrypt, kms:*, wildcard permissions, key rotation, key deletion, PendingDeletion, EnableKeyRotation, kms:CreateGrant, kms:ScheduleKeyDeletion, encryption key audit, data-at-rest, blast radius, kms:ViaService, Principal:"*", key policy remediation22 tags: kms, security, key-policy, cross-account, rotation, deletion-window, encryption, audit23---2425# KMS Key Policy Auditor2627## Mindset2829**One-line takeaway:** the verdict is always the **worst** finding across30all dimensions, and three KMS actions are in a class of their own —31`kms:Decrypt` (blast-radius multiplier), `kms:ScheduleKeyDeletion`32(one-way door), and `kms:CreateGrant` (silent delegation vector).3334KMS is the root of trust for data-at-rest encryption. A KMS key policy is35the authorisation gate for every ciphertext ever produced under that key.36- `kms:Decrypt` is a **blast-radius multiplier**: one permission grants37 read access to *all* encrypted data, not one record.38- `kms:ScheduleKeyDeletion` is a **one-way door**: deleted key material is39 permanently unrecoverable after the window expires.40- `kms:CreateGrant` is a **delegation vector**: it can widen access beyond41 what the key policy text shows (grants are a separate auth layer).4243## Quick reference — severity thresholds4445| Condition | Verdict | Rule |46|---|---|---|47| `KeyState: PendingDeletion` + `PendingWindowInDays <= 7` | **CRITICAL** | Step 1 |48| `Principal: "*"` + `kms:Decrypt`/`kms:*`/`*` + no strong condition | **CRITICAL** | Rule 5a/5b |49| Cross-account + `kms:Decrypt`/`kms:*` + no strong condition | **CRITICAL** | Rule 5c/5d |50| Cross-account + `kms:PutKeyPolicy`/`kms:ScheduleKeyDeletion` | **CRITICAL** | Rule 5d |51| `Principal: "*"` + `kms:CreateGrant` + no strong condition | **CRITICAL** | Rule 5e |52| Cross-account + `kms:Encrypt`/`kms:CreateGrant` + no strong condition | **HIGH** | Rule 5g/5h |53| `Principal: "*"` + `kms:Encrypt` + no strong condition | **HIGH** | Rule 5f |54| `EnableKeyRotation: false` on customer-managed SYMMETRIC_DEFAULT key | **HIGH** | Step 6 |55| `KeyState: PendingDeletion` + `PendingWindowInDays 8-30` | **HIGH** | Step 1 |56| Cross-account + any action + STRONG condition | **MEDIUM** (downgrade) | Rule 5k |57| Cross-account + `kms:Describe*`/`kms:List*` only | **MEDIUM** | Rule 5j |58| Same-account only + named actions + rotation enabled + not pending deletion | **OK** | Step 7 |5960See the ordered steps below for edge cases. Deep KMS authorization61internals (evaluation pipeline, grant chaining, policy versioning) are in62the [Deep reference](#deep-reference-kms-authorization-internals) section63at the end.6465## Pre-flight: key metadata gate (run before policy classification)6667Before evaluating the key policy, classify the key itself. Several key68attributes **short-circuit** the audit — misclassifying them produces false69positives that erode trust.7071Pagination note + live-account pre-flight checks moved verbatim to72`references/diagnostic-commands.md` (load on demand).7374| Attribute | Value | Effect on audit |75|---|---|---|76| `KeyManager` | `AWS` | **AWS-managed key** (`aws/s3`, `aws/ebs`, etc.). Policy is managed by AWS — skip policy audit. Rotation is automatic (annual). Verdict: **OK** unless pending deletion (rare for AWS-managed keys). |77| `KeyManager` | `CUSTOMER` | Proceed with full audit. |78| `KeySpec` | `RSA_*`, `ECC_*`, `SM2` | **Asymmetric key.** Automatic rotation is NOT supported. Do NOT flag `EnableKeyRotation: false` — it is a false positive. Still audit the policy. |79| `KeySpec` | `HMAC_*` | **HMAC key.** No rotation concept. Do NOT flag rotation. Still audit the policy. |80| `KeySpec` | `SYMMETRIC_DEFAULT` | **Symmetric key.** Rotation is supported — flag if disabled. |81| `Origin` | `EXTERNAL` | **Imported key material.** Automatic rotation is N/A (you manage rotation by re-importing). Do NOT flag `EnableKeyRotation: false`. Still audit the policy. |82| `Origin` | `AWS_CLOUDHSM` | Custom key store. Rotation is supported but managed via the HSM. Flag if `EnableKeyRotation: false` on a symmetric key. |83| `MultiRegion` | `true` | **Multi-Region key.** Each replica has an INDEPENDENT key policy and INDEPENDENT rotation setting. Audit each replica separately — a policy change on the primary does NOT propagate to replicas. |84| `KeyState` | `PendingDeletion` | **Key scheduled for deletion.** Jump to Step 1 (deletion window evaluation) — this is the highest-priority finding regardless of policy state. |85| `KeyState` | `Disabled` | Key is administratively disabled — `kms:Encrypt`/`Decrypt` fail. Note as operational risk but not a security verdict driver unless combined with other findings. |8687**If the key policy JSON is malformed** (invalid JSON, missing `Statement`,88missing `Principal` or `Action`/`NotAction`), output:8990```text91KEY: <key-id>92VERDICT: ERROR93REASON: Key policy document is not valid JSON or is missing required fields — cannot classify.94REMEDIATION: Retrieve the canonical policy with `aws kms get-key-policy --key-id <id> --policy-name default --output json` and re-audit.95```9697## Process — Classification logic (apply in order, aggregate worst)9899### Step 0: Expert knowledge — non-obvious KMS behaviors that change classification100101Step-0 expert behaviors moved verbatim to `references/advanced-patterns.md`102(aliases, Resource semantics, Sign, ReEncrypt, grants, ViaService, more).103104### Step 1: Key deletion window (highest priority — irrecoverable data loss)105106If `KeyState` is `PendingDeletion`, extract `PendingWindowInDays`:107108- **PendingWindowInDays <= 7** → **CRITICAL**. The key becomes permanently109 unrecoverable in 7 days or fewer. Any data encrypted under this key that110 has no re-encryption path is on a countdown to permanent loss. More111 importantly, `kms:Encrypt` and `kms:Decrypt` **fail immediately** when a112 key enters `PendingDeletion` — the blast radius starts NOW, not at113 expiry. Any live workload depending on this key is already experiencing114 an outage.115116- **PendingWindowInDays 8-30** → **HIGH**. The key is recoverable117 (`kms:CancelKeyDeletion`) during the window, but the clock is ticking.118 Identify all data dependencies and either cancel deletion or initiate119 re-encryption to a replacement key.120121The deletion window is evaluated first because it is the only finding that122produces **time-irreversible data loss**. A cross-account decrypt grant can123be revoked; a deleted key cannot be restored.124125### Step 2: Principal scope classification126127For each `Effect: Allow` statement in the key policy, classify the principal:128129- **WILDCARD_PRINCIPAL** — Principal is `"*"`, `{"AWS": "*"}`, or any130 construct that resolves to all principals (including `"*"` nested under131 `Service` or `Federated`). Note: `Principal: {"AWS": "*"}` is132 functionally equivalent to `Principal: "*"` — both mean every AWS133 account holder.134135- **CROSS_ACCOUNT** — Principal includes an ARN whose 12-digit account ID136 differs from the key's owning account (the account in the key ARN).137 Example: key ARN `arn:aws:kms:us-east-1:111111111111:key/abc` with138 principal `arn:aws:iam::222222222222:role/external-app` is cross-account.139140- **SAME_ACCOUNT** — All principals share the key's owning account ID.141 This includes the account root (`arn:aws:iam::111111111111:root`),142 same-account roles, users, and services.143144A statement with BOTH same-account and cross-account principals is145classified by the **widest** scope — CROSS_ACCOUNT.146147### Step 3: Action danger classification148149Classify the action set in each Allow statement by danger level. A single150statement may span multiple levels — classify by the **highest** danger151action present:152153| Danger level | Actions | Why |154|---|---|---|155| **DATA_ACCESS** | `kms:Decrypt`, `kms:DecryptDataKey`, `kms:GenerateDataKey*`, `kms:*`, `*` | Can read **all** ciphertext encrypted under this key. `kms:Decrypt` is a blast-radius multiplier — one permission, full data exposure. `kms:GenerateDataKey*` returns plaintext key material to the caller. |156| **KEY_CONTROL** | `kms:PutKeyPolicy`, `kms:ScheduleKeyDeletion`, `kms:Delete*`, `kms:DisableKey`, `kms:Update*` | Can modify the key policy (lockout attack), schedule deletion (data-loss vector), or disable the key (availability attack). |157| **DELEGATION** | `kms:CreateGrant`, `kms:RetireGrant` (less dangerous) | `kms:CreateGrant` delegates subset permissions to other principals — a privilege-widening vector similar to `iam:PassRole`. Grants can chain if the grant itself includes `kms:CreateGrant`. |158| **DATA_WRITE** | `kms:Encrypt`, `kms:ReEncrypt*`, `kms:GenerateMac` | Can encrypt/inject data under the key. Less dangerous than Decrypt (no data exfiltration) but enables ciphertext injection and re-encryption abuse. |159| **METADATA** | `kms:Describe*`, `kms:List*`, `kms:Get*`, `kms:Sign`, `kms:Verify` | Information disclosure (key spec, policy, grants). `Sign`/`Verify` apply to asymmetric signing keys. Low severity but still sensitive in aggregate. |160161`NotAction` in an Allow statement is an inverse wildcard — it grants every162KMS action EXCEPT the listed ones. Treat as DATA_ACCESS + KEY_CONTROL +163DELEGATION (worst case) because new KMS APIs are automatically included.164165### Step 4: Condition strength evaluation166167If an Allow statement includes a `Condition` block, evaluate whether the168condition genuinely restricts access or is bypassable:169170**STRONG conditions (downgrade severity by one level):**171- `kms:ViaService` (e.g., `s3.us-east-1.amazonaws.com`) — the request must172 come through the named AWS service's infrastructure. The caller cannot173 forge this; it is set by the AWS service layer. This is the strongest174 KMS-specific condition because it couples key use to a known service175 integration.176- `aws:SourceAccount` with `StringEquals` — request must originate from177 the named account. Set by the AWS service when a resource in that account178 accesses the key.179- `aws:SourceArn` with `StringEquals`/`StringLike` — request must180 originate from the named resource ARN. Even tighter than SourceAccount.181- `kms:CallerAccount` — KMS-specific: restricts to the named account.182 Equivalent to `aws:SourceAccount` but set by KMS itself.183- `kms:EncryptionContext:*` with `StringEquals` — for Decrypt, requires184 the ciphertext to have been encrypted with a matching encryption context185 pair. STRONG when the context is service-controlled (e.g., S3 sets the186 bucket ARN as context); WEAK when the caller controls the context value187 (see below).188189**WEAK conditions (do NOT downgrade — treat as no condition):**190- `aws:SourceIp` / `aws:SourceIp` containing `0.0.0.0/0` — IP-based191 restrictions are bypassable by callers who control their egress. A192 `0.0.0.0/0` CIDR is the entire internet. Do NOT treat as a restriction.193- `kms:EncryptionContext:*` when the caller controls the encryption194 context — if the encrypting service lets the caller set arbitrary195 context values, the caller can encrypt with a chosen context and then196 decrypt with the same context. Only treat as STRONG when the context is197 set by a service the caller does not control (e.g., S3, EBS).198- `aws:Referer`, `aws:UserAgent` — trivially forgeable by any HTTP client.199 Never treat as a restriction.200- Any condition wrapped in `IfExists` — weakens the assertion; evaluate201 the underlying key but flag the `IfExists` semantics.202203### Step 5: Cross-reference — the severity matrix204205Combine the principal scope (Step 2), action danger (Step 3), and condition206strength (Step 4) to determine the statement's severity. Apply this matrix207in order — the first matching row is the statement severity:208209| # | Principal | Action danger | Condition | Severity | Rule citation |210|---|---|---|---|---|---|211| 5a | WILDCARD_PRINCIPAL | DATA_ACCESS | None/weak | **CRITICAL** | Rule 5a: wildcard decrypt — any AWS account holder can read all encrypted data |212| 5b | WILDCARD_PRINCIPAL | KEY_CONTROL | None/weak | **CRITICAL** | Rule 5b: wildcard key control — any account can replace the policy or schedule deletion |213| 5c | CROSS_ACCOUNT | DATA_ACCESS | None/weak | **CRITICAL** | Rule 5c: cross-account decrypt — external account can read all encrypted data |214| 5d | CROSS_ACCOUNT | KEY_CONTROL | None/weak | **CRITICAL** | Rule 5d: cross-account key control — external account can lock out the owner |215| 5e | WILDCARD_PRINCIPAL | DELEGATION | None/weak | **CRITICAL** | Rule 5e: wildcard CreateGrant — any account can delegate access to anyone |216| 5f | WILDCARD_PRINCIPAL | DATA_WRITE | None/weak | **HIGH** | Rule 5f: wildcard encrypt — any account can inject ciphertext under this key |217| 5g | CROSS_ACCOUNT | DELEGATION | None/weak | **HIGH** | Rule 5g: cross-account CreateGrant — external principal can widen access via grants |218| 5h | CROSS_ACCOUNT | DATA_WRITE | None/weak | **HIGH** | Rule 5h: cross-account encrypt — external principal can inject ciphertext |219| 5i | WILDCARD_PRINCIPAL | METADATA | None/weak | **MEDIUM** | Rule 5i: wildcard metadata — any account can enumerate key config |220| 5j | CROSS_ACCOUNT | METADATA | None/weak | **MEDIUM** | Rule 5j: cross-account metadata — external principal can enumerate key config |221| 5k | WILDCARD or CROSS | Any above | STRONG | **Downgrade one level** | Rule 5k: strong condition narrows exposure — fragile but currently restricted |222| 5l | SAME_ACCOUNT | Any | Any | **MEDIUM at worst** | Rule 5l: same-account — IAM policies still apply; not a cross-account exposure |223224**Special case — the account-root statement:** The default KMS key policy225includes a statement allowing `Principal: {AWS: "arn:aws:iam::ACCOUNT:root"}`226with `Action: "kms:*"`. This is the **root-of-trust statement** — it delegates227key management to the account's IAM policies. Without it, the key is only228accessible via the key policy (not IAM), which can surprise operators. This229statement is **NORMAL and required** — do NOT flag it as WILDCARD or HIGH.230Classify as SAME_ACCOUNT / OK unless the action is `kms:*` on `Principal: "*"`231(which is different from root).232233**The `kms:*` to root vs `kms:*` to `"*"` distinction:**234- `Principal: {"AWS": "arn:aws:iam::111111111111:root"}` + `kms:*` →235 **NORMAL** (delegates to IAM within the account). Not flagged.236- `Principal: "*"` + `kms:*` → **CRITICAL** (any AWS account has full key237 control). Flagged per Rule 5a/5b.238239### Step 6: Rotation status evaluation240241Evaluate `EnableKeyRotation` only for keys where rotation is applicable242(see Pre-flight gate):243244- **Customer-managed symmetric key + `EnableKeyRotation: false`** →245 **HIGH** (additive finding). The key material never changes — if the246 key material is ever compromised, all past and future ciphertext is247 exposed indefinitely. Annual rotation limits the blast window.248- **Customer-managed symmetric key + `EnableKeyRotation: true`** →249 OK for this dimension (no finding).250- **Asymmetric / HMAC / EXTERNAL origin** → N/A. Do NOT flag. Emit a note:251 "Rotation N/A for KeySpec=<spec> / Origin=<origin> — automatic rotation252 not supported."253- **AWS-managed key** → Rotation is automatic (annual). OK.254255**Multi-Region keys:** check `EnableKeyRotation` on EACH replica256independently. A primary with rotation enabled but a replica with rotation257disabled is HIGH for the replica.258259Rotation timing expert note moved verbatim to260`references/advanced-patterns.md` (load on demand).261262### Step 7: Aggregation — worst finding wins263264The final verdict is the **maximum severity** across all findings from all265steps, where CRITICAL > HIGH > MEDIUM > OK:266267```text268verdict = max(all_statement_severities, rotation_severity, deletion_window_severity)269```270271If no findings (all dimensions OK), the verdict is **OK**.272273## Output format (per key)274275```text276KEY: <key-id or alias>277VERDICT: CRITICAL | HIGH | MEDIUM | OK278REASON: <1-2 sentences citing the worst finding and its rule number>279FINDINGS:280 - [CRITICAL] <finding description (Rule Na)>281 - [HIGH] <finding description (Rule Nb)>282 - [OK] <dimension that passed>283REMEDIATION: <specific action per finding, or "None required" if OK>284```285286### Worked example — cross-account decrypt with rotation disabled287288```text289KEY: arn:aws:kms:us-east-1:111111111111:key/abc-123290VERDICT: CRITICAL291REASON: Statement 1 grants kms:Decrypt to a cross-account principal292(222222222222) with no restrictive condition — external account can read all293ciphertext encrypted under this key (Rule 5c). Rotation is also disabled.294FINDINGS:295 - [CRITICAL] Cross-account kms:Decrypt to 222222222222 with no condition (Rule 5c)296 - [HIGH] EnableKeyRotation is false on a customer-managed symmetric key (Step 6)297REMEDIATION:298 1. Remove the cross-account principal from Statement 1, or add a strong299 condition (kms:ViaService, aws:SourceAccount) to scope the grant.300 2. Enable rotation: aws kms enable-key-rotation --key-id abc-123.301```302303## Edge-case handling304305Edge-case detail moved verbatim to `references/advanced-patterns.md`306(malformed statements, Deny conflicts, NotPrincipal, empty policy, more).307308## Anti-Patterns — NEVER309310- NEVER classify a `Principal: "*"` grant with `kms:Decrypt` as anything311 other than CRITICAL. `kms:Decrypt` is a blast-radius multiplier — one312 permission grants read access to every ciphertext encrypted under the313 key, across every service that uses it (S3, EBS, RDS, Secrets Manager).314 This is not "broad access" — it is total data exposure.315316- NEVER treat `Principal: {"AWS": "arn:aws:iam::ACCOUNT:root"}` + `kms:*`317 as a vulnerability. This is the **default root-of-trust statement** that318 delegates key management to the account's IAM policies. Removing it makes319 the key accessible only via the key policy (IAM is bypassed), which320 breaks IAM-based access patterns. Flagging it as WILDCARD is a321 false positive that causes unnecessary policy churn.322323- NEVER flag `EnableKeyRotation: false` on an **asymmetric key**324 (KeySpec `RSA_*`, `ECC_*`, `SM2`) or **HMAC key** (KeySpec `HMAC_*`).325 These key types do not support automatic rotation — the flag is always326 false and flagging it is a false positive. Check `KeySpec` before327 evaluating rotation.328329- NEVER flag `EnableKeyRotation: false` on a key with `Origin: EXTERNAL`330 (imported key material). Rotation for imported keys is managed by331 re-importing new key material — the automatic-rotation flag is332 permanently false and irrelevant.333334- NEVER skip auditing **multi-region replica keys**. Each replica has an335 independent key policy and independent rotation setting. A primary with336 a clean policy does NOT imply replicas are clean — a common mistake is337 auditing only the primary and missing a cross-account grant on a replica338 in another region.339340- NEVER classify a `Principal: "*"` grant with a STRONG condition341 (`kms:ViaService`, `aws:SourceAccount`, `kms:CallerAccount`,342 `aws:SourceArn`) as CRITICAL. The condition narrows access to a known343 service or account. Downgrade one level per Rule 5k. Classifying it as344 CRITICAL conflates "currently restricted" with "unrestricted" and345 produces alert fatigue.346347- NEVER treat `aws:SourceIp` with `0.0.0.0/0` as a real condition. This348 CIDR is the entire internet and provides zero restriction. Treat the349 statement as if the condition is absent.350351- NEVER treat `kms:EncryptionContext` as unconditionally STRONG when the352 caller controls the encryption context. If the calling service lets the353 principal set arbitrary context values, the principal can encrypt with a354 chosen context and decrypt with the same context — the condition is355 self-satisfiable. Only treat as STRONG when the context is set by356 infrastructure the caller does not control (e.g., S3 bucket ARN, EBS357 volume ID).358359- NEVER assume a key in `PendingDeletion` can still decrypt data. KMS360 rejects all `kms:Encrypt` and `kms:Decrypt` calls the moment a key361 enters `PendingDeletion` — the blast radius starts at scheduling, not362 at window expiry. A key in `PendingDeletion` with live data dependencies363 is an **active outage**, not a future risk.364365- NEVER recommend deleting a KMS key as remediation without first366 verifying that no resources are encrypted under it. Key deletion is367 irreversible after the window expires. Run368 `aws kms list-resource-tags`, check CloudTrail for recent369 `kms:Encrypt`/`GenerateDataKey` calls, and confirm with application370 owners before scheduling deletion. This is a one-way door.371372- NEVER recommend replacing a cross-account key policy grant with an373 AWS-managed key (`aws/s3`, `aws/ebs`) without explaining the trade-off.374 AWS-managed keys are shared across all accounts in the region — they375 cannot be restricted to specific principals. The remediation for376 cross-account exposure is to tighten the customer-managed key policy,377 not to downgrade to a shared AWS-managed key.378379- NEVER ignore the `kms:CreateGrant` permission. It is a delegation vector380 — a principal with `kms:CreateGrant` can create grants that delegate381 Decrypt/Encrypt to other principals, widening access beyond what the key382 policy text shows. Treat as DELEGATION danger level and apply the383 severity matrix.384385- NEVER classify a same-account-only policy with named actions as worse386 than MEDIUM. Same-account access is governed by IAM policies (identity-387 based + resource-based intersection for cross-principal), which provides388 a second layer of authorisation. The key policy is not the only gate.389390- NEVER overlook `NotPrincipal` in an `Allow` statement. `NotPrincipal`391 grants to every principal EXCEPT the listed one — the inverse of the392 intended scope, and almost always a typo or copy-paste error. In a key393 policy, an Allow with `NotPrincipal: {AWS: "arn:aws:iam::111:root"}`394 grants KMS access to every AWS account EXCEPT 111. This is a395 CRITICAL-severity finding on any DATA_ACCESS action (treat as396 WILDCARD_PRINCIPAL), and the remediation is to replace `NotPrincipal`397 with an explicit `Principal` listing the intended grantees. The same398 logic applies to `NotAction` in an Allow (inverse wildcard — grants399 every action except the listed ones); classify as DATA_ACCESS +400 KEY_CONTROL + DELEGATION worst-case.401402- NEVER assume the key policy is the complete access picture when403 `kms:CreateGrant` is present. Grants are a **separate authorisation404 layer** evaluated after the key policy and IAM. A principal with405 `kms:CreateGrant` can create a grant that delegates Decrypt to another406 principal — even if that delegatee has no IAM or key-policy grant.407 Grants can chain up to 2 levels deep (a grantee can create a sub-grant408 if CreateGrant is in their grant). Always enumerate live grants with409 `aws kms list-grants --key-id <id>` when CreateGrant appears in the410 policy — the key policy text alone does not show grant-based access.411412- NEVER treat `aws:SourceIp` restrictions as equivalent to413 `kms:ViaService` or `aws:SourceAccount`. SourceIp is caller-controlled414 in practice: any principal with a VPC NAT gateway, a proxy, or a VPN415 can route through an allowed CIDR. ViaService and SourceAccount are set416 by the AWS service infrastructure — the caller cannot forge them.417 SourceIp downgrades cross-account severity by zero levels (treat as no418 condition); ViaService/SourceAccount downgrade by one level.419420- NEVER assume the key policy alone reflects the complete access picture421 when `kms:CreateGrant` is in the policy. Grants are a separate422 authorisation layer — a grantee can access the key even with zero IAM423 or key-policy permissions. The only way to see grant-based access is424 `aws kms list-grants --key-id <id>`. An audit that checks only the key425 policy text misses every live grant. When `kms:CreateGrant` is present,426 always enumerate grants and flag any grantee not also named in the427 policy.428429- NEVER attempt to modify the policy of an AWS-managed key430 (`KeyManager: AWS`, aliases like `aws/s3`, `aws/ebs`, `aws/rds`).431 AWS-managed key policies are not customer-editable — `kms:PutKeyPolicy`432 returns `AccessDeniedException`. If the input shows a custom policy on433 a key with `KeyManager: AWS`, the input is either stale (the policy was434 changed by AWS since the snapshot) or the KeyManager field is435 misidentified. Re-fetch with `aws kms describe-key` before acting.436437## Pre-flight safety checks (run before any remediation CLI)438439Pre-flight safety checks moved verbatim to440`references/diagnostic-commands.md` (load on demand).441442## Remediation guidance443444**Remediation ordering principle:** always prefer additive changes over445destructive changes. Add a Deny statement (blocks access immediately,446reversible by removing the Deny) BEFORE removing an Allow statement447(which may break a workload you did not anticipate). The safe sequence448for any CRITICAL policy finding is: (1) back up policy, (2) add a Deny449that blocks the exposed principal/action, (3) verify the Deny is effective450via `aws kms describe-key` + IAM policy simulator, (4) only then remove451the offending Allow statement. This ordering prevents a window where452neither the old nor new policy is in effect.453454Per-severity remediation runbooks moved verbatim to455`references/error-handling.md` (load on demand).456457## Condition strength reference (KMS-specific)458459Condition strength table moved verbatim to460`references/advanced-patterns.md` (load on demand).461462## Deep reference: KMS authorization internals463464Authorization internals moved verbatim to465`references/advanced-patterns.md` (load on demand).466467## Recent AWS features (2024-2026)468469Recent-feature notes moved verbatim to470`references/advanced-patterns.md` (load on demand).471472473## References (load on demand)474475- [`references/advanced-patterns.md`](references/advanced-patterns.md) — Step-0 expert KMS behaviors, rotation timing, edge-case handling, condition-strength table, authorization internals, recent AWS features.476- [`references/diagnostic-commands.md`](references/diagnostic-commands.md) — account-wide sweep pagination, live-account pre-flight checks, pre-flight safety checks (confirmation gate, backups).477- [`references/error-handling.md`](references/error-handling.md) — remediation guidance by severity (CRITICAL/HIGH/MEDIUM/OK runbooks).478479## Domain480481AWS CloudOps / KMS Encryption Security & Compliance.482483## AWS documentation484485- **AWS KMS Developer Guide** — https://docs.aws.amazon.com/kms/latest/developerguide/overview.html486- **KMS API Reference** — https://docs.aws.amazon.com/kms/latest/APIReference/487- **AWS CLI Command Reference (KMS)** — https://docs.aws.amazon.com/cli/latest/reference/kms/488- **KMS Security** — https://docs.aws.amazon.com/kms/latest/developerguide/security.html489- **KMS key policies** — https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html490- **On-demand key rotation** — https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html