Skip to content

Instantly share code, notes, and snippets.

@UserUnknownFactor
Last active May 5, 2023 04:22
Show Gist options
  • Save UserUnknownFactor/fbb820d7625a5a48b04cf23e3fb515ab to your computer and use it in GitHub Desktop.
Save UserUnknownFactor/fbb820d7625a5a48b04cf23e3fb515ab to your computer and use it in GitHub Desktop.
Sysmon config to only check DNS requests from a specific source
<Sysmon schemaversion="4.83">
<!--
Sysmon (https://learn.microsoft.com/en-us/sysinternals/downloads/sysmon)
config to only monitor DNS requests from specific processes.
Install it like this:
sysmon -accepteula -i config-dnsquery.xml
or reconfigure, if it's already installed before:
sysmon -c config-dnsquery.xml
To check events run:
mmc eventvwr.msc
and then check "Application and Services Logs/Microsoft/Windows/Sysmon/Operational"
log and match "ProcessId" from there to pID of processes in Task Manager if needed.
Uninstallation later:
sysmon -u
-->
<HashAlgorithms>sha256</HashAlgorithms>
<EventFiltering>
<RuleGroup name="" groupRelation="or">
<DnsQuery onmatch="include">
<Image condition="contains">processname.exe</Image>
</DnsQuery>
</RuleGroup>
<!-- Don't need anything else. -->
<ProcessCreate onmatch="include" />
<FileCreateTime onmatch="include" />
<NetworkConnect onmatch="include" />
<ProcessTerminate onmatch="include" />
<DriverLoad onmatch="include" />
<ImageLoad onmatch="include" />
<CreateRemoteThread onmatch="include" />
<RawAccessRead onmatch="include" />
<ProcessAccess onmatch="include" />
<FileCreate onmatch="include" />
<RegistryEvent onmatch="include" />
<FileCreateStreamHash onmatch="include" />
<PipeEvent onmatch="include" />
<WmiEvent onmatch="include" />
<FileDelete onmatch="include" />
<ClipboardChange onmatch="include" />
<ProcessTampering onmatch="include" />
<FileDeleteDetected onmatch="include" />
<FileBlockExecutable onmatch="include" />
<FileBlockShredding onmatch="include" />
</EventFiltering>
</Sysmon>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment