This is a Flash Hunt from Threat Hunting Labs. The brief was a high severity alert on one Windows workstation: a program running out of a user profile folder had launched PowerShell. I had five tables to work with (endpoint telemetry, Windows event logs including PowerShell and Sysmon, Zeek network logs, and two detection exports), all queryable with KQL.


My starting guess was that the alert was a lead and not the whole story. I wanted to rebuild what that program did before and after the PowerShell launch from raw telemetry, and only trust the alert once I’d seen the same thing in the logs. I treated the program’s name and the host as my first two keys.
Quick tip for anyone using the console: the query has to start with the table you picked in the picker, and the tables are all named <something>_clean_CL.

The loader. I started in endpoint telemetry because it was the only place that could show how the program started. I didn’t know the column names yet, so my first search was a free-text one across every column, and I switched to proper filters once I could see the schema. Before trusting anything I checked two things: whether the path in the command line matched the executable field, and whether the folder names were what they looked like. I copied path strings out of the field and didn’t retype them.
For the libraries it loaded, I grouped the load events by path, signature status and original file name instead of scrolling. That gets around the row cap and makes the odd one out easy to spot. I also checked where each library loaded from and not just who signed it, because a valid signature doesn’t mean a file is in the right place.
The children. Next I listed everything that program started. I used the entity IDs instead of PIDs for lineage, because PIDs get reused, and I counted distinct processes and not rows. One child was launched with an encoded command, so I decoded it locally and checked it against the PowerShell logs. The command line alone didn’t tell me what the child was really doing, so I went to the network.
The network. I wasn’t sure which table held what, so I summarised event categories and datasets first. That fixed two mistakes of mine: I’d pasted a process event when I needed a network one, and my first TLS sample was a failed internal connection with no useful fields. I filtered to the right processes and to public destinations, and checked whether a connection was only attempted or actually succeeded before I said a host was contacted.
To connect an address to a name and an owner, I went from the IP to the DNS records, to the TLS server name, to who owned the address. I read the full DNS response chains and not just the last record. Zeek sees hosts and not processes, so I tied events together by address and timing, and checked the clocks of the two sources against each other. I also reminded myself that an address’s owner tells you who fronts a service and not who runs what is behind it. For the HTTP side I summarised by user agent and destination with first and last seen, and compared that against traffic from before the incident before I called anything the odd one.

The detection exports. To work out who launched the program and what flagged it first, I switched the picker to the detection table and read the earliest row. That one row covered both, and I’d run an extra query I didn’t need. I now read the whole event before running another query. I also cross-checked the user in the detection against the raw endpoint events, and checked how ties would break by looking at both timestamp fields.
Persistence. I pulled the scheduler’s registry records to see which tasks existed, then thought about who actually wrote them. The writer in those events is the scheduler service, which says nothing about the creator, and the author field is attacker-controlled. So I needed creator evidence, and went to PowerShell script block logging in the system table.
My first script-block query wasn’t summarised, and it hit the row cap because one block had been padded out into a huge number of parts. Summarising per block ID fixed that. Then I searched across all the PowerShell processes for task-related keywords. A lot of the hits were just the scheduled-task module’s own source code, which is noise. The useful ones were a couple of blocks from the same process, and I decoded the strings in them in my own terminal. I tied the registry records to the script by timing and by matching pieces of names, and then lost a while to a rabbit hole over which of the identifiers in the scheduler’s records mattered.

Following the task. To trace what the task ran, I searched for one of its identifiers across the process fields. My first try returned nothing, because I’d copied the token with a suffix that only belonged to a different field, so I was searching for a string that couldn’t exist. Searching on the token alone worked. After that I looked at what the process queried over DNS and judged each name against baseline and against what happened next, instead of taking the first one.
The staging window. I summarised file events from PowerShell by action first to learn the schema, then listed created executables per process, and worked out which one actually ran by looking at execution, signature, library loads and lineage and not at the file list. For the network side I summarised Zeek HTTP by source and destination over the window and filtered on method, user agent and path. The connection ID wasn’t a flat column, so I read it out of the raw record.


The late activity. Several hours later I went looking for discovery-style activity. This is where most of my wrong turns were. I searched process command lines for a keyword and got a screen of service host noise, because the word is also part of how Windows names service groups. I checked directory search traffic next, but counting searches over time didn’t give me a window, so I stopped using volume as a signal. I tried Sysmon with a short, common token and matched unrelated text. The detection export finally had the event. I misread the command’s syntax at first and took the wrong part of it as the thing being queried, and fixed it by splitting the line into tool, subcommand, argument and switch.

When I needed the parent of that process, I chased a full ancestry through several sources before noticing that only the immediate parent mattered, and it was already in the row I had. The parent’s own start wasn’t in any source I could search, so I wrote that down as a gap and didn’t claim a link I couldn’t show.
Scoping. To judge how far the activity had spread, I tested each claim against what it would leave behind: connections and authentication to other hosts, and outbound volume to public addresses. I checked what was normal for the host before treating anything as new, and wrote down what each source could and couldn’t show.
Where I got stuck. Mostly in places where I assumed. I took a keyword to mean one thing when it also meant something else. I treated a single noisy source as if it carried information. I trusted a short search term that matched the wrong text. And I ran queries to find things that were already on my screen. I also needed a few nudges from the lab’s hints, which cost no points.
The same Flash Hunt had a second lab: a malware analysis workspace on a REMnux VM, with the samples from the intrusion in a password-protected bundle. I used Detect It Easy as my main viewer, plus the usual command-line tools (exiftool, strings, xxd, binwalk, rabin2, objdump). I never ran anything. My rule for myself was that every file’s claim about itself needed a second look.
Getting in. My first extraction attempt failed with a passphrase error, so I slowed down and checked what I was typing against where the password came from.
Version metadata. For each file I read the version resource and compared the name it claimed to be built under with the name on disk and with the other fields beside it. Version info is free text anyone can set, so I treated it as a claim and not as evidence. At one point the viewer cut the pane off and the parse looked misaligned, so I checked the field again with a second tool that reads UTF-16 strings.
Toolchain and build path. I read the compiler and language lines for the executables. One of them had garbled version text, so I copied only the readable part and checked that the other executable agreed. For a library that claimed to be something else, I looked in the debug directory for the build path, and compared it with the file’s name, the layout I’d expect for that project, and the header’s compile stamp. A build path is harder to retouch than version text, but it is still a claim.
Size and embedded content. The file’s size didn’t fit what its sections should add up to, so I worked out where the last section ends and went to look at what sat after it. I needed a nudge from the lab to look at the section layout, and I used rabin2 and objdump for it. They only list sections, and the extra bytes sit outside every section, so they told me where it starts and nothing more. Reading the raw bytes was what worked, and I was a bit slow getting there. I ran a signature scan for embedded files and confirmed each candidate by structure (a real header and a consistent size) and not just by the string match. I took a wrong turn running an opcode scan, which gave one stray hit that didn’t mean anything next to what the header said. When two hits were both real I had to decide which to report, and I tried the first. For the bulk of the file past the sections, I read raw bytes at the start, middle and end, and counted distinct byte values per window to see whether it was one repeated value or real content.
Imports and config. For the small launcher, I read its import table by library and judged which names were generic Windows ones and which belonged to the product’s own library, remembering that names can carry compiler decoration. I only read the configuration file, never ran it, and compared its primary and fallback infrastructure entries with what I’d seen in the network logs from the first half.
These are the shapes I used, with the lab’s values swapped for placeholders.
Group library loads for a process by path, signature and original name:
<EDR_TABLE>
| where event_category == "library"
| where process_name =~ "<PROCESS>"
| summarize loads = count(), first_seen = min(timestamp)
by dll_path, dll_name, dll_code_signature_status, dll_pe_original_file_name
| order by first_seen asc
Public outbound connections from a set of processes, so you can see who they talk to first:
<EDR_TABLE>
| where event_category == "network"
| where process_pid in (<PID1>, <PID2>, <PID3>)
| where network_direction == "egress"
| where not(ipv4_is_private(destination_ip))
| summarize first_seen = min(timestamp), attempts = count()
by process_name, process_pid, destination_ip, destination_port
| order by first_seen asc
Summarise PowerShell script blocks per block ID, to get past padding and the row cap:
<SYSTEM_TABLE>
| where event_dataset == "windows.powershell_operational"
| where process_pid == <PID>
| summarize parts = max(total), first_seen = min(timestamp) by script_block_id
| order by first_seen asc
Find a process by an identifier anywhere in the path or command line:
<EDR_TABLE>
| where event_category == "process"
| where process_executable contains "<IDENTIFIER>" or process_command_line contains "<IDENTIFIER>"
| summarize runs = count(), first_seen = min(timestamp)
by process_name, process_executable, process_parent_name, user_name
| order by first_seen asc
HTTP requests to a destination, filtered by method, so the earliest one is easy to find:
<NETWORK_TABLE>
| where event_dataset == "zeek.http"
| where http_request_method == "<METHOD>"
| where destination_port == <PORT>
| summarize requests = count(), first_seen = min(timestamp), last_seen = max(timestamp)
by source_ip, destination_ip, user_agent_original
| order by first_seen asc
Pull the search filter out of directory search logs and group by shape:
<NETWORK_TABLE>
| where event_dataset == "zeek.ldap_search"
| where source_ip == "<HOST_IP>"
| extend ldap_filter = extract('"filter":"([^"]+)"', 1, tostring(otel))
| summarize searches = count(), first_seen = min(timestamp) by ldap_filter
| order by first_seen asc
And for the malware half, the command shapes I used on the VM:
Read version strings as UTF-16, with the line after each match:
strings -e l <FILE> | grep -i -A1 "<FIELD>"
Scan for embedded files, then check that a hit is a real header:
binwalk -B <FILE>
xxd -s $((<OFFSET>)) -l 96 <FILE>
Find where the last section ends, then read what sits after it:
objdump -h <FILE>
xxd -s $((<START_AFTER_LAST_SECTION>)) -l 256 <FILE>
Count distinct byte values in a window of a large file:
dd if=<FILE> iflag=skip_bytes,count_bytes skip=<OFFSET> count=1048576 2>/dev/null | xxd -p -c1 | sort | uniq -c | sort -rn | head -3
Lab: Flash Hunt: Python Loader to Remote Access on Threat Hunting Labs