New S3 bucket hacked

0

Hi. New to AWS, created an S3 bucket and did no turn off public access. Someone dumped thousands of files in there.

What can I do (aside from turn off public access (done) and delete the files?

Joe

已提问 1 年前291 查看次数
2 回答
3

Absolutely, you should follow s3 best practices as suggested here previously, as first aid, add following bucket policy immediately to deny access to everyone:

  1. Navigate to S3 service from management console

  2. Click on the bucket

  3. Go to Permissions tab

  4. Scroll down, go to Bucket policy and then click edit

  5. In the policy, add following policy

    {
      "Statement": [
        {
          "Effect": "Allow",
          "Principal": {
            "AWS": "<your user arn or role arn would come here>"
          },
          "Action": [
            "s3:*"
          ],
          "Resource": [
            "arn:aws:s3:::bucket_name",
            "arn:aws:s3:::bucket_name/*"
          ]
        },
        {
          "Effect": "Deny",
          "NotPrincipal": {
            "AWS": "<your user arn or role arn would come here>"
           },
          "Action": [
            "s3:*"
          ],
          "Resource": [
            "arn:aws:s3:::bucket_name",
            "arn:aws:s3:::bucket_name/*"
          ]
        }
      ]
    }
    
  6. Click Save changes

This would deny everyone to access the bucket, once done then go to S3 Best Practices and see how you could avoid this situation to keep security of the bucket tight.

profile pictureAWS
专家
已回答 1 年前
profile picture
专家
已审核 1 年前
profile pictureAWS
专家
iBehr
已审核 1 年前
1

If the S3 bucket is not needed, it may be deleted.
If still in use, setting up an S3 access log may help identify when unauthorized access has occurred.
Also, the following document describes best practices for S3, so consider following best practices.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/security-best-practices.html

profile picture
专家
已回答 1 年前
profile pictureAWS
专家
iBehr
已审核 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则