VeriKQL by Kaushik Saha

Level 6 · Is this one incident? · Mission 3 of 5 · by Kaushik Saha

One timeline

Alert Six alerts, one attacker · Idea union · strcat

Commands here project · where · == · in · sort by · tostring · union · all commands

Briefing

The SOC lead wants the whole story on one page: every event from the attacker's addresses, from any table, in order.

One idea: union stacks rows from several tables

Each table's rows are shaped into the same columns, then stacked and sorted:

union
    (EmailEvents | where SenderIPv4 in ("203.0.113.45", "203.0.113.77")
        | project TimeGenerated, Source = "Email", What = Subject, Who = RecipientEmailAddress, From = SenderIPv4),
    (SigninLogs | where IPAddress in ("203.0.113.45", "203.0.113.77")
        | project TimeGenerated, Source = "Sign-in", What = strcat(AppDisplayName, " (", ResultType, ")"),
            Who = UserPrincipalName, From = IPAddress),
    (AuditLogs | where tostring(InitiatedBy.user.ipAddress) in ("203.0.113.45", "203.0.113.77")
        | project TimeGenerated, Source = "Directory", What = OperationName,
            Who = tostring(TargetResources[0].userPrincipalName), From = tostring(InitiatedBy.user.ipAddress))
| sort by TimeGenerated asc
✓ Verified by VeriKQLKusto.Language 12.4.1 · bundle 2026.10.29

Result on the sample · 16 rows

TimeGeneratedSourceWhatWhoFrom
2026-06-10 07:55:12EmailAction required: overdue invoice INV-20931alex.morgan@contoso.com203.0.113.45
2026-06-10 07:55:14EmailAction required: overdue invoice INV-20931priya.nair@contoso.com203.0.113.45
2026-06-10 08:14:02Sign-inOffice 365 Exchange Online (50126)alex.morgan@contoso.com203.0.113.45
2026-06-10 08:15:10Sign-inOffice 365 Exchange Online (50126)alex.morgan@contoso.com203.0.113.45
2026-06-10 08:16:31Sign-inOffice 365 Exchange Online (50126)alex.morgan@contoso.com203.0.113.45
2026-06-10 08:17:05Sign-inOffice 365 Exchange Online (50126)alex.morgan@contoso.com203.0.113.45
2026-06-10 08:18:41Sign-inOffice 365 Exchange Online (50126)alex.morgan@contoso.com203.0.113.45
2026-06-10 08:19:12Sign-inOffice 365 Exchange Online (50126)alex.morgan@contoso.com203.0.113.45
2026-06-10 08:19:44Sign-inOffice 365 Exchange Online (500121)alex.morgan@contoso.com203.0.113.45
2026-06-10 08:20:09Sign-inOffice 365 Exchange Online (500121)alex.morgan@contoso.com203.0.113.45
2026-06-10 08:20:36Sign-inOffice 365 Exchange Online (0)alex.morgan@contoso.com203.0.113.45
2026-06-10 08:24:10Sign-inMicrosoft Graph PowerShell (0)alex.morgan@contoso.com203.0.113.45
2026-06-10 09:02:41Sign-inAzure Portal (0)alex.morgan@contoso.com203.0.113.45
2026-06-10 09:08:19Sign-inOffice 365 SharePoint Online (0)alex.morgan@contoso.com203.0.113.77
2026-06-10 09:40:15DirectoryAdd member to rolealex.morgan@contoso.com203.0.113.77
2026-06-10 09:58:44Sign-inAzure Storage (0)alex.morgan@contoso.com203.0.113.77

The whole incident, in order: the phish at 07:55, the brute force from 08:14, the denied prompts and the way in at 08:20:36, PowerShell, the Azure portal, the change of address, the role grant at 09:40 and Azure Storage at 09:58.

strcat joins text together: here the app and its result code.

Your turn

Build the same timeline for Priya Nair, the other phishing recipient. Did the attacker get into her account?

Write it in the box below and check it. Then compare with one answer; others can be right too.

Show one answer
union
    (EmailEvents | where RecipientEmailAddress == "priya.nair@contoso.com"
        | project TimeGenerated, Source = "Email", What = Subject, From = SenderIPv4),
    (SigninLogs | where UserPrincipalName == "priya.nair@contoso.com"
        | project TimeGenerated, Source = "Sign-in", What = strcat(AppDisplayName, " (", ResultType, ")"), From = IPAddress)
| where From in ("203.0.113.45", "203.0.113.77", "198.51.100.23")
| sort by TimeGenerated asc
✓ Verified by VeriKQLKusto.Language 12.4.1 · bundle 2026.10.29

Result on the sample · 2 rows

TimeGeneratedSourceWhatFrom
2026-06-10 07:40:48Sign-inOffice 365 Exchange Online (50126)198.51.100.23
2026-06-10 07:55:14EmailAction required: overdue invoice INV-20931203.0.113.45

Check your own query

Write your query for the task above and check it against the real schema.

Debrief

One timeline, three tables, one attacker. The spray at 07:40 came from another address and never got in; nothing on the sample ties it to this attacker, and a careful report says so. Next: name each step, and ship a rule.

All data on this page is sample data, made up for this course. The IP addresses come from ranges reserved for documentation, and the people and the company are fictional.

Mission by Kaushik Saha. Every query checked with Microsoft.Azure.Kusto.Language 12.4.1 against schema bundle 2026.10.29; every result computed on the course's sample with Kusto-Loco 1.4.9, an open-source KQL engine (credits). The story's clock reads 12:00 UTC on 10 June 2026.