Lesson 2 of 4 Security Controls and Defence in Depth

Detecting Threats with Amazon GuardDuty and Investigating with Amazon Detective

Preventive controls cannot stop every attack, so organisations need to detect malicious activity, such as compromised credentials, cryptocurrency mining or data exfiltration, and investigate it quickly. Amazon GuardDuty provides managed threat detection and Amazon Detective provides investigation. This lesson explains GuardDuty's data sources and protection plans, findings and their management, organisation deployment, and how Detective's behaviour graph supports investigation.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe GuardDuty's foundational data sources and its protection plans.
  • Explain GuardDuty findings, severities, extended threat detection, suppression rules and trusted IP and threat lists.
  • Explain how GuardDuty is enabled across an organisation and how findings are routed for response.
  • Describe how Amazon Detective's behaviour graph is used to investigate findings.

How GuardDuty Detects Threats

Amazon GuardDuty continuously analyses data to detect threats using threat intelligence, machine learning and anomaly detection. Its foundational data sources are CloudTrail management events, VPC Flow Logs and Route 53 Resolver DNS query logs. GuardDuty reads these directly from AWS internal streams, so they do not need to be enabled or stored by the customer, and enabling GuardDuty has no performance impact on workloads.

Protection plans extend coverage to specific services, each enabled separately, as listed below.

Protection planDetects
S3 ProtectionSuspicious data access and API activity on S3 using CloudTrail data events
EKS ProtectionSuspicious activity in EKS audit logs, such as anonymous access or privileged pods
Runtime MonitoringProcess, file and network activity on EC2, ECS (including Fargate) and EKS through a security agent
Malware Protection for EC2Malware on EBS volumes, scanned agentlessly when a finding indicates compromise or on demand
Malware Protection for S3Malware in newly uploaded objects in selected buckets
RDS ProtectionAnomalous login activity on Aurora and RDS databases
Lambda ProtectionSuspicious network activity from Lambda functions

Findings and Their Management

A finding describes a potential security issue with a type such as UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS, CryptoCurrency:EC2/BitcoinTool.B!DNS or Recon:EC2/PortProbeUnprotectedPort, the affected resource, the actor and a severity from low to critical. Extended Threat Detection correlates multiple signals over time into attack sequence findings, such as credential compromise followed by data exfiltration, with critical severity. Findings are delivered to EventBridge, Security Hub and, optionally, exported to S3 for retention.

Several features tune findings. Suppression rules automatically archive findings that match criteria known to be benign, such as a vulnerability scanner's port probes, so they do not trigger alerts. Trusted IP lists stop findings for traffic from the organisation's own addresses, and threat lists add known malicious addresses. Sample findings can be generated to test response workflows.

Organisation Deployment and Response

GuardDuty is enabled organisation-wide from a delegated administrator with auto-enable for new member accounts and for chosen protection plans. GuardDuty is a Regional service, so it must be enabled in every Region, including Regions not used by workloads, because attackers often use unmonitored Regions; findings from all accounts in a Region appear in the administrator account, and Security Hub cross-Region aggregation brings them together.

Response is driven by EventBridge rules on GuardDuty findings, filtered by type and severity, as shown in the Lambda automation lesson: isolating instances, revoking role sessions, blocking IP addresses in AWS WAF or network firewalls, and notifying responders, while Detective supports the investigation that follows.

True or false

Run GuardDuty well

Exam skills 6.3.2 · 6.2.1

Check four facts about deploying and tuning GuardDuty.

Log in to try this activity Interactive activities are free with an account.

Investigating with Amazon Detective

Amazon Detective automatically builds a behaviour graph from CloudTrail logs, VPC Flow Logs, GuardDuty findings and EKS audit logs, keeping up to a year of aggregated data. Investigators start from a GuardDuty or Security Hub finding and pivot to profiles of the involved entities, such as an IAM role, an EC2 instance or an IP address, which show their activity over time, compared with their normal baseline: API calls made, geolocations of sign-ins, network traffic volumes and related findings. Finding groups link related findings into one investigation, and investigations for IAM users and roles summarise indicators of compromise.

Detective answers questions such as "what else did this role do after the suspicious call?" and "which other instances talked to this IP address?" without writing log queries. It is enabled from a delegated administrator for the organisation and requires GuardDuty to be enabled.

GuardDuty
PurposeDetect threats
InputCloudTrail, flow logs, DNS logs, protection plan data
OutputFindings
Choose when Is something malicious happening?
Detective
PurposeInvestigate root cause and scope
InputCloudTrail, flow logs, GuardDuty findings, EKS audit logs
OutputBehaviour graph visualisations
Choose when What happened, and how far did it spread?
Security Hub
PurposeAggregate findings and posture checks
InputFindings from many services and CSPM controls
OutputPrioritised findings, scores, automation
Choose when What is our overall posture and which findings matter?
Sort into groups

Which security service?

Exam skills 6.3.4 · 6.2.2

Choose the security service that answers each question.

Log in to try this activity Interactive activities are free with an account.
Worked example

Responding to Credential Exfiltration

GuardDuty reports InstanceCredentialExfiltration.OutsideAWS: credentials of an EC2 instance role are being used from an external IP address.

  1. Contain automatically

    An EventBridge rule invokes a function that attaches a deny policy to the role with an aws:TokenIssueTime condition, revoking existing sessions, and isolates the instance with a restrictive security group.

  2. Investigate

    Analysts open the finding in Detective, review all API calls made by the role from the external IP, and find that S3 objects were listed but not downloaded.

  3. Find the cause

    Runtime Monitoring findings and logs show that a vulnerable web application allowed server-side request forgery against IMDSv1.

  4. Prevent

    Require IMDSv2 across the organisation with a declarative policy, and patch the application.

Check yourself

Why should GuardDuty be enabled in Regions where the organisation runs no workloads?

Show answer

Attackers with stolen credentials often launch resources in unused Regions to avoid detection. GuardDuty is Regional, so it detects activity only in Regions where it is enabled.

Exam Tips

Remember for the exam

  • GuardDuty analyses CloudTrail management events, VPC Flow Logs and DNS logs without customer configuration; protection plans add S3, EKS, runtime, malware, RDS and Lambda coverage.
  • Extended Threat Detection creates attack sequence findings; suppression rules archive benign findings; trusted IP and threat lists tune detection.
  • Enable GuardDuty in every Region from a delegated administrator with auto-enable; respond through EventBridge.
  • Detective's behaviour graph (CloudTrail, flow logs, GuardDuty, EKS audit logs) supports investigation of scope and root cause.