RDS 데이터베이스 스냅샷을 생성하거나 공유 속성을 변경하는 행위 탐지
Overview
| Priority | Medium |
|---|---|
| Type | Batch |
| Schedule | Every month/Every day/At 1 o'clock/At 0 min 0 1 * * * |
| Message | $rule_result |
| Output field order | event_time, actor, src_ip, cnt, snap_cnt, act_kinds, snapshots, events, accounts, first_seen, last_seen |
| MITRE Techniques | T1537 |
| MITRE tactics | TA0010 Exfiltration |
| Origin | User proposal |
Query
1search event_source == "rds.amazonaws.com"
2search in(event_name, "CreateDBSnapshot", "ModifyDBSnapshotAttribute", "CreateDBClusterSnapshot", "ModifyDBClusterSnapshotAttribute")
3search read_only == false
4eval rp = str(req_params), rpl = lower(rp)
5eval f_attr_restore = if(match(rpl, "attributename=restore"), 1, 0)
6eval f_val_all = if(match(rpl, "valuestoadd[^,}]*all"), 1, 0)
7eval f_remove = if(contains(rpl, "valuestoremove"), 1, 0)
8eval act_kind = case(in(lower(event_name), "createdbsnapshot", "createdbclustersnapshot"), "스냅샷 생성", f_remove == 1, "공유 해제", f_val_all == 1, "전체 공개(all)", f_attr_restore == 1, "특정 계정 공유", true, "기타 속성 변경")
9rex field=rp "[dD]BSnapshotIdentifier=(?<snapshot_id>[^,}]+)"
10rex field=rp "[dD]BClusterSnapshotIdentifier=(?<cluster_id>[^,}]+)"
11eval snapshot = if(isnotnull(snapshot_id), snapshot_id, str(cluster_id))
12rex field=arn "assumed-role/(?<role_name>[^/]+)/(?<sso_user>.+)$"
13rex field=arn "user/(?<iam_user>[^/\",}]+)"
14eval actor = case(match(str(sso_user), "@"), lower(str(sso_user)), isnotnull(role_name), lower(str(role_name)), isnotnull(iam_user), lower(iam_user), true, lower(str(principal_id)))
15stats count as cnt, dc(snapshot) as snap_cnt, values(act_kind) as act_kinds, values(snapshot) as snapshots, values(event_name) as events, values(recipient_account_id) as accounts, min(_time) as first_seen, max(_time) as last_seen by actor
|# 공유 속성(restore) 변경 건만 | search match(rpl, "attributename=restore")
|# 공유 범위 — 배열 형태를 정확 일치가 아닌 포함 검색으로 판정
Threat analysis
스냅샷 전체 공개(all)는 임의의 AWS 계정이 해당 스냅샷을 복원할 수 있게 만듭니다. 데이터베이스 내용 전체가 외부로 노출되는 경로