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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南