ine-labs / AWSGoat

AWSGoat : A Damn Vulnerable AWS Infrastructure
MIT License
1.72k stars 1.08k forks source link

AWS enabled S3 Block Public Access for new buckets #44

Closed n0sandb0x closed 10 months ago

n0sandb0x commented 1 year ago

Hi,

Recently I was trying to install the AWS goat in my Linux machine and despite providing the creds for Administrator access user I was getting the following error again and again

 AccessControlListNotSupported: The bucket does not allow ACLs

Maybe It's because of this can you please confirm from your side?

https://aws.amazon.com/about-aws/whats-new/2022/12/amazon-s3-automatically-enable-block-public-access-disable-access-control-lists-buckets-april-2023/

Thanks

rdsece commented 1 year ago

Getting the same error! Please help how to fix this

chryzsh commented 1 year ago

The error is caused by the S3 buckets' "Block Public Access" settings. I wrote a small bash script to fix it for each bucket in the account. Be careful.

#!/bin/bash

# List all buckets and convert tab spaces to newlines
buckets=$(aws s3api list-buckets --query 'Buckets[].Name' --output text | tr "\t" "\n")

# Loop through all buckets
for bucket in $buckets; do
    echo "Updating bucket: $bucket"

    # Disable Block Public Access settings
    aws s3api put-public-access-block \
        --bucket $bucket \
        --public-access-block-configuration "BlockPublicAcls=false,IgnorePublicAcls=false,BlockPublicPolicy=false,RestrictPublicBuckets=false"
done

echo "All buckets updated."
SSKale1 commented 1 year ago

Hi @n0sandb0x @rdsece @chryzsh , the PR #37 was merged to handle the AWS change that disabled ACLs for newly created buckets. Since then we have tested the AWS GOAT Deployment multiple times unable to replicate the issue you faced. I would recommend you to sync the latest changes to your forks and redeploy.