{"id":567,"date":"2026-11-20T06:38:00","date_gmt":"2026-11-20T14:38:00","guid":{"rendered":"https:\/\/blog.canutethegreat.com\/?p=567"},"modified":"2026-11-21T01:31:55","modified_gmt":"2026-11-21T09:31:55","slug":"threat-hunting-attack-technique-hypothesis-query","status":"publish","type":"post","link":"https:\/\/blog.canutethegreat.com\/index.php\/2026\/11\/20\/threat-hunting-attack-technique-hypothesis-query\/","title":{"rendered":"Threat hunting with ATT&#038;CK: from a technique to a hypothesis to a query"},"content":{"rendered":"<h2>Why most hunts go nowhere<\/h2>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/blog.canutethegreat.com\/wp-content\/uploads\/2026\/11\/hunt-loop.png\" alt=\"Flowchart of a threat hunting loop: ATT&amp;CK technique, hypothesis, telemetry check, query, triage, then either a detection or a periodic hunt, and finally a hunt log entry that feeds back to the start\" \/><\/figure>\n<p>The hunt loop as a flowchart, drawn by me (not a screenshot).<\/p>\n<p>The usual failed hunt starts with &#8220;let&#8217;s look for anything weird in the logs.&#8221; Three hours later someone has a pivot table of 40,000 rare process names, none of them malicious, and the hunt gets written up as &#8220;no findings.&#8221; That isn&#8217;t a hunt. It&#8217;s browsing.<\/p>\n<p>A hunt is a falsifiable question about your own environment. &#8220;Has an attacker established persistence through scheduled tasks on a server that never creates them?&#8221; can be answered yes or no with data you already collect. MITRE ATT&amp;CK is useful here for one reason: it gives you a catalog of behaviors to turn into those questions, so you don&#8217;t start from a blank page.<\/p>\n<p>ATT&amp;CK isn&#8217;t a detection strategy on its own. It&#8217;s a vocabulary, and the work is translating it.<\/p>\n<h2>Start from a technique, then add a constraint<\/h2>\n<p>Pick one technique and one place it would matter. Scheduled task persistence is T1053.005, and it&#8217;s a good teaching case because it is both common in real intrusions and common in legitimate software, which forces you to deal with noise.<\/p>\n<p>The hypothesis needs three parts: the behavior, the population it applies to, and what normal looks like there. Mine:<\/p>\n<p>&#8220;On our Windows servers, schtasks.exe creating a task that runs a binary from a user-writable path (Temp, ProgramData, Users\\Public) is rare, and nearly all of it is explained by a short list of installers and management tools.&#8221;<\/p>\n<p>That sentence tells you the telemetry (process creation with command lines), the filter (create plus a writable path), and the success condition (a short, explainable list). If the data comes back with 900 distinct parents, the hypothesis was wrong and you&#8217;ve learned something about your estate, which is a legitimate outcome.<\/p>\n<h2>Check that the data exists before you write the query<\/h2>\n<p>This is the step people skip. Process creation events with full command lines are Sysmon event ID 1, or Windows Security event 4688 with the &#8220;Include command line in process creation events&#8221; policy enabled. Without that policy 4688 records the image but not the arguments, and a hunt for \/create flags is impossible. Scheduled task creation is also logged directly as Security event 4698, but only if the &#8220;Audit Other Object Access Events&#8221; subcategory is on, and many baselines leave it off.<\/p>\n<p>Before hunting, count the events per host per day. A server that reports zero process events is not clean. It&#8217;s blind. I&#8217;ve seen hunts conclude &#8220;no activity&#8221; on a host where the agent had been dead for three weeks.<\/p>\n<h2>A first query<\/h2>\n<p>Here is the hypothesis as KQL against the Microsoft Defender for Endpoint DeviceProcessEvents table. The table and column names are real. Adapt the path list to your environment.<\/p>\n<pre tabindex=\"0\" class=\"wp-block-code\"><code>DeviceProcessEvents\n| where Timestamp &gt; ago(30d)\n| where FileName =~ \"schtasks.exe\"\n| where ProcessCommandLine has \"\/create\"\n| where ProcessCommandLine has_any (@\"\\Temp\\\", @\"\\ProgramData\\\", @\"\\Users\\Public\\\", @\"\\AppData\\\")\n| summarize runs = count(),\n            hosts = dcount(DeviceName),\n            first = min(Timestamp),\n            last = max(Timestamp)\n    by InitiatingProcessFileName, InitiatingProcessParentFileName\n| order by hosts asc, runs asc<\/code><\/pre>\n<p>Sort ascending on hosts. The interesting rows are parents that appear on one or two machines, not the ones appearing on 300. A software deployment tool hits everything. An intruder hits what they can reach.<\/p>\n<p>Then look at the rows that survive and read the actual command lines. Don&#8217;t trust the summary. A parent of cmd.exe launched from w3wp.exe on a web server is a very different story from cmd.exe launched by your patching agent, and both would collapse into the same &#8220;cmd.exe&#8221; row if you stopped at the first column.<\/p>\n<h2>Triage the results like an investigator<\/h2>\n<p>For each unexplained hit, answer four things and write them down:<\/p>\n<ol>\n<li>What launched it, and what launched that? Walk the process tree up at least two levels.<\/li>\n<li>What does the task execute, and does that file exist, and who wrote it?<\/li>\n<li>What else did that host do in the ten minutes around it: new services, new outbound connections, credential access?<\/li>\n<li>Is the account that did it one that ever does admin work?<\/li>\n<\/ol>\n<p>Most hits will be benign, and that&#8217;s fine, as long as you record why. &#8220;Backup agent vendor X creates this task on install&#8221; becomes an allowlist entry with an owner and a date. Next quarter that entry is what keeps the hunt from re-triaging the same 30 rows.<\/p>\n<h2>Turn the hunt into a detection<\/h2>\n<p>A hunt that finds nothing still produced something: a query with a known false-positive profile. If the allowlist is short and stable, promote it into a scheduled detection. If it&#8217;s long and churns every month, don&#8217;t. Keep it as a periodic hunt, because an alert nobody trusts is worse than no alert (the previous posts on alert fatigue and Sigma rules cover that tradeoff).<\/p>\n<p>Writing it up as Sigma makes the logic portable. The process_creation category and fields like Image and CommandLine are standard Sigma taxonomy:<\/p>\n<pre tabindex=\"0\" class=\"wp-block-code\"><code>title: Scheduled task created pointing at user-writable path\nstatus: experimental\nlogsource:\n  category: process_creation\n  product: windows\ndetection:\n  selection_img:\n    Image|endswith: '\\schtasks.exe'\n    CommandLine|contains: '\/create'\n  selection_path:\n    CommandLine|contains:\n      - '\\Temp\\'\n      - '\\ProgramData\\'\n      - '\\Users\\Public\\'\n  condition: selection_img and selection_path\nfalsepositives:\n  - Software installers and management agents (maintain an allowlist)\nlevel: medium\ntags:\n  - attack.persistence\n  - attack.t1053.005<\/code><\/pre>\n<h2>Keep a hunt log<\/h2>\n<p>Each hunt gets a short record: hypothesis, ATT&amp;CK ID, data source, date range, query, results, disposition, and what changed afterward (new detection, new logging, or nothing). It takes ten minutes and it&#8217;s the difference between a program and a series of afternoons. It also shows your coverage gaps. If you can&#8217;t write the data source line because the telemetry doesn&#8217;t exist, the first deliverable of that hunt is a logging change.<\/p>\n<p>I&#8217;d rather run six well-scoped hunts a quarter than one sprawling exercise. Pick techniques that your actual intrusions or your peers&#8217; public incident reports use, not the ones that look good on a heatmap. A fully green ATT&amp;CK coverage matrix tells you which boxes someone ticked, and says nothing about whether the detections fire.<\/p>\n<h2>What this doesn&#x27;t do<\/h2>\n<p>A hunt of this kind finds behavior that reuses a known technique through a known tool. It won&#8217;t find an operator who creates the task through the Task Scheduler COM API, never touching schtasks.exe, which is exactly what several public tools do. That&#8217;s why the next iteration of the hypothesis should target the outcome (a new task registered, event 4698 or the task XML files under C:\\Windows\\System32\\Tasks) rather than one binary. Hunting the artifact rather than the tool is slower to write and survives much longer.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Why most hunts go nowhere The hunt loop as a flowchart, drawn by me (not a screenshot). The usual failed hunt starts with &#8220;let&#8217;s look for anything weird in the logs.&#8221; Three hours later someone has a pivot table of 40,000 rare process names, none of them malicious, and the hunt gets written up as [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":568,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[48,355,50,354,52],"class_list":["post-567","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security","tag-detection-engineering","tag-mitre-attck","tag-sigma","tag-threat-hunting","tag-windows-event-logs"],"_links":{"self":[{"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/posts\/567","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=567"}],"version-history":[{"count":2,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/posts\/567\/revisions"}],"predecessor-version":[{"id":905,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/posts\/567\/revisions\/905"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/media\/568"}],"wp:attachment":[{"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/media?parent=567"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/categories?post=567"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/tags?post=567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}