Lion Cipher Lab

Audit AWS KMS key policies for wildcard and cross-account access

Why it matters

Encryption is only as strong as the rule that decides who may use the key. In AWS, that rule is the KMS key policy: a short JSON document attached to every key. If it says the wrong thing, the encryption still runs, the data still looks protected on every dashboard, and a stranger's account can still call Decrypt. These mistakes are rarely dramatic. They are a Principal '*' someone added to unblock a deploy, a partner account ID left over from a migration, a role given kms:* because the exact action list was tedious, or kms:CreateGrant handed out without the condition that limits grants to…

What you'll learn

Steps in this lab

  1. What a KMS key policy is -- every term, defined once
  2. The default policy, and why the root statement is a note, not a finding
  3. The six things worth flagging, and why each is risky
  4. Generate 20 synthetic key policies
  5. Measure the naive audit: grep for the asterisk
  6. Build the structured linter
  7. Run the linter and read the findings
  8. Condition semantics: where linters (and people) go wrong
  9. Prove the fixed policies pass
  10. Optional appendix: lint the real keys in your own account
  11. The honest limits: a clean key policy is not least privilege
  12. What you built -- and the reflex to keep

Open the full interactive lab →