Thuta Learning
AWS Advanced
SecurityDevOpsအဆင့်မြင့်

Threat Detection နဲ့ Audit: CloudTrail, Config, GuardDuty, Security Hub

AWS Advancedသင်ခန်းစာ 2545 မိနစ်

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • CloudTrail ရဲ့ management event နဲ့ data event ကွာခြားချက်၊ organization trail နဲ့ log file integrity validation ကို ရှင်းပြနိုင်မယ်
  • AWS Config recorder၊ managed rule၊ conformance pack နဲ့ remediation ကို ဘယ်နေရာမှာ သုံးရမလဲ ဆုံးဖြတ်နိုင်မယ်
  • GuardDuty က ဘာ data တွေကို analyze လုပ်သလဲ၊ finding type နာမည်တွေကို ဘယ်လိုဖတ်ရမလဲ နားလည်မယ်
  • Security Hub နဲ့ Amazon Inspector က ဒီပုံထဲမှာ ဘယ်နေရာ ဝင်လဲ သိမယ်
  • GuardDuty finding → EventBridge rule → Lambda/SNS automated response pipeline တစ်ခု တည်ဆောက်နိုင်မယ်

ရိုးရိုးလေး ရှင်းပြမယ်

ရုံးအဆောက်အအုံ တစ်ခုလို စဉ်းစားကြည့်ရအောင်

ကိုယ့် AWS organization ကို ရုံးအဆောက်အအုံ တစ်ခုလို စဉ်းစားကြည့်ပါ။ CloudTrail ဟာ ဘယ်သူ ဘယ်တံခါးကနေ ဘယ်အချိန် ဝင်သွားလဲဆိုတာကို မှတ်တမ်းတင်တဲ့ security camera ပါ — API call တိုင်းကို ခေါ်တဲ့သူရဲ့ identity၊ အချိန်နဲ့ source IP တို့နဲ့အတူ မှတ်ထားပါတယ်။ AWS Config ကတော့ အခန်းတိုင်း ဘယ်လို စီစဉ်ထားလဲဆိုတာကို ရက်စွဲနဲ့တကွ မှတ်ထားပြီး building code ကို ချိုးဖောက်တာ တွေ့ရင် အလံပြတဲ့ inspector ပါ။

GuardDuty ဟာ camera feed တွေကို ကြည့်ပြီး သံသယဖြစ်စရာ အပြုအမူကို ရှာနေတဲ့ အစောင့်ဖြစ်ပြီး Security Hub ကတော့ report အားလုံး တန်းစီရောက်လာတဲ့ front desk ပါ။

ဒီ service တွေ ဘယ်တစ်ခုမှ attack ကို ကိုယ်တိုင် တားဆီးပေးတာ မဟုတ်ပါဘူး။ သူတို့ရဲ့ အလုပ်က တစ်ခုခု မှားသွားတဲ့နေ့မှာ မြန်မြန်သိဖို့၊ ဘာဖြစ်ခဲ့လဲ သက်သေပြနိုင်ဖို့ နဲ့ automation နည်းနည်း ထည့်လိုက်ရင် ရက်တွေမဟုတ်ဘဲ မိနစ်ပိုင်းအတွင်း တုံ့ပြန်နိုင်ဖို့ပါ။

Problem → Why → Solution

ဘယ်သူမှ မကြည့်နေတဲ့ account တစ်ခု

CI user တစ်ယောက်ရဲ့ access key တစ်ခု public Git repository ထဲ ပေါက်ကြားသွားတယ်လို့ စဉ်းစားကြည့်ပါ။ မိနစ်ပိုင်းအတွင်းမှာပဲ automated scanner တွေက အဲဒီ key ကို တွေ့သွားပြီး တစ်ယောက်ယောက်က ကိုယ့် team မသုံးဖူးတဲ့ region တစ်ခုမှာ cryptocurrency mine ဖို့ GPU instance ကြီးတွေ စ launch လုပ်ပါတယ်။ လစဉ် bill ရောက်လာတဲ့ ကိုးရက်ကြာတဲ့အထိ ဘယ်သူမှ သတိမထားမိပါဘူး။

Team က နောက်ဆုံး စုံစမ်းတဲ့အခါ CloudTrail ကို region တစ်ခုတည်းရဲ့ console ထဲက ၉၀ ရက် Event history မှာပဲ ကြည့်ခဲ့ဖူးတာ၊ GuardDuty ကို ဘယ်သူမှ enable မလုပ်ခဲ့တာ နဲ့ attacker က backdoor အဖြစ် IAM user အသစ်တစ်ယောက်ပါ ဖန်တီးထားတာကို တွေ့ရပါတယ်။ ဒီအချက်တွေ အားလုံးကို သီအိုရီအရ ပြန်ရှာလို့ ရပေမယ့် 'သူတို့ တခြား ဘာတွေ ထိခဲ့သေးလဲ' ဆိုတဲ့ မေးခွန်းကို ဖြေဖို့ လက်နဲ့ ရက်ပေါင်းများစွာ တူးရပါတယ်။

what-the-team-found.sh
# What the team found when they finally looked
aws cloudtrail describe-trails --query 'trailList[].Name'
# []   <- no trail: only 90 days of management events, per Region

aws guardduty list-detectors
# { "DetectorIds": [] }   <- nobody was watching

ဒါက ဘာကြောင့် ထပ်ခါထပ်ခါ ဖြစ်နေရလဲ

Audit နဲ့ detection ဟာ လိုအပ်တဲ့နေ့ မရောက်မချင်း မမြင်ရတဲ့အတွက် ကျော်သွားခံရလေ့ ရှိပါတယ်။ Default အနေနဲ့ ရတာက region တစ်ခုချင်းစီရဲ့ management event ၉၀ ရက်စာ မြင်ကွင်းပဲ ရှိပါတယ်။ Trail၊ detector နဲ့ alert လမ်းကြောင်း မရှိရင် compromise ဖြစ်တာနဲ့ သိရှိတာကြားက အချိန်ကို ကိုယ့် billing cycle က တိုင်းတာပေးနေတာပါ။

Record၊ evaluate၊ detect၊ aggregate

Data event
Resource တစ်ခုအတွင်းမှာ ဖြစ်တဲ့ volume များတဲ့ operation (S3 GetObject/PutObject၊ Lambda Invoke၊ DynamoDB item read/write စသည်)။ Default အနေနဲ့ ပိတ်ထားပြီး event အလိုက် ကျသင့်ငွေ ရှိပါတယ်။

CloudTrail က API activity ကို မှတ်တမ်းတင်ပါတယ်။ Management event တွေက RunInstances၊ CreateUser၊ PutBucketPolicy လို control-plane action တွေဖြစ်ပြီး default အနေနဲ့ log လုပ်ထားကာ Event history မှာ ၉၀ ရက် မြင်ရပါတယ်။ Data event တွေကတော့ volume များပြီး event အလိုက် ပိုက်ဆံကျလို့ ရွေးချယ်ပြီးမှ enable လုပ်ရပါတယ် — ဥပမာ sensitive data သိမ်းထားတဲ့ bucket တွေမှာပဲ ဖွင့်တာမျိုးပါ။

Trail ကတော့ ဒီ history တိုလေးကို အမြဲတမ်း record အဖြစ် ပြောင်းပေးတာပါ — log file တွေကို S3 bucket (လိုရင် CloudWatch Logs) ဆီ ပို့ပေးပါတယ်။ Management account (သို့) delegated administrator ကနေ ဖန်တီးတဲ့ organization trail က AWS Organizations ထဲက account အားလုံးကို ဖမ်းယူပြီး member account တွေက ပိတ်လို့ မရပါဘူး။

Log file integrity validation ကို ဖွင့်ထားပါ။ ဖွင့်ထားရင် CloudTrail က log file တစ်ခုချင်းစီရဲ့ SHA-256 hash တွေပါတဲ့ digest file ကို တစ်နာရီတစ်ခါ ရေးပြီး ကိုယ်ပိုင် private key နဲ့ sign လုပ်ပါတယ်။ ဒါကြောင့် နောက်ပိုင်းမှာ log တွေကို ပြင်ထားတာ၊ ဖျက်ထားတာ မရှိဘူးဆိုတာ သက်သေပြလို့ ရပါတယ်။ CloudTrail Lake ကတော့ event တွေကို SQL နဲ့ query လုပ်လို့ရတဲ့ event data store ထဲ သိမ်းပေးတဲ့ နောက်ထပ် destination တစ်ခုပါ။

AWS Config က တခြား မေးခွန်းတစ်ခုကို ဖြေပါတယ် — 'ဘယ်သူ ဘာကို ခေါ်လဲ' မဟုတ်ဘဲ 'ဒီ resource ဟာ အချိန်တစ်ခုမှာ ဘယ်လိုပုံစံ ရှိခဲ့လဲ၊ compliant ဖြစ်လား' ဆိုတာပါ။ Configuration recorder က support လုပ်တဲ့ resource ပြောင်းလဲတိုင်း configuration item တစ်ခု မှတ်ပါတယ်။ Rule တွေက အဲဒီ item တွေကို evaluate လုပ်ပါတယ် — s3-bucket-public-read-prohibited လို AWS managed rule (သို့) ကိုယ်တိုင်ရေးတဲ့ custom rule ပါ။ Conformance pack က rule အများကြီးနဲ့ remediation action တွေကို deploy လုပ်လို့ရတဲ့ unit တစ်ခုထဲ စုပေးပြီး remediation က non-compliant resource ကို ပြင်ဖို့ SSM Automation document ကို အလိုအလျောက် run ပေးနိုင်ပါတယ်။

GuardDuty က detection engine ပါ။ သူ့ရဲ့ foundational data source တွေက CloudTrail management event၊ VPC Flow Logs နဲ့ Route 53 Resolver DNS query log တွေ ဖြစ်ပြီး တိုက်ရိုက် ဖတ်ယူလို့ အဲဒီ log တွေကို ကိုယ်တိုင် enable လုပ်စရာ မလိုပါဘူး။ Optional protection plan တွေက S3 data event၊ EKS audit log၊ runtime monitoring၊ malware scanning စတာတွေကို ထပ်ထည့်ပေးပါတယ်။ Finding တွေကို Recon:EC2/PortProbeUnprotectedPort လို နာမည်ပေးပါတယ် — threat purpose၊ resource type၊ ပြီးမှ တိကျတဲ့ behavior — ပြီးတော့ ကိန်းဂဏန်း severity တစ်ခု ပါပါတယ်။

Amazon Inspector က EC2 instance၊ ECR container image နဲ့ Lambda function တွေကို သိပြီးသား software vulnerability (CVE) နဲ့ မရည်ရွယ်ဘဲ network ပေါ် ဖွင့်ထားမိတာတွေ ရှိမရှိ အဆက်မပြတ် scan လုပ်ပါတယ်။ Security Hub က GuardDuty၊ Inspector၊ Config၊ Macie နဲ့ partner tool တွေရဲ့ finding တွေကို format တစ်မျိုးတည်းအဖြစ် စုပေးပြီး AWS Foundational Security Best Practices နဲ့ CIS AWS Foundations Benchmark လို security standard တွေကို ကိုယ့် account တွေပေါ် run ပေးပါတယ်။

Serviceဖြေပေးတဲ့ မေးခွန်းအဓိက input
CloudTrailဘယ်သူ ဘာ API ကို ဘယ်တုန်းက ခေါ်လဲAPI call တိုင်း
AWS ConfigResource က ဘယ်လိုပုံစံ ရှိခဲ့လဲ၊ compliant လားConfiguration change
GuardDutyဒီ activity က သံသယဖြစ်စရာလားCloudTrail၊ Flow Logs၊ DNS
Inspectorဒီ workload မှာ CVE ရှိလားEC2၊ ECR image၊ Lambda
Security Hubအားလုံးပေါင်း ဘယ်လောက် ဆိုးနေလဲအပေါ်က finding အားလုံး
text
ORGANIZATION-WIDE DETECTION AND AUDIT
-------------------------------------
  MEMBER ACCOUNTS (every Region)        CENTRAL ACCOUNTS
 +------------------------------+
 | API calls  ---> CloudTrail   |--org trail--> [S3 log archive + digests]
 | resources  ---> Config       |--aggregator-> [Config aggregator]
 | logs/flows ---> GuardDuty    |--findings---> [GuardDuty admin] ---+
 | EC2/ECR/Lambda -> Inspector  |--findings---> [Inspector admin] --+|
 +------------------------------+                                   ||
                                                                    vv
                                                         [Security Hub]
                                                               |
                               EventBridge rule (severity >= 7) |
                                                               v
                                         [Lambda triage] --> [SNS on-call]
Record → evaluate → detect → respond
  1. CloudTrail records every API call
  2. Config records resource state + rules
  3. GuardDuty turns signals into findings
  4. Security Hub aggregates and scores
  5. EventBridge routes findings to response

ပထမ နှစ်ခုက evidence ပါ၊ တတိယက judgement ပါ၊ နောက်ဆုံး နှစ်ခုက action ပါ။ Evidence မရှိရင် judgement ကို မယုံနိုင်သလို action မရှိရင် judgement က dashboard ပေါ်က ကိန်းဂဏန်း တစ်ခုပဲ ဖြစ်နေပါလိမ့်မယ်။

GuardDuty high-severity event pattern

guardduty-high.json
{
  "source": ["aws.guardduty"],
  "detail-type": ["GuardDuty Finding"],
  "detail": {
    "severity": [{ "numeric": [">=", 7] }]
  }
}

GuardDuty finding တိုင်းဟာ default event bus ပေါ်ကို source 'aws.guardduty'၊ detail-type 'GuardDuty Finding' နဲ့ ရောက်လာပါတယ်။ numeric matching က detail.severity 7 နဲ့အထက် (High နဲ့ ပိုမြင့်တဲ့ level) ကိုပဲ ရွေးပေးပါတယ်။ Pattern ထဲမှာ မပါတဲ့ field တွေကို EventBridge က ဂရုမစိုက်ပါဘူး။

GuardDuty finding တွေကို triage လုပ်တဲ့ Lambda

EventBridge rule က finding ကို Lambda function ဆီ ပို့ပေးပါတယ်။ Function က severity ကို label အဖြစ် ပြောင်းပြီး on-call ဖတ်လို့ရတဲ့ field တွေကိုပဲ ထုတ်ယူကာ SNS topic ဆီ publish လုပ်ပါတယ်။ Severity 7 အောက်ကို log ပဲ လုပ်ပါတယ် — rule က filter လုပ်ပြီးသားဖြစ်ပေမယ့် Lambda ကိုယ်တိုင်လည်း စစ်ထားတော့ rule ကို တစ်ယောက်ယောက် ချဲ့လိုက်ရင်တောင် လူတွေကို အလကား မနှိုးမိတော့ပါဘူး။

guardduty_triage.py
import json
import os

import boto3

sns = boto3.client("sns")
TOPIC_ARN = os.environ["ALERT_TOPIC_ARN"]


def label(severity: float) -> str:
    if severity >= 9:
        return "CRITICAL"
    if severity >= 7:
        return "HIGH"
    if severity >= 4:
        return "MEDIUM"
    return "LOW"


def lambda_handler(event, context):
    finding = event["detail"]
    severity = float(finding["severity"])
    level = label(severity)
    if severity < 7:
        print(f"{finding['type']}: {level}, logged only")
        return {"published": False}

    message = {
        "account": finding["accountId"],
        "region": finding["region"],
        "type": finding["type"],
        "severity": severity,
        "resource": finding["resource"]["resourceType"],
        "title": finding["title"],
    }
    subject = f"[{level}] GuardDuty {finding['type']}"[:100]
    resp = sns.publish(TopicArn=TOPIC_ARN, Subject=subject, Message=json.dumps(message))
    print(f"{finding['type']}: {level}, alert published")
    return {"published": True, "messageId": resp["MessageId"]}


if __name__ == "__main__":
    def sample(finding_type, severity):
        return {
            "source": "aws.guardduty",
            "detail-type": "GuardDuty Finding",
            "detail": {
                "accountId": "111122223333",
                "region": "us-east-1",
                "type": finding_type,
                "severity": severity,
                "title": "Sample finding",
                "resource": {"resourceType": "AccessKey"},
            },
        }

    exfil = "UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS"
    lambda_handler(sample("Recon:EC2/PortProbeUnprotectedPort", 2), None)
    result = lambda_handler(sample(exfil, 8), None)
    print("published:", result["published"])

Browser ထဲမှာ run လို့ မရပါ

ဒီ code ဟာ AWS account အစစ်ပေါ်မှာ run ရမယ့် code ဖြစ်လို့ browser playground ထဲမှာ run လို့ မရပါ။ ကိုယ့် terminal (သို့) AWS CloudShell ထဲမှာ စမ်းပါ။

Code ကို တစ်ပိုင်းချင်း ရှင်းပြမယ်

  1. Topic from the environmentTOPIC_ARN = os.environ["ALERT_TOPIC_ARN"]

    Topic ARN ကို code ထဲ hard-code မလုပ်ဘဲ environment variable ကနေ ဖတ်ပါတယ်။ ဒါကြောင့် dev၊ prod account တွေမှာ code တစ်ခုတည်းကို topic မတူဘဲ deploy လုပ်လို့ ရပါတယ်။

  2. Severity to labelif severity >= 7: return "HIGH"

    GuardDuty severity က ကိန်းဂဏန်း (ဥပမာ 8.0) ပါ။ 7.0–8.9 ကို High၊ 4.0–6.9 ကို Medium၊ အောက်ကိုတော့ Low လို့ သတ်မှတ်ပါတယ်။ Label က လူတွေ ဖတ်ရလွယ်အောင်ပါ — decision ကိုတော့ ကိန်းဂဏန်းနဲ့ပဲ ချပါတယ်။

  3. Defense in depth on the filterif severity < 7: print(f"{finding['type']}: {level}, logged only")

    EventBridge rule က 7 နဲ့အထက်ကိုပဲ ပို့ပေမယ့် function ကလည်း ထပ်စစ်ပါတယ်။ Rule pattern ကို တစ်ယောက်ယောက် ပြင်လိုက်ရင်တောင် Low finding တွေ on-call ဖုန်းကို မရောက်တော့ပါဘူး။

  4. Publish a compact messagesns.publish(TopicArn=TOPIC_ARN, Subject=subject, Message=json.dumps(message))

    Finding JSON အပြည့်က KB ချီ ရှည်ပါတယ်။ Account၊ region၊ type၊ severity နဲ့ resource type ပဲ ပို့ပါတယ်။ SNS Subject က character 100 အထိပဲ ခွင့်ပြုလို့ [:100] နဲ့ ဖြတ်ထားပါတယ်။

You should see
Recon:EC2/PortProbeUnprotectedPort: LOW, logged only
UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS: HIGH, alert published
published: True
Finding ကနေ on-call ဆီအထိ
  1. GuardDuty creates a finding
  2. Event lands on the default bus
  3. Rule matches severity >= 7
  4. Lambda trims and publishes
  5. SNS notifies on-call

Severity 7 အောက်

Stays in Security Hub for daily triage

Severity 7 နဲ့အထက်

On-call is notified within minutes

CLI နဲ့ pipeline ကို ချိတ်ဆက်ခြင်း

Detector တစ်ခု ဖန်တီးမယ်၊ အပေါ်က pattern နဲ့ rule တစ်ခု ထည့်မယ်၊ EventBridge ကို Lambda ခေါ်ခွင့် ပေးမယ်၊ ပြီးရင် sample finding တွေနဲ့ end-to-end စမ်းမယ်။ Sample finding တွေမှာ sample အဖြစ် အမှတ်အသား ပါလို့ အစစ်နဲ့ မရောပါဘူး။

wire-guardduty-alerts.sh
DETECTOR_ID=$(aws guardduty create-detector --enable \
  --finding-publishing-frequency FIFTEEN_MINUTES \
  --query DetectorId --output text)

aws events put-rule \
  --name guardduty-high-severity \
  --event-pattern file://guardduty-high.json

FN_ARN=arn:aws:lambda:us-east-1:111122223333:function:guardduty-triage
aws lambda add-permission \
  --function-name guardduty-triage \
  --statement-id allow-eventbridge \
  --action lambda:InvokeFunction \
  --principal events.amazonaws.com \
  --source-arn arn:aws:events:us-east-1:111122223333:rule/guardduty-high-severity

aws events put-targets \
  --rule guardduty-high-severity \
  --targets "Id=triage-lambda,Arn=$FN_ARN"

# Fire a sample finding through the whole pipeline
aws guardduty create-sample-findings \
  --detector-id "$DETECTOR_ID" \
  --finding-types UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS

Infrastructure as code နဲ့ ရေးမယ်ဆိုရင် CDK မှာ အတူတူပါပဲ။ SnsTopic target က EventBridge publish လုပ်ခွင့်ပေးတဲ့ topic policy ကို အလိုအလျောက် ထည့်ပေးပါတယ်။

finding-alerts.ts
import { App, Stack, StackProps } from "aws-cdk-lib";
import * as events from "aws-cdk-lib/aws-events";
import * as targets from "aws-cdk-lib/aws-events-targets";
import * as sns from "aws-cdk-lib/aws-sns";
import { Construct } from "constructs";

class FindingAlertsStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);
    const topic = new sns.Topic(this, "SecurityAlerts");
    new events.Rule(this, "HighSeverityFindings", {
      description: "GuardDuty findings with severity 7 or higher",
      eventPattern: {
        source: ["aws.guardduty"],
        detailType: ["GuardDuty Finding"],
        detail: { severity: [{ numeric: [">=", 7] }] },
      },
      targets: [new targets.SnsTopic(topic)],
    });
  }
}

const app = new App();
new FindingAlertsStack(app, "FindingAlertsStack");
app.synth();

Organization တစ်ခုလုံး baseline

Account တစ်ခုချင်း setup လုပ်တာ scale မဖြစ်ပါဘူး။ Management account ကနေ organization trail တစ်ခု ဖန်တီးပြီး GuardDuty နဲ့ Security Hub administration ကို security account ဆီ delegate လုပ်ပါ။ GuardDuty က regional service ဖြစ်လို့ delegated admin နဲ့ auto-enable ကို သုံးတဲ့ Region တိုင်းမှာ ပြုလုပ်ရပါတယ်။ Config rule နဲ့ remediation ကိုတော့ conformance pack အဖြစ် ထုပ်ပြီး ဖြန့်တာ အကောင်းဆုံးပါ။

org-baseline.sh
# Management account: org trail with integrity validation
aws cloudtrail create-trail \
  --name org-trail \
  --s3-bucket-name org-cloudtrail-logs-111122223333 \
  --is-organization-trail \
  --is-multi-region-trail \
  --enable-log-file-validation \
  --kms-key-id alias/cloudtrail-logs
aws cloudtrail start-logging --name org-trail

# Delegate GuardDuty and Security Hub to the security account (per Region)
aws guardduty enable-organization-admin-account --admin-account-id 444455556666
aws securityhub enable-organization-admin-account --admin-account-id 444455556666

# Security account: turn GuardDuty on for every current and future member
aws guardduty update-organization-configuration \
  --detector-id "$DETECTOR_ID" \
  --auto-enable-organization-members ALL

# Config managed rule plus automatic remediation
aws configservice put-config-rule --config-rule file://s3-public-read-rule.json
aws configservice put-remediation-configurations \
  --remediation-configurations file://s3-public-read-remediation.json

# Later, during an investigation: prove the logs were not tampered with
aws cloudtrail validate-logs \
  --trail-arn arn:aws:cloudtrail:us-east-1:111122223333:trail/org-trail \
  --start-time 2026-11-01T00:00:00Z
s3-public-read-remediation.json
[
  {
    "ConfigRuleName": "s3-bucket-public-read-prohibited",
    "TargetType": "SSM_DOCUMENT",
    "TargetId": "AWS-DisableS3BucketPublicReadWrite",
    "Parameters": {
      "AutomationAssumeRole": {
        "StaticValue": {
          "Values": ["arn:aws:iam::111122223333:role/ConfigRemediationRole"]
        }
      },
      "S3BucketName": { "ResourceValue": { "Value": "RESOURCE_ID" } }
    },
    "Automatic": true,
    "MaximumAutomaticAttempts": 3,
    "RetryAttemptSeconds": 60
  }
]

Production မှာ

Production team တွေ တကယ် ဘယ်လို လုပ်လဲ

Multi-account setup အများစုမှာ organization trail log တွေကို သီးသန့် Log Archive account ထဲက bucket ဆီ ပို့ပါတယ်။ အဲဒီ bucket မှာ S3 Object Lock နဲ့ ကျဉ်းမြောင်းတဲ့ bucket policy ရှိပြီး workload account တွေက ဘာမှ ဖျက်လို့ မရပါဘူး။ GuardDuty၊ Security Hub၊ Inspector နဲ့ Config aggregator တွေက Security Tooling account ထဲမှာ delegated administrator အဖြစ် ရှိပါတယ်။ AWS Control Tower သုံးရင် org trail နဲ့ Config baseline ကို သူက တည်ဆောက်ပေးပါတယ်။

Routing ကို severity အလိုက် ခွဲပါတယ်: High နဲ့ Critical က on-call ကို page လုပ်၊ Medium က ticket ဖွင့်၊ Low ကို အပတ်စဉ် review မှာ ကြည့်ပါတယ်။ သိပြီးသား ပုံမှန် behavior (ဥပမာ vulnerability scanner တစ်ခုက port probe လုပ်တာ) အတွက် GuardDuty suppression rule တွေ ရေးထားပါတယ်။

Automated containment ကိုတော့ သတိနဲ့ လုပ်ပါတယ်: ပေါက်ကြားသွားတဲ့ access key ကို deactivate လုပ်တာ၊ EC2 instance ကို isolation security group ဆီ ပြောင်းတာလို ပြန်ပြင်လို့ရတဲ့ action တွေကို အလိုအလျောက် လုပ်ပြီး instance terminate လုပ်တာလို ပြန်မရနိုင်တဲ့ action တွေအတွက်တော့ လူ approval ကို စောင့်ပါတယ် — terminate လုပ်လိုက်ရင် forensic evidence ပါ ပျောက်သွားလို့ပါ။

အမှားများ

အဖြစ်များတဲ့ အမှားတွေ

Audit လုပ်ခံရတဲ့ account ထဲမှာပဲ log တွေ သိမ်းထားခြင်း

Trail bucket က workload account ထဲမှာ ရှိနေရင် admin access ရသွားတဲ့ attacker က logging ကို ရပ်ပြီး bucket ကိုပါ ဖျက်နိုင်ပါတယ် — သူ့ခြေရာကို သူ့ဘာသာ ဖျက်တာပါ။ Organization trail ကို သီးသန့် Log Archive account ဆီ ပို့ပြီး cloudtrail:StopLogging နဲ့ cloudtrail:DeleteTrail ကို SCP နဲ့ deny လုပ်ထားပါ။

Home Region မှာပဲ enable လုပ်ခြင်း

GuardDuty၊ Security Hub နဲ့ Config ဟာ regional ပါ။ Attacker တွေက ကိုယ် ဘယ်တော့မှ မကြည့်တဲ့ Region တွေကို ရည်ရွယ်ချက်ရှိရှိ ရွေးသုံးပါတယ်။ Enabled Region တိုင်းမှာ ဖွင့်ထားပါ (သို့) မသုံးတဲ့ Region တွေကို SCP နဲ့ ပိတ်ထားပါ — နှစ်ခုလုံး လုပ်တာ ပိုကောင်းပါတယ်။

Finding အားလုံးကို chat channel ထဲ ပို့ခြင်း

Finding အားလုံးကို Slack ထဲ ပို့လိုက်ရင် တစ်ပတ်အတွင်း channel ကို mute လုပ်လိုက်ကြပြီး တကယ့် High finding ကို ဘယ်သူမှ မမြင်တော့ပါဘူး။ Severity နဲ့ filter လုပ်ပါ၊ ပုံမှန် behavior အတွက် suppression rule ရေးပါ၊ page လုပ်တဲ့ alert တိုင်းမှာ ပိုင်ရှင်နဲ့ runbook ရှိပါစေ။

💰 Cost & Cleanup

CloudTrail: Region တစ်ခုစီမှာ management event ရဲ့ ပထမ copy ကို trail တစ်ခုဆီ ပို့တာ အခမဲ့ပါ၊ ဒုတိယ copy နဲ့ data event တွေကတော့ event အလိုက် ကျသင့်ပြီး S3 storage ကုန်ကျစရိတ်လည်း ရှိပါတယ်။ GuardDuty၊ Security Hub နဲ့ Inspector မှာ free trial ကာလ ရှိပြီး အဲဒီနောက် analyze လုပ်တဲ့ event/log volume၊ security check နဲ့ scan လုပ်တဲ့ resource အလိုက် ကျသင့်ပါတယ်။ Config က record လုပ်တဲ့ configuration item နဲ့ rule evaluation အလိုက် ကျသင့်ပါတယ် — ပြောင်းလဲမှု များတဲ့ account တွေမှာ မြန်မြန် တက်လာနိုင်ပါတယ်။

Lab ပြီးရင် rule၊ function၊ topic နဲ့ detector ကို ဖျက်ပါ။ တကယ့် organization ဖြစ်ရင်တော့ trail နဲ့ detector တွေကို ထားခဲ့ပါ — အဲဒါတွေက ဖျက်ရမယ့် lab resource မဟုတ်ဘဲ baseline ပါ။

စမ်းပြီးရင် ဖျက်ဖို့ command

cleanup.sh
aws events remove-targets --rule guardduty-high-severity --ids triage-lambda
aws events delete-rule --name guardduty-high-severity
aws lambda delete-function --function-name guardduty-triage
aws sns delete-topic --topic-arn arn:aws:sns:us-east-1:111122223333:security-alerts
aws guardduty delete-detector --detector-id "$DETECTOR_ID"

Mini challenge

IAM credential finding တွေကိုပဲ page လုပ်ပါ

Team က 'IAMUser' resource type နဲ့ UnauthorizedAccess finding တွေကိုပဲ on-call ဆီ page လုပ်ချင်ပါတယ်။ EventBridge event pattern တစ်ခု ရေးပါ။

  • Source 'aws.guardduty' နဲ့ detail-type 'GuardDuty Finding' ကိုပဲ match လုပ်ရမယ်
  • Severity 7 နဲ့အထက်ပဲ ဖြစ်ရမယ်
  • Finding type က 'UnauthorizedAccess:IAMUser/' နဲ့ စရမယ်

ရလဒ်: UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS (severity 8) က match ဖြစ်ပြီး Recon:EC2/PortProbeUnprotectedPort နဲ့ severity 5 IAM finding တွေ match မဖြစ်ရပါဘူး။

အရိပ်အမြွက် ကြည့်ရန်

EventBridge pattern ထဲမှာ string ရဲ့ အစကို prefix matching နဲ့ စစ်လို့ရပါတယ်: { "prefix": "..." }။ detail ထဲက field နှစ်ခုကို AND အဖြစ် ပေါင်းချင်ရင် object တစ်ခုတည်းထဲ ထည့်လိုက်ရုံပါပဲ။

အဖြေ ကြည့်ရန်
iam-credential-findings.json
{
  "source": ["aws.guardduty"],
  "detail-type": ["GuardDuty Finding"],
  "detail": {
    "severity": [{ "numeric": [">=", 7] }],
    "type": [{ "prefix": "UnauthorizedAccess:IAMUser/" }]
  }
}

Quick Quiz 1 / 3

အောက်ပါတို့ထဲက ဘယ်ဟာက CloudTrail data event ဖြစ်ပြီး default အနေနဲ့ log မလုပ်ပါသလဲ။

Quick Quiz 2 / 3

Auditor က CloudTrail log တွေ deliver ဖြစ်ပြီးနောက် ပြင်ဆင်ခံရခြင်း မရှိကြောင်း သက်သေ တောင်းပါတယ်။ ဘယ်ဟာက အကောင်းဆုံး အဖြေလဲ။

Quick Quiz 3 / 3

GuardDuty ရဲ့ foundational detection အလုပ်လုပ်ဖို့ ကိုယ်တိုင် ဘာ log တွေ enable လုပ်ရမလဲ။

မှတ်ထားရမယ့် အချက်များ

  • CloudTrail = ဘယ်သူ ဘာခေါ်လဲ။ Integrity validation ပါတဲ့ organization trail ကို သီးသန့် Log Archive account ဆီ ပို့ပါ
  • AWS Config = resource ဘယ်လိုပုံစံ ရှိခဲ့လဲ။ Conformance pack နဲ့ SSM remediation နဲ့ rule တွေကို ဖြန့်ပါ
  • GuardDuty က CloudTrail၊ Flow Logs၊ DNS ကနေ finding ထုတ်ပြီး Inspector က CVE ရှာပါတယ်၊ Security Hub က အားလုံးကို စုပါတယ်
  • GuardDuty finding → EventBridge rule (severity >= 7) → Lambda/SNS က response time ကို မိနစ်ပိုင်းအထိ လျှော့ပေးပါတယ်
  • Detection service တွေက regional ပါ — အသုံးပြုတဲ့ Region တိုင်းမှာ ဖွင့်ပြီး delegated admin ကို သုံးပါ

AWS CloudTrail User Guide — AWS Documentation

Amazon GuardDuty User Guide — AWS Documentation

AWS Config Developer Guide — AWS Documentation

နောက်ဆုံးပြင်ဆင်ရက်

Progress ကို ဤ browser (ဤစက်) တွင်သာ သိမ်းထားပါသည်။ အခြားစက်များနှင့် sync မလုပ်ပါ။

ဤသင်ခန်းစာတွင် အမှားတွေ့ပါက အကြောင်းကြားရန်သင့် email app ကို ဤသင်ခန်းစာလိပ်စာ ဖြည့်ပြီးသားဖြင့် ဖွင့်ပေးပါမည် — သင်ကိုယ်တိုင် ပို့မှသာ ပို့မည်ဖြစ်သည်။

Threat Detection နဲ့ Audit: CloudTrail, Config, GuardDuty, Security Hub | Thuta Learning