AWS CDK Risk: Exploiting a Missing S3 Bucket Allowed Account Takeover

AWS CDK Risk: Exploiting a Missing S3 Bucket Allowed Account Takeover

TLDR: due to users manually deleting resources. If you need to remove something do it in code and deploy it.

Wow, I 100% thought this was a nothing burger.

This is fucked, I totally get the thought process on the implementation. But man that sucks.

I mean it looks like the issue is that the stack is pulled from an s3 bucket (which are global), so if the bucket is created in an external account before the CDK is run, it will pull from the external bucket if the external account allows it.

I’m not sure why there wouldn’t be a check via cloud formation that the stack is not owned by the account running the CDK, seems like an easy fix. SDK can pull owner of the bucket.

It’s even easier… don’t delete the CDK resources bucket