Skip to content

Instantly share code, notes, and snippets.

@avilum
Created July 20, 2025 10:15
Show Gist options
  • Save avilum/7f890cb7ff9d638c1723bd29bb44783e to your computer and use it in GitHub Desktop.
Save avilum/7f890cb7ff9d638c1723bd29bb44783e to your computer and use it in GitHub Desktop.
# Check if the current org has S3 public buckets.
for bucket in $(aws s3api list-buckets --query "Buckets[].Name" --output text); do
echo "Checking bucket: $bucket"
# Get the public access block
pab=$(aws s3api get-bucket-policy-status --bucket "$bucket" 2>/dev/null)
if echo "$pab" | grep -q '"IsPublic": true'; then
echo "🚨 $bucket is PUBLIC"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment