{"id":821,"date":"2026-12-03T06:22:00","date_gmt":"2026-12-03T14:22:00","guid":{"rendered":"https:\/\/blog.canutethegreat.com\/?p=821"},"modified":"2026-11-24T01:32:54","modified_gmt":"2026-11-24T09:32:54","slug":"aws-cloudtrail-guardduty-first-detections","status":"publish","type":"post","link":"https:\/\/blog.canutethegreat.com\/index.php\/2026\/12\/03\/aws-cloudtrail-guardduty-first-detections\/","title":{"rendered":"AWS CloudTrail and GuardDuty: the detections worth turning on first"},"content":{"rendered":"<p>Plenty of AWS accounts have CloudTrail technically on, and GuardDuty either off or enabled in one region and forgotten. Neither state gives you much. The first week is less about clever detection logic and more about making sure the data exists, is complete, and can&#8217;t be quietly switched off by the person you&#8217;re trying to catch.<\/p>\n<h2>What each service actually sees<\/h2>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/blog.canutethegreat.com\/wp-content\/uploads\/2026\/11\/cloudtrail-guardduty-flow.png\" alt=\"Flow diagram: workload accounts feed an organization CloudTrail trail and GuardDuty, logs land in a locked-down S3 bucket, and EventBridge routes high severity findings to paging and everything else to a ticket queue\" \/><\/figure>\n<p>The diagram shows how account activity flows through CloudTrail and GuardDuty to alerts, and which controls protect the pipeline itself.<\/p>\n<p>CloudTrail records API calls. Every call to the AWS control plane, from the console, the CLI or an SDK, produces an event with the caller identity, source IP, user agent, the action and the parameters. Management events are recorded by default and you can browse the last 90 days in Event history without configuring anything. That default is a convenience, not a security control. It&#8217;s per region, it can&#8217;t be queried at scale, it expires, and it doesn&#8217;t cover data events such as S3 object reads or Lambda invocations.<\/p>\n<p>GuardDuty is a different animal. It consumes CloudTrail management events, VPC flow logs and DNS query logs through its own independent feed, so you don&#8217;t have to configure those logs yourself, and it applies threat intelligence and anomaly models on top. It tells you things like &#8220;these EC2 instance credentials were just used from an IP outside AWS&#8221;. You could write that detection yourself against CloudTrail, but I wouldn&#8217;t want to maintain it.<\/p>\n<p>GuardDuty finds the known-bad and the statistically odd. CloudTrail is the evidence you read afterwards, and the source for detections specific to your own environment. You want both.<\/p>\n<h2>Fix the trail first<\/h2>\n<p>One organization trail, multi-region, with log file validation, delivering to a bucket in a separate logging account that the workload accounts can&#8217;t write to or delete from. That&#8217;s the whole design.<\/p>\n<pre tabindex=\"0\" class=\"wp-block-code\"><code>aws cloudtrail create-trail \\\n  --name org-trail \\\n  --s3-bucket-name example-org-cloudtrail-logs \\\n  --is-multi-region-trail \\\n  --is-organization-trail \\\n  --enable-log-file-validation\n\naws cloudtrail start-logging --name org-trail<\/code><\/pre>\n<p>Log file validation makes CloudTrail write hourly digest files containing SHA-256 hashes of the log files, signed with RSA. It&#8217;s how you prove later that nobody edited or removed a log file, and you check it with <code>aws cloudtrail validate-logs<\/code>. It sounds optional, so teams skip it, and then they spend a day arguing about whether a gap in the logs was an attack or a misconfiguration. Turn it on.<\/p>\n<p>Multi-region matters because attackers don&#8217;t limit themselves to the regions you use. A stolen key that launches GPU instances in a region you&#8217;ve never touched is the classic cryptomining pattern, and a single-region trail won&#8217;t show it.<\/p>\n<p>Data events (S3 object-level, Lambda, DynamoDB) cost money per event, so don&#8217;t enable them everywhere. Pick the buckets that hold things you&#8217;d have to disclose a breach of, and log those.<\/p>\n<h2>Turn on GuardDuty everywhere, with delegation<\/h2>\n<p>Enable it in every region of every account, including regions you&#8217;ve blocked with SCPs. Use a delegated administrator so new accounts enroll automatically.<\/p>\n<pre tabindex=\"0\" class=\"wp-block-code\"><code>aws guardduty create-detector --enable \\\n  --finding-publishing-frequency FIFTEEN_MINUTES<\/code><\/pre>\n<p>The default publishing frequency for updates to existing findings is six hours. Fifteen minutes is a better setting. New findings go out to EventBridge as they&#8217;re created either way.<\/p>\n<p>Beyond the basic data sources, GuardDuty has optional protection plans: S3 data events, EKS audit logs, malware scanning for EBS volumes, RDS login activity, Lambda network activity and runtime monitoring. Check the current pricing page before enabling them all. My order: S3 protection first, because the buckets are where the money is, then EKS if you run it, then the rest as you need them.<\/p>\n<p>A few finding types I&#8217;d make sure reach a human quickly:<\/p>\n<ul>\n<li><code>UnauthorizedAccess:IAMUser\/InstanceCredentialExfiltration.OutsideAWS<\/code>, which means instance role credentials are being used from outside AWS. This is the SSRF-to-metadata pattern, the same family of problem as the Capital One breach in 2019.<\/li>\n<li><code>Stealth:IAMUser\/CloudTrailLoggingDisabled<\/code>, for someone turning off the evidence.<\/li>\n<li><code>Policy:S3\/BucketBlockPublicAccessDisabled<\/code>, for someone removing a guardrail.<\/li>\n<li><code>CryptoCurrency:EC2\/BitcoinTool.B!DNS<\/code>, which is almost always a compromised instance or a stolen key.<\/li>\n<\/ul>\n<p>Route high severity findings (GuardDuty&#8217;s high band starts at 7.0) to paging. Everything else goes to a queue someone actually reads. If every finding pages, people will mute the channel within a month.<\/p>\n<h2>The detections GuardDuty won&#8217;t write for you<\/h2>\n<p>Some of the most valuable signals are about your own policy. For those, you query CloudTrail directly, through an EventBridge rule, CloudTrail Lake, or Athena over the bucket. These are the ones I&#8217;d put in first:<\/p>\n<ul>\n<li>Any use of the root user. There should be none. Root events have <code>userIdentity.type<\/code> of <code>Root<\/code>.<\/li>\n<li><code>StopLogging<\/code>, <code>DeleteTrail<\/code>, <code>UpdateTrail<\/code> and <code>PutEventSelectors<\/code> on your trail.<\/li>\n<li><code>DisableGuardDuty<\/code>, <code>DeleteDetector<\/code>, or changes to the delegated admin.<\/li>\n<li><code>ConsoleLogin<\/code> where <code>additionalEventData.MFAUsed<\/code> is <code>No<\/code>. Federated SSO logins can show <code>No<\/code> too, so filter on the identity type or you&#8217;ll drown.<\/li>\n<li><code>CreateAccessKey<\/code> for an IAM user, especially one that hasn&#8217;t had a key before. Long-lived keys are what leaks.<\/li>\n<li><code>PutBucketPolicy<\/code>, <code>PutBucketAcl<\/code> and <code>DeletePublicAccessBlock<\/code> on buckets.<\/li>\n<li><code>AuthorizeSecurityGroupIngress<\/code> with <code>0.0.0.0\/0<\/code> on anything other than 80 or 443.<\/li>\n<\/ul>\n<p>An EventBridge event pattern for the trail tampering case looks like this:<\/p>\n<pre tabindex=\"0\" class=\"wp-block-code\"><code>{\n  \"source\": [\"aws.cloudtrail\"],\n  \"detail-type\": [\"AWS API Call via CloudTrail\"],\n  \"detail\": {\n    \"eventSource\": [\"cloudtrail.amazonaws.com\"],\n    \"eventName\": [\"StopLogging\", \"DeleteTrail\", \"UpdateTrail\", \"PutEventSelectors\"]\n  }\n}<\/code><\/pre>\n<p>EventBridge rules are regional. The event for a call made in a given region shows up on that region&#8217;s bus, so a rule deployed in one region misses the region an attacker chose. Deploy it in each region, or forward events to a central bus.<\/p>\n<p>For quick investigation without any setup, <code>lookup-events<\/code> still works on the 90-day history:<\/p>\n<pre tabindex=\"0\" class=\"wp-block-code\"><code>aws cloudtrail lookup-events \\\n  --lookup-attributes AttributeKey=EventName,AttributeValue=CreateAccessKey \\\n  --max-results 20<\/code><\/pre>\n<p>It&#8217;s rate limited and slow, so it&#8217;s fine for triage and wrong for a dashboard.<\/p>\n<h2>Protect the pipeline itself<\/h2>\n<p>An attacker with admin in a workload account will try to blind you before doing anything loud. The logging account needs a bucket policy that only lets the CloudTrail service principal write, and ideally S3 Object Lock so a compromised role can&#8217;t delete history. Add an SCP in the organization that denies <code>cloudtrail:StopLogging<\/code>, <code>cloudtrail:DeleteTrail<\/code> and <code>guardduty:DeleteDetector<\/code> to everyone except a break-glass role. The detections above then become a second line instead of the only one.<\/p>\n<p>I&#8217;d also test it. Pick a sandbox account, stop logging on a test trail, and time how long until a human sees the alert. If the notification target is a topic with no subscribers, you&#8217;ll find out in the first five minutes, which is a much better time than during an incident.<\/p>\n<h2>What I&#8217;d skip at first<\/h2>\n<p>Skip the giant custom detection library. Skip the SIEM purchase until you&#8217;ve seen whether the GuardDuty findings and ten CloudTrail rules are being acted on. Three months of acting on a small, trusted set of alerts teaches you more about your environment than a catalog of two hundred rules nobody has time to tune.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Plenty of AWS accounts have CloudTrail technically on, and GuardDuty either off or enabled in one region and forgotten. Neither state gives you much. The first week is less about clever detection logic and more about making sure the data exists, is complete, and can&#8217;t be quietly switched off by the person you&#8217;re trying to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":822,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[254,255,408,48,409,35],"class_list":["post-821","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security","tag-aws","tag-cloud-security","tag-cloudtrail","tag-detection-engineering","tag-guardduty","tag-incident-response"],"_links":{"self":[{"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/posts\/821","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/comments?post=821"}],"version-history":[{"count":1,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/posts\/821\/revisions"}],"predecessor-version":[{"id":945,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/posts\/821\/revisions\/945"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/media\/822"}],"wp:attachment":[{"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/media?parent=821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/categories?post=821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/tags?post=821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}