Chuyển đến nội dung
Skillpedia
Agent35k · #8349

remediating-s3-bucket-misconfiguration

Skill này làm gì

Hướng dẫn này chỉ cách sửa các thiết lập sai trong 'bucket' lưu trữ đám mây (gọi là S3 bucket) có thể làm lộ dữ liệu nhạy cảm. Nó cho biết cách chặn truy cập công khai, kiểm tra ai được truy cập dữ liệu và đảm bảo dữ liệu được bảo vệ.

Khi nào nên dùng

  • ✓Khi một cảnh báo cho biết các 'bucket' lưu trữ của bạn đang mở công khai hoặc không được bảo vệ.
  • ✓Khi bạn cần chứng minh trong kiểm toán rằng dữ liệu của bạn được bảo mật.
  • ✓Khi bạn phát hiện dữ liệu quan trọng có thể đã bị lộ ngoài ý muốn.

Liên kết skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/remediating-s3-bucket-misconfiguration/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/remediating-s3-bucket-misconfiguration/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm thế nào để bảo mật các 'bucket' lưu trữ đám mây của tôi đang mở công khai?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Hướng dẫn tự động kiểm tra 'bucket' nào có vấn đề, rồi áp dụng các biện pháp bảo vệ như "Block Public Access" và mã hóa. Nó cũng gợi ý thiết lập nhật ký để biết ai đã truy cập gì.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Remediating S3 Bucket Misconfiguration

When to Use

  • When AWS Config or Security Hub reports S3 buckets with public access or missing encryption
  • When a security scan reveals S3 bucket policies granting access to Principal "*" (everyone)
  • When preparing for a data protection audit requiring evidence of storage security controls
  • When responding to a data exposure incident involving publicly accessible S3 objects
  • When establishing preventive controls for new S3 bucket creation across an AWS Organization

Do not use for Azure Blob Storage or GCP Cloud Storage misconfigurations, for S3 data classification (see implementing-cloud-dlp-policy), or for S3 access pattern analysis unrelated to security.

Prerequisites

  • AWS account with S3 administrative permissions (s3:, s3-outposts:)
  • AWS Config enabled to evaluate S3 resource compliance
  • AWS CloudTrail logging S3 data events for access auditing
  • Macie enabled for sensitive data discovery in S3 buckets

Workflow

Step 1: Identify All Public and Misconfigured Buckets

Use multiple detection methods to identify S3 buckets with public access. Rely on AWS Config rules, S3 Access Analyzer, and Macie rather than manual inspection.

# Enable S3 Access Analyzer for external access detection
aws accessanalyzer create-analyzer \
  --analyzer-name s3-analyzer \
  --type ACCOUNT

# List all S3 buckets with public access indicators
aws s3api list-buckets --query 'Buckets[*].Name' --output text | while read bucket; do
  public_status=$(aws s3api get-public-access-block --bucket "$bucket" 2>/dev/null)
  if [ $? -ne 0 ]; then
    echo "NO PUBLIC ACCESS BLOCK: $bucket"
  fi
done

# Check bucket policies for public access grants
aws s3api list-buckets --query 'Buckets[*].Name' --output text | while read bucket; do
  policy=$(aws s3api get-bucket-policy --bucket "$bucket" 2>/dev/null)
  if echo "$policy" | grep -q '"Principal":"*"' 2>/dev/null; then
    echo "PUBLIC POLICY DETECTED: $bucket"
  fi
done

# Use AWS Config to find non-compliant buckets
aws configservice get-compliance-details-by-config-rule \
  --config-rule-name s3-bucket-public-read-prohibited \
  --compliance-types NON_COMPLIANT \
  --query 'EvaluationResults[*].EvaluationResultIdentifier.EvaluationResultQualifier.ResourceId'

Step 2: Enable S3 Block Public Access at Account Level

Apply the four Block Public Access settings at the AWS account level as a safety net. This prevents any bucket in the account from being made public, regardless of individual bucket policies or ACLs.

# Enable account-level Block Public Access (all four settings)
aws s3control put-public-access-block \
  --account-id 123456789012 \
  --public-access-block-configuration '{
    "BlockPublicAcls": true,
    "IgnorePublicAcls": true,
    "BlockPublicPolicy": true,
    "RestrictPublicBuckets": true
  }'

# Verify account-level settings
aws s3control get-public-access-block --account-id 123456789012

# Enable at bucket level for defense in depth
aws s3api put-public-access-block \
  --bucket production-data-bucket \
  --public-access-block-configuration '{
    "BlockPublicAcls": true,
    "IgnorePublicAcls": true,
    "BlockPublicPolicy": true,
    "RestrictPublicBuckets": true
  }'

Step 3: Audit and Remediate Bucket Policies and ACLs

Review all bucket policies for overly permissive Principal statements and remove legacy ACLs. Enforce bucket ownership controls to disable ACLs entirely.

# Remove a public bucket policy
aws s3api delete-bucket-policy --bucket exposed-bucket

# Replace with a restrictive policy
aws s3api put-bucket-policy --bucket exposed-bucket --policy '{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyUnencryptedTransport",
      "Effect": "Deny",
      "Principal": "*",
      "Action": "s3:*",
      "Resource": [
        "arn:aws:s3:::exposed-bucket",
        "arn:aws:s3:::exposed-bucket/*"
      ],
      "Condition": {
        "Bool": {"aws:SecureTransport": "false"}
      }
    },
    {
      "Sid": "AllowOnlyVPCEndpoint",
      "Effect": "Deny",
      "Principal": "*",
      "Action": "s3:*",
      "Resource": [
        "arn:aws:s3:::exposed-bucket",
        "arn:aws:s3:::exposed-bucket/*"
      ],
      "Condition": {
        "StringNotEquals": {"aws:SourceVpce": "vpce-0abc123def456"}
      }
    }
  ]
}'

# Enforce bucket owner for all objects (disable ACLs)
aws s3api put-bucket-ownership-controls --bucket exposed-bucket \

…
Câu hỏi thường gặp

S3 bucket là gì?

Đây giống như những 'hộp' kỹ thuật số trên đám mây của Amazon Web Services (AWS), nơi bạn lưu file và dữ liệu.

“Misconfiguration” nghĩa là gì?

Nghĩa là các thiết lập bảo mật của những 'bucket' này không đúng, có thể khiến dữ liệu của bạn bị lộ.

Tôi có cần là chuyên gia máy tính để dùng không?

Hướng dẫn này được thiết kế để ngay cả người không có kinh nghiệm lập trình cũng làm theo được, từng bước một.

Chi tiết

Mô tả gốc của tác giả

Provides step-by-step procedures for remediating Amazon S3 bucket misconfigurations that expose sensitive data: enabling S3 Block Public Access, auditing bucket policies and ACLs, enforcing encryption, configuring access logging, and deploying automated remediation with AWS Config and Lambda. Use when AWS Config or Security Hub flags public or unencrypted S3 buckets, or preparing audit evidence fo

repo: mukul975/Anthropic-Cybersecurity-Skills

Độ phổ biến

Sao GitHub
35k
Vị trí xếp hạng
#8349
Giấy phép
Apache-2.0
Cập nhật
31/8/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự