Sub topic 2
How GuardDuty detects threats
This chapter assumes you know AWS accounts, Regions, and IAM roles. It also assumes you have heard of CloudTrail, VPC Flow Logs, and Route 53 DNS logs. By the end you will know which data GuardDuty reads, how it turns that data into findings, and what it cannot see.
The working model
Amazon GuardDuty is a managed threat detection service. You turn it on per account and per Region. It then reads several AWS data sources, compares the activity to threat intelligence and behavior models, and produces findings.
You do not install agents for the foundational sources. You do not configure log delivery either. GuardDuty reads independent copies of the streams. The logs it consumes do not need to be enabled in your account, and it does not use or change your own log settings or retention.
Foundational data sources
GuardDuty always analyzes these three sources once it is enabled:
| Source | What it records | Example threat it exposes |
|---|---|---|
| CloudTrail management events | API calls made to AWS services | Credentials used from an unusual location |
| VPC Flow Logs | Network traffic metadata for your network interfaces | An EC2 instance probing ports or talking to a known bad IP |
| Route 53 DNS query logs | DNS lookups made by resources using the VPC resolver | An instance resolving a domain used for command and control |
CloudTrail also records S3 data events, but GuardDuty reads those only when you turn on the S3 protection plan. The next chapter covers the optional plans.
From data to findings
GuardDuty uses three detection techniques:
- Threat intelligence. It matches IP addresses and domains against feeds from AWS and partners. A connection from your instance to a listed address is a direct match.
- Anomaly detection. It builds a baseline of normal behavior for your account, such as which IAM principals call which APIs from which places. Activity far from that baseline stands out.
- Machine learning and pattern rules. Models and rules look for sequences that match known attacks, such as brute-force login attempts.
Anomaly detection needs time to learn. A new account has little baseline, so some behavior-based findings appear only after GuardDuty has observed normal activity for a while.
Where findings go
Each finding is stored in the GuardDuty console and API for 90 days. GuardDuty also sends new findings to Amazon EventBridge, and to Security Hub if it is enabled. The first occurrence is sent right away. Later updates to the same finding are published at the frequency you set on the detector, which is 15 minutes, 1 hour, or 6 hours (the default).
Common errors and gotchas
- Expecting GuardDuty to block traffic. It only detects. Blocking is your job, using security groups, network ACLs, or automation that reacts to findings.
- Enabling only one Region. GuardDuty is regional. Activity in a Region where it is off goes unobserved. Global service calls are recorded in CloudTrail in the Region where the event is delivered, so enable it everywhere you can.
- Assuming it sees everything on the network. Flow log data covers traffic to and from your network interfaces. It does not read packet contents, so it cannot detect threats hidden inside encrypted payloads.
- Expecting instant results for slow-building anomalies. Baselines take time, as noted above.
Exercise
A teammate says, "We enabled CloudTrail and VPC Flow Logs in our account, so GuardDuty can read them. If we delete those trails, GuardDuty stops working." Is this correct? Name the three foundational sources GuardDuty reads.
Show answer
No. GuardDuty reads independent copies of its foundational data streams, so it does not depend on your own CloudTrail trails or flow log configuration. Deleting them does not stop GuardDuty. The three foundational sources are CloudTrail management events, VPC Flow Logs, and Route 53 DNS query logs.