Tech with Tyler
LinkedInGitHubYouTube
  • 👋Welcome!
    • whoami
    • !!! Disclaimer !!!
  • 🎓Academy
    • AWS Security Cookbook by Tyler
      • AWS Control Tower
        • Lab: Deploying AWS Control Tower via Terraform
      • AWS CloudTrail
      • AWS GuardDuty
        • Lab: Deploying AWS GuardDuty via Terraform
        • Lab: Logging GuardDuty Findings to S3
        • Lab: Adversary Simulation Detection with Stratus Red Team and GuardDuty
      • AWS Organizations
        • Lab: Deploying AWS Organizations via Terraform
      • AWS Root Account Management
        • Lab: Deploying AWS Root Account Management via Terraform
      • AWS Service Control Policies (SCPs)
        • Lab: Deploying AWS Service Control Policies (SCPs) via Terraform
      • TBD - Coming Soon!
        • [TBD] AWS Account Factory
        • [TBD] AWS Identity Center
    • My content on Cybr
      • Course - Terraform on AWS: From Zero to Cloud Infrastructure
      • Lab - Create Static AWS S3 Website with Terraform
      • Lab - Secure EC2 Access with SSM Session Manager and KMS
      • Lab - Encrypt and Decrypt Data with KMS and Data Encryption Keys
    • My content on PwnedLabs
      • Cyber Range - Electra
      • Lab - Abusing Identity Providers in AWS
      • Lab - Prowler and AWS Security Hub
      • Blog - Abusing Identity Providers in AWS
      • Blog - Building Security Guardrails with AWS Resource Control Policies
      • Blog - Defending Against the whoAMI Attack with AWS Declarative Policies
    • My content on YouTube
      • AWS Security Engineering
      • Linux in 60 Seconds!
  • ☁️Cloud Security
    • AWS Attacks and Techniques
      • Enumerate AWS Account IDs
      • Enumerate AWS IAM Users
      • Enumerate (Unauthenticated) IAM Users and Roles
      • Enumerate AWS Public Resources
      • Enumerate Secrets in AWS
      • Generate AWS Console Session
      • Generate IAM Access Keys from CloudShell
      • Password Spraying AWS IAM Users
      • Subdomain Takeovers
    • AWS Privilege Escalation
      • Identity Access Management (IAM)
      • IAM Trust Policies
      • Key Management Service (KMS)
      • Lightsail
      • OpenID Connect (OIDC)
      • S3
      • Secrets Manager
      • Security Token Service (STS)
    • AWS General Info
      • Amazon Bedrock
      • EC2
      • KMS
      • S3
      • SNS Topic
    • AWS CLI Cheat Sheet
    • Capture the Flags (CTFs)
      • Flaws.Cloud
        • Level 1
        • Level 2
        • Level 3
        • Level 4
        • Level 5
        • Level 6
      • PwnedLabs
        • Escalate Privileges by IAM Policy Rollback
        • Exploiting Weak S3 Bucket Policies
        • Leveraging S3 Bucket Versioning
        • S3 Enumeration Basics
        • Pillage Exposed RDS Instances
        • EC2 SSRF Attack
        • Hunt for Secrets in Git Repos
      • Cybr
        • Challenge - Secrets Unleashed
    • Tools
      • Tooling Index
      • dsnap
      • Pacu
      • s3-account-search
      • GoAWSConsoleSpray
      • aws_consoler
      • cloudenum
  • 📦Containers & Orchestration
    • Kubernetes
  • 👨‍💻Coding & CLI Tooling
    • CLI Tools
      • AWS CLI
      • Git
      • GitHub Copilot (CLI)
      • Homebrew
      • jq
      • ngrok
      • ssh
    • Coding and Scripting
      • Bash
      • Python
    • Terminal Customization
  • ⚙️DevSecOps
    • CI/CD
      • GitLab
    • Hashicorp Terraform
    • Hashicorp Vault
    • IAC Scanning
      • tfsec
    • Secrets Scanning
      • Trufflehog
  • 🎁Miscellaneous
    • Jenkins
  • 💻Operating Systems
    • Linux
      • APT Package Manager
      • CLI Tools Cheat Sheet
      • Man Pages
      • Services
      • Users and Groups
  • 🏗️Projects
    • Active Directory Homelab Automation
    • AWS Cloud Resume Challenge
    • Proxmox Homelab as Code
  • 📌Other
    • Useful Resources
Powered by GitBook
On this page
  • 📖 Introduction to AWS GuardDuty
  • 🗒 Understanding GuardDuty and its Features
  • 1. Deploying GuardDuty
  • 2. Default Findings
  • 3. Protection Plans
  • 4. Logging
  • 📚 Additional Resources
  • 🏗️ Hands-on Exercises

Was this helpful?

  1. Academy
  2. AWS Security Cookbook by Tyler

AWS GuardDuty

An overview of AWS GuardDuty

PreviousAWS CloudTrailNextLab: Deploying AWS GuardDuty via Terraform

Last updated 1 month ago

Was this helpful?

📖 Introduction to AWS GuardDuty

AWS GuardDuty is a paid security service offered by AWS. Using AI/ML, anomaly and malicious file detection, and threat intelligence, GuardDuty can monitor and alert you to malicious activity in your AWS environment. It leverages foundational data sources such as CloudTrail Management Events, VPC Flow Logs, and Route53 Resolver DNS queries for these detections. For an additional cost, you can expand coverage and detection capabilities to S3 data events, EKS, Lambda, and more with optional protection plans.

Integration with AWS Organizations allows for convenient control and deployment of GuardDuty across all your AWS accounts.


🗒 Understanding GuardDuty and its Features

1. Deploying GuardDuty

It essentially boils down to setting up an AWS Delegated Administrator account to manage GuardDuty, as it's not advisable to use the AWS Management Account due to the level of access the Management Account has to your AWS Organization accounts, and that organizational policies like SCPs, RCPs, etc., do not affect this account. Once a Delegated Administrator account is set up, we can enable GuardDuty across all accounts and regions.

If integrated and deployed with AWS Organizations, an AWS IAM Service-Linked Role called AWSServiceRoleForAmazonGuardDuty gets deployed to all accounts with the IAM permission policy, AmazonGuardDutyServiceRolePolicyallowing GuardDuty appropriate permission to set up its features.

A GuardDuty detector is created in each region you've configured and used to monitor the environment.

2. Default Findings

3. Protection Plans

As of this writing, GuardDuty has several optional protection plans at an additional cost. We'll take a deeper dive into some of these in future labs. One to keep in mind is that GuardDuty is a detection service only; it does not prevent activity from occurring, malicious or otherwise. Personally, I think it's a bit of a misnomer calling these "protection" plans because of this.

S3 Protection

EKS Protection

If running AWS Elastic Kubernetes Service (EKS) clusters, it's worth enabling this plan to monitor EKS audit log events. No additional configuration is required on the EKS side.

Extended Threat Detection

Extended Threat Detection was added to AWS GuardDuty in December 2024 and is enabled by default. This feature analyzes activity and events across multiple data sources and detects multi-stage attacks in your AWS environment. Currently, it leverages the foundational data sources discussed in the 📖 Introduction to AWS GuardDutyand S3 Protection if enabled.

Runtime Monitoring

If running AWS EKS, AWS Fargate Amazon Elastic Container Service (ECS), and/or Amazon Elastic Container Compute Cloud (EC2) resources, then this may be a beneficial capability. This requires a GuardDuty agent to be deployed (automatically or manually) before it will monitor runtime events on containers and workloads.

Malware Protection for EC2

Malware Protection for EC2 enables scanning EC2 instances and container workloads (EKS Auto Mode) running on EC2 for malware.

Malware Protection for S3

Malware Protection for S3 enables scanning S3 buckets whenever an Object or a new version of an Object is uploaded.

RDS Protection

Lambda Protection

Lambda Protection enables network traffic monitoring of your Lambda functions by leveraging VPC Flow Logs and function invocation logs.

4. Logging

GuardDuty maintains logs for 90 days. If you wish to maintain logs for longer and/or you want to export these logs into another platform like a SIEM (Security Information and Event Management), such as Google SecOps, then you'll want to set this up.


📚 Additional Resources


🏗️ Hands-on Exercises

AWS GuardDuty is a regional service. For the most complete coverage, deploy and enable all features for all AWS accounts and regions in your AWS Organization. We'll look at how to do this in the lab later.

As mentioned in the , GuardDuty leverages default data sources to analyze your AWS environment for potentially malicious activity. These are used to identify and generate EC2 and IAM-related findings, at least at this time.

For EC2, this includes unusual traffic volume, port scanning, SSH and RDP brute force attacks, and more. A full listing of EC2-related findings can be found .

For IAM, this includes activity generated by systems such as Kali Linux, Parrot OS, or Pentoo Linux, disabling of CloudTrail logging, utilizing EC2 credentials from another AWS account or external IP address, and more. A full listing of IAM-related findings can be found .

Enabling this protection plan will immediately begin monitoring CloudTrail S3 data events for potentially malicious activity such as data exfiltration and destruction. CloudTrail does not automatically log S3 data events, this has to be enabled explicitly. However, enabling S3 Protection in GuardDuty is enough - "".

Once enabled, GuardDuty begins to monitor for the Get/Put/List/Delete Object API actions. This looks for S3-related activities being performed by malicious IPs, Tor networks, suspicious/anomalous behavior, and more. A full listing of S3 Protection-related findings can be found .

Once enabled, GuardDuty begins to monitor EKS clusters, looking for anomalous/suspicious EKS-related activities being performed, exposed Kubernetes dashboards, successful access, and more. A full listing of EKS Protection-related findings can be found .

When an alert is generated, we get a history of Signals (correlation of data points and findings), impacted AWS resources, and more. The attack sequence is aligned with tactics (Discovery, Initial Access, Defense Evasion, Exfiltration, etc.). A full listing of attack sequence finding types can be found .

Once enabled and the associated agent is deployed, we'll get alerted to activity like discovery of reverse shells, crypto miners, container escapes, and more. A full listing of runtime monitoring-related findings can be found .

Once enabled, GuardDuty will conduct a malware scan on Elastic Block Store (EBS) volumes when a finding is discovered, indicating the presence of malware. It does this by taking a Snapshot (backup) of the EBS volume and scanning it. This ensures workloads are not interrupted or otherwise impacted during the analysis. On-demand scans can optionally be performed by an administrator by targeting a specific resource by its Amazon Resource Name (ARN). A full listing of EC2 malware protection-related findings can be found .

Once enabled, GuardDuty will monitor up to 25 S3 buckets per Region. It can also scan archived files up to 5 levels and up to 1000 files per archive, provided nothing is password protected. Some apply depending on S3 storage class and encryption settings. A full listing of S3 malware protection-related findings can be found .

RDS Protection enables behavior-based detection of RDS login activity for .

Once enabled, GuardDuty will monitor RDS login behavior for 2 weeks before it generates detections. Likewise, newly spun-up databases will require 2 weeks of monitoring. It will detect activity like successful database login brute force, malicious/anomalous activity, and more. A full listing of RDS protection-related findings can be found .

Once enabled, GuardDuty will monitor these logs for activity like querying IPs related to cryptocurrency activity, connections to a Tor network, and more. A full listing of Lambda protection-related findings can be found .

Currently, the logs can be exported to an S3 bucket. From there, you'll need to set up something like or an alternative integration if you need the logs available on other platforms.

🎓
Deploying AWS GuardDuty via Terraform
Introduction
here
here
...you don't need to explicitly enable or configure S3 data event logging in AWS CloudTrail
here
here
MITRE
here
here
here
additional limitations
here
supported databases
here
here
DataDog's Vector
AWS GuardDuty documentation
Lab: Deploying AWS GuardDuty via Terraform
Lab: Logging GuardDuty Findings to S3
Lab: Adversary Simulation Detection with Stratus Red Team and GuardDuty
Depiction of AWS GuardDuty Organizational Deployment