AWS Introduction
AWS Pricing
AWS Threats
AWS Misconfigurations
- Getting Started with AWS Audit
- Permissions required for Misconfigurations Detection
- API Gateway Audit
- Cloudformation Audit
- CloudFront Audit
- CloudTrail Audit
- Cloudwatch Audit
- DynamoDB Audit
- EC2 Audit
- Elastic Search Audit
- ELB Audit
- IAM Audit
- KMS Audit
- Kubernetes Audit
- Lambda Audit
- RDS Audit
- Redshift Audit
- Route53 Audit
- S3 Audit
- Security Groups Audit
- SES Audit
- SNS Audit
- IAM Deep Dive
- App Sync Audit
- Code Build Audit
- Open Search Audit
- Shield Audit
- SQS Audit
S3 Bucket Should Not Allow WRITE_ACP Access to Authenticated Users
More Info:
AWS S3 buckets should not allow WRITE_ACP access to AWS authenticated users using ACLs. Granting authenticated “WRITE_ACP” access to your AWS S3 buckets can allow other AWS accounts or IAM users to edit ACL permissions in order to view, upload, modify and delete S3 objects within the buckets without restrictions.
Risk Level
High
Address
Security
Compliance Standards
CBP, PCIDSS, NIST
Triage and Remediation
Remediation
To remediate the “S3 Bucket Should Not Allow WRITE_ACP Access to Authenticated Users” misconfiguration in AWS, you can follow these steps using the AWS console:
-
Log in to the AWS Management Console.
-
Navigate to the S3 service.
-
Click on the name of the bucket that you want to remediate.
-
Click on the “Permissions” tab.
-
Click on the “Access control list (ACL)” button.
-
Under the “Grantee” column, find the row that has “Authenticated Users”.
-
In the “Permission” column, find the “WRITE_ACP” permission.
-
Click on the “x” button to remove the “WRITE_ACP” permission for “Authenticated Users”.
-
Click on the “Save” button to save the changes.
-
Verify that the “Authenticated Users” group no longer has the “WRITE_ACP” permission by checking the “Access control list (ACL)” again.
-
Repeat these steps for any other S3 buckets that have the same misconfiguration.
Note: You can also use AWS CLI or AWS SDKs to remediate this misconfiguration.
To remediate the misconfiguration “S3 Bucket Should Not Allow WRITE_ACP Access to Authenticated Users” for AWS using AWS CLI, follow these steps:
-
Open the AWS CLI on your local machine.
-
Run the following command to get a list of all S3 buckets in your AWS account:
aws s3api list-buckets
-
Identify the S3 bucket that has WRITE_ACP access granted to authenticated users.
-
Run the following command to revoke WRITE_ACP access for authenticated users:
aws s3api put-bucket-acl --bucket bucket-name --grant-write-acp uri=http://acs.amazonaws.com/groups/global/AuthenticatedUsers --acl private
Replace “bucket-name” with the name of the S3 bucket that you want to remediate.
-
Verify that WRITE_ACP access for authenticated users has been revoked by running the following command:
aws s3api get-bucket-acl --bucket bucket-name
Replace “bucket-name” with the name of the S3 bucket that you want to remediate.
-
Repeat the above steps for all S3 buckets that have WRITE_ACP access granted to authenticated users.
By following these steps, you can remediate the misconfiguration “S3 Bucket Should Not Allow WRITE_ACP Access to Authenticated Users” for AWS using AWS CLI.
To remediate the misconfiguration of allowing WRITE_ACP access to authenticated users in an AWS S3 bucket using Python, follow these steps:
- Create an AWS S3 client using the AWS SDK for Python (Boto3).
- Get the bucket policy using the
get_bucket_policy()
method of the S3 client. - Parse the JSON policy to identify the statement that allows WRITE_ACP access to authenticated users.
- Remove the identified statement from the policy.
- Update the bucket policy using the
put_bucket_policy()
method of the S3 client.
Here’s the Python code to remediate the misconfiguration:
import boto3
import json
# Create an S3 client
s3 = boto3.client('s3')
# Get the bucket policy
bucket_name = 'your-bucket-name'
policy = s3.get_bucket_policy(Bucket=bucket_name)
# Parse the JSON policy
policy_json = json.loads(policy['Policy'])
statements = policy_json['Statement']
# Identify the statement that allows WRITE_ACP access to authenticated users
for statement in statements:
if 'Principal' in statement and statement['Principal'] == {'AWS': '*'}:
if 'Action' in statement and 's3:PutObjectAcl' in statement['Action']:
if 'Condition' in statement and 'Bool' in statement['Condition']:
if 'aws:SecureTransport' in statement['Condition']['Bool'] and statement['Condition']['Bool']['aws:SecureTransport'] == 'false':
# Remove the identified statement from the policy
policy_json['Statement'].remove(statement)
# Update the bucket policy
s3.put_bucket_policy(Bucket=bucket_name, Policy=json.dumps(policy_json))
This code will remove the statement that allows WRITE_ACP access to authenticated users from the S3 bucket policy.