Microsoft Defender β’ KQL β’ Threat Hunting β’ Real Examples
Microsoft Defender KQL Threat Hunting Guide
Nothing triggered an alert.
But the data already knew.
This guide brings together practical Microsoft Defender XDR hunting examples using KQL, EmailEvents, AuthenticationDetails, spoofed domain checks, UrlClickEvents and identity pivots.
It is designed for real-world investigation, not just theory.
This page is a practical KQL threat hunting hub for Microsoft Defender XDR. It focuses on the exact investigation paths analysts use when something feels wrong but no obvious alert explains it.
EmailEvents and AuthenticationDetails
Spoofed domain and sender alignment checks
Real pivots into clicks, sign-ins and behaviour
π¨ What this means for your environment
Even if nothing has triggered a major alert:
β’ Suspicious activity may already exist across email, identity or endpoints
β’ Low-confidence signals may be getting ignored or missed entirely
β’ Attack paths may be developing without being fully understood
π This is exactly what we uncover during Microsoft 365 security and threat hunting assessments
People searching for spoofeddomain, EmailEvents, AuthenticationDetails and KQL are usually not browsing casually. They are investigating something. An email looked wrong. A user clicked something. A sender looked trusted. Or the logs showed a pattern that deserved a second look.
No alert triggeredThe activity may look clean from an alert perspective, but threat hunting asks a better question: does the behaviour make sense?
The email story does not line upA message can look legitimate to the user while SPF, DKIM, DMARC, sender alignment or authentication details tell a different story.
KQL connects the evidenceThe real value appears when email, URL clicks, sign-ins, endpoint activity and user behaviour are connected into one investigation path.
How to read these KQL queries
These queries are not just for copying and pasting. The real value comes from understanding what they are showing you, why the signal matters, and where to pivot next.
Start with the tableEmailEvents, UrlClickEvents, IdentityLogonEvents, CloudAppEvents and DeviceProcessEvents each tell a different part of the story.
Look for behaviourFocus on mismatched domains, failed authentication, unusual timing, repeated senders, unexpected clicks and authentication activity that does not fit the user.
Pivot with purposeMove from email to click, from click to sign-in, from sign-in to device, and from device evidence into a practical response decision.
Agent Foskett rule
Do not stop when a query returns results. Ask what the results mean, whether the behaviour matches the user, and what evidence should be checked next.
Start with failed email authentication
This is the practical starting point for many Microsoft Defender email investigations. It surfaces messages where SPF, DKIM or DMARC failed and provides the key fields needed to understand the sender, recipient, subject and delivery result.
The spoofeddomain keyword often appears in Defender hunting scenarios where analysts are trying to understand whether a message used a forged sender domain, failed authentication or suspicious alignment. This query keeps the output simple and investigation-friendly.
Used forFinding messages where Defender telemetry suggests spoofing, authentication failure or suspicious domain usage.
Why it mattersA spoofed domain can exploit user trust before the user ever notices the technical warning signs.
Agent Foskett tipDo not stop at the word spoof. Check whether the message was delivered, who received it and whether anyone clicked.
Need the exact spoofing detection queries? See the full Microsoft Defender email spoofing guide with copy & paste KQL using EmailEvents and AuthenticationDetails.
The user sees the visible From address. The email infrastructure also records the Mail From path. When those values tell different stories, the investigation gets interesting.
Used forFinding messages where the identity shown to the user does not match the underlying sending path.
What to checkReview the sender, subject, authentication details and delivery action before deciding whether this is normal forwarding, a third-party sender or impersonation.
Best pivotGroup by sender and subject to decide whether this is a one-off mismatch or part of a broader campaign.
How to read this query
SenderFromDomain is what the user sees as the visible sender domain.
SenderMailFromDomain helps show the underlying sending path.
A mismatch may be normal for some third-party systems, but it should always be validated.
π The question is not βare these different?β The question is βdoes this difference make sense for this sender and this message?β
Find repeated spoofing or failed-authentication campaigns
One suspicious email is interesting. The same sender, subject or domain pattern across multiple recipients is a campaign. This query turns individual messages into patterns.
Used forFinding repeated subject lines, sender identities or authentication failures across several recipients.
Why it mattersCampaign patterns help separate background noise from active targeting.
How GEMXIT uses itTo decide whether response should stay with one mailbox or expand into user communication, blocking, investigation and reporting.
How to read this query
MessageCount shows how often the pattern appeared.
RecipientCount helps identify whether the activity affected one user or many.
Repeated subject lines can reveal phishing campaigns, payroll scams, fake document notifications or impersonation attempts.
π One suspicious email is a finding. Repeated suspicious emails across users can become an incident.
Pivot from suspicious email to user clicks
A suspicious message is one thing. A suspicious message with a user click is something else entirely. This query joins suspicious email telemetry to URL click activity using NetworkMessageId.
The next question after a suspicious click is whether the same user showed risky or unusual authentication behaviour. This helps connect email interaction to identity activity.
Used forChecking whether a click was followed by authentication activity that deserves investigation.
What to look forNew locations, unusual IP addresses, unexpected applications, strange timing or authentication patterns that do not match the user.
Important noteTable names can vary depending on licensing, connectors and data availability. The hunting mindset matters more than one exact table name.
How to read this query
Start with the clicked user, then look for sign-ins close to the click time.
Review unfamiliar IP addresses, locations, applications and logon types.
Watch for activity that looks technically valid but does not match the userβs normal pattern.
π This is where session hijacking, credential capture and suspicious post-click behaviour can start to appear.
Used forFinding activity that may be legitimate but deserves a second look because of timing.
Why it mattersAttackers often blend into legitimate services. Time-of-day analysis can expose activity that alerts ignore.
Best pivotCompare the userβs normal access history, location, IP address and file sensitivity before deciding response.
How to read this query
After-hours access is not automatically malicious, but it deserves context.
Check whether the user normally accesses files at that time.
Review the IP address, application, file name and sensitivity of the content accessed.
π A 2:14 AM file download may be harmless. It may also be the first visible sign of data leaving the environment.
Hunt for suspicious PowerShell behaviour
PowerShell is not automatically bad. But encoded commands, hidden windows, download cradles and suspicious process chains are exactly the type of behaviour KQL is good at finding.
Used forFinding PowerShell commands that deserve review because of obfuscation, download behaviour or suspicious execution flags.
Why it mattersAttackers often use legitimate administration tools. The command line tells the story.
Best pivotInvestigate the initiating process, parent chain, device timeline and related network connections.
How to read this query
Encoded commands, hidden execution and download strings are investigation signals.
Review the initiating process to understand how PowerShell was launched.
Pivot into device timeline, file events and network connections if the command line looks suspicious.
π PowerShell is not the problem. Suspicious PowerShell behaviour is the signal.
What good KQL threat hunting looks like
Good hunting is not running one magic query. It is asking better questions, validating the evidence and connecting small signals into a useful security story.
Start with behaviourAsk what looks unusual, not just what looks malicious. Timing, sender alignment, repeated activity and context matter.
Use pivots, not guessesMove from email to click, from click to sign-in, from sign-in to device, and from device to response.
Turn findings into actionThe goal is not a pretty query. The goal is a decision: dismiss, monitor, block, investigate, contain or improve controls.
If you are relying on alerts alone, you are only seeing part of the picture. KQL helps show what actually happened, not just what triggered.
This guide is designed to sit beside the practical Agent Foskett stories that show how these hunting patterns appear in real environments.
Email spoofingRead The Email Came From Me for a practical story about spoofed email, sender trust and authentication checks.
Identity investigationRead The Logs Already Knew for a Sentinel-style look at impossible travel and session hijacking investigation.
Security operationsReview Microsoft Security Operations to see how hunting, response and visibility fit into a broader security capability.
After-Hours File Access
When nothing looks wrong, timing often tells the real story.
Detect late-night SharePoint downloads and unusual data access patterns.
Read more β
If you want help improving Microsoft Defender hunting, alert investigation and security visibility,
π review Microsoft Defender services
Develop IT. Protect IT.GEMXIT PTY LTD | GEMXIT UK LTD
Microsoft Defender KQL Threat Hunting Guide
This guide explains how GEMXIT uses Microsoft Defender XDR and KQL to investigate suspicious email, spoofed domains, authentication failures, URL clicks, sign-in activity and endpoint behaviour.
Microsoft 365 Security Operations and Threat Hunting
GEMXIT uses KQL to support Microsoft 365 security operations, Microsoft Defender hunting, Sentinel investigation, Entra ID visibility and practical response planning.