Skip to content

Lesson 10 of 14 · 16m

Audit Policy and Getting Logs Off the Box

Subcategory audit policy gates what exists, 'Include command line' makes 4688 worth having, and Windows Event Forwarding moves events with no agent.

Nothing logs until audit policy says so

auditpol /get /category:* shows nine top-level categories — Account Logon, Object Access, Policy Change — but the unit that actually controls events is the subcategory. "Audit Process Creation" gates 4688; "Audit Security Group Management" gates 4727–4731. Setting them directly is one line:

auditpol /set /subcategory:"Process Creation" /success:enable /failure:enable

When you configure subcategories, legacy category settings stop mattering once "Force audit policy subcategory settings" (SCENoApplyLegacyAuditPolicy) is applied — mix both and you get a merged mess that's hard to reason about. Pick subcategories; set them in a GPO (Computer Configuration → Windows Settings → Security Settings → Advanced Audit Policy Configuration) so the fleet agrees.

The short list worth enabling almost everywhere: Process Creation, Security Group Management, User Account Management, Audit Policy Change, Logon/Logoff, Sensitive Privilege Use, and Removable Storage if you're tracking that threat.

The distinction between category and subcategory is a live wire: auditpol /get reports legacy category state separately, and a GPO written against the old "Audit policy" section (the nine checkboxes) applies categories — once SCENoApplyLegacyAuditPolicy is forced, those legacy settings are ignored, not merged. Check auditpol /get /category:* and the registry's auditbase/SCENoApplyLegacyAuditPolicy state when results look wrong.

The single highest-value logging change on Windows: Administrative Templates → System → Audit Process Creation → "Include command line in process creation events." From Server 2012 R2 / 8.1 (and via KB3004375 on 7/2008 R2), Security 4688 gains a CommandLine field — vssadmin delete shadows /all /quiet becomes a line you can alert on instead of a process name you can't explain.

Kill the wrong model: "turn on auditing, get signal." Broad object-access SACLs on hot folders generate more noise than the channel holds and it rolls. Audit what answers questions: process creation with command line, account and group management, logon/failed logon, policy and task changes, service installs (7045 arrives free), and targeted SACLs on the directories that matter.

Windows Event Forwarding: logs leave the box

WEF is the built-in forwarder — no agent on the source. Two modes: source-initiated push (each workstation forwards to a collector; the subscription URL is delivered by GPO under Computer Configuration → Administrative Templates → Windows Components → Event Forwarding → "Configure target Subscription Manager") and collector-initiated pull. Push over HTTP/5985 works in-domain out of the box; HTTPS/5986 adds mutual certificate auth for boxes you don't fully trust.

On the collector: wecutil qc configures it, wecutil cs subscription.xml creates the subscription — and the subscription's XPath is where the engineering lives, because it decides which events ship:

<Query><Select Path="Security">*[System[(EventID=4624 or EventID=4625 or EventID=4688 or EventID=7045)]]</Select></Query>

Everything lands in the ForwardedEvents channel. A few practical numbers: one collector comfortably serves a few thousand sources; split subscriptions by source class so workstations and servers don't share one XPath; and raise the ForwardedEvents channel size before you need it. Source-initiated is the mode that scales — the endpoints initiate outbound to the collector, so laptops that roam still ship events when they come home; collector-initiated pull only reaches machines the collector can find at query time.

For SIEM pipelines that want syslog or JSON, NXLog (community edition) and Winlogbeat ship .evtx content out the other side — WEF and a shipper aren't exclusive; WEF gets events off endpoints cheaply, the shipper gets them into Elasticsearch or Splunk. The subscription XML's ReadExistingEvents flag decides whether the collector backfills history or only takes new events — set it true for a first deploy, false for steady state.

This is the plumbing Microsoft's own detection guidance has assumed since 2015 — the free "Event Forwarding guidance" that became the Palantir WEF configuration — and it's the reason mid-size shops can afford real Windows telemetry without an EDR budget.

Concrete close: advanced audit policy via GPO, command line into 4688, WEF subscriptions covering Security + Sysmon channels into a hardened collector, and channel sizes raised before the first incident, not during it.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.