zerohop/blog

$ cat asr-audit-before-block.md · 03 Dec 2026 · 4 min read

ASR rules: audit first, block later, and measure in between

#defender#asr#kql#python

Attack Surface Reduction (ASR) rules block things that malware loves and normal users rarely need: Office starting child processes, scripts launching what they just downloaded, processes reading the memory of LSASS. They come with Defender for Endpoint, they cost nothing extra, and they stop a lot.

Turning them all on in Block on day one is also a great way to find out which business application does exactly those things. Usually at month-end, in finance.

So most customers do the sensible thing: everything in Audit. And then it stays in Audit. For years. Because nobody knows which rules are safe to switch, and nobody wants to be the one who broke the invoicing tool.

The cover and summary of the audit. All screenshots use the invented Contoso demo tenant: no real customer data anywhere.
The cover and summary of the audit. All screenshots use the invented Contoso demo tenant: no real customer data anywhere.

The approach

  1. Audit everywhere. Every rule in Audit, on every device. Nothing is blocked, but every hit is logged.
  2. Measure per rule and per group. Group devices the way the business works: device groups, or a name prefix for things like virtual desktops or kiosk PCs. Count the audit hits per rule, per group.
  3. Promote what's quiet. A rule without audit hits in a group goes to Block for that group.
  4. Fix or exclude what's noisy. Look at the files and processes behind the hits. Most can be fixed; a few need a narrow exclusion.

Simple on paper. The tool does the counting.

One verdict per rule

The tool reads the rule state of every device and the ASR events of the last 30 days from advanced hunting. For each rule and each group it gives one verdict:

Per rule: the state on the devices, audit hits, triggers and the verdict. Click a verdict to filter.
Per rule: the state on the devices, audit hits, triggers and the verdict. Click a verdict to filter.

One exception is built in: the LSASS rule fires a lot in Audit, and Microsoft says those hits are almost all safe to ignore once the rule is in Block. So that rule can be ready for Block even with thousands of audit hits. Without knowing that, it looks like the noisiest rule of all.

A plan, not a list

A list of eighteen verdicts is not something you can execute. So the report turns it into waves:

  1. the standard protection rules that are ready (Microsoft advises them on every device);
  2. the other rules without hits;
  3. the rules that need exclusions first;
  4. the rules to investigate.

Each wave comes with the exact GUID lines for the Group Policy or the Intune policy, and a reminder to watch the Block events and the help desk for a week or two before the next wave.

Rollout plan: the rules per wave, with the lines to paste into the policy.
Rollout plan: the rules per wave, with the lines to paste into the policy.

Triggers and exclusions

A trigger is one file with one parent process: FinLink.exe started by EXCEL.EXE, for example. Per rule the report shows the top triggers, how many devices and users they come from, and an example command line.

It also suggests an exclusion path, with the user name replaced by *, and refuses to suggest one for Windows files. Excluding cmd.exe from "Office may not start child processes" defeats the rule; fix the macro or the parent application instead.

Triggers per rule: file, parent process, devices, users and a suggested exclusion path.
Triggers per rule: file, parent process, devices, users and a suggested exclusion path.

The Excel version of the report has a Decision column per trigger. Fill it in with the customer, run the tool once more, and it writes the per-rule exclusions for Intune and Group Policy. Per rule, never global: a global ASR exclusion applies to every rule at once.

The query behind it

The heart of it is simple. Audit hits per rule and file:

kqlDeviceEvents
| where Timestamp > ago(30d)
| where ActionType startswith "Asr" and ActionType endswith "Audited"
| summarize Hits = count(), Devices = dcount(DeviceId)
    by RuleAction = ActionType, FileName
| order by Hits desc

The tool adds the rule state per device, the device groups, the parent processes and the devices that report no ASR state at all. Those are often the interesting ones: antivirus in passive mode, an old platform version, or a policy that never reached them.

What I learned

← all posts