Host firewall disabled or opened from a command line
AN0406 names three Windows firewall-tampering behaviours — netsh, the PowerShell Set-NetFirewallProfile cmdlet, and stopping the mpssvc service — and this rule is those three plus the reg.exe spelling of the registry leg the same analytic describes. The netsh arm is split in two because disabling and opening are different acts with different noise: turning a profile off matches the switch text itself (`state off`, the legacy `set opmode disable`, and `advfirewall reset`, which restores the default policy and silently discards every rule an estate had added), while punching a hole requires both `firewall add rule` and `action=allow` on the same line, so a rule addition that only blocks does not match. The cmdlet arm matches the four NetSecurity verbs an adversary would reach for; it deliberately does not try to tell the disabling direction from the enabling one, because `-Enabled False`, `-Enabled:$false` and `-Enabled 0` are all valid spellings and a selector pinned to one of them would look tighter while quietly missing the other two. The service arm gates on the image being sc.exe, net.exe or net1.exe — net.exe re-executes itself as net1.exe, so either can be the logged image — together with the mpssvc service name, which covers `sc stop mpssvc` and the more durable `sc config mpssvc start= disabled` in one selection. MITRE's `MonitoredCommands` knob is what the image and verb lists implement, populated here from the analytic's prose rather than taken from MITRE; its `AlertThreshold` knob — alert only after N firewall changes in a window — is a count over time, which lib/sigma models with neither an aggregation nor a timeframe, so nothing here encodes it and the rule fires on the single event. Vocabulary and limits. AN0406 gives Security EventID 4688 for this leg and the brief maps it onto the Sigma `process_creation` category, which is Sysmon-EventID-1-shaped; this rule is written in that vocabulary (`Image`, `CommandLine`), so an estate feeding raw 4688 needs `NewProcessName` mapped onto `Image` first, and 4688 needs both *Audit Process Creation* and the separate *Include command line in process creation events* policy before `CommandLine` exists at all — neither is on in a default install or in the Microsoft and CIS baselines, and without them this rule returns zero rows, which reads as quiet when it means blind. The analytic's registry legs (Sysmon EventID 13 and 14 on `registry_set` and `registry_rename`) are a different logsource and are not authored here; the only part of them visible from process creation is a command line naming both the FirewallPolicy key and the `EnableFirewall` value, which catches reg.exe and the PowerShell `HKLM:\SYSTEM\...` path form of the profile switch-off. Requiring the value name alongside the key is what keeps that selection to the modification the analytic describes rather than any mention of the key, but it also means writes under the `FirewallRules` subkey are not covered there — the netsh and cmdlet arms are what carry rule addition. Nothing in this rule sees an implant calling RegSetValueEx directly, `regedit /s policy.reg` (the key lives inside the file), or the Group Policy and MDM paths that set the same values through their own service. The Linux arm AN0407 (iptables, nft, firewall-cmd) and the macOS arm AN0408 (pfctl, socketfilterfw) are separate log sources; AN0408's `macos/unifiedlog` has no standardised Sigma field vocabulary in this corpus, so its fields would have to be invented. UNVERIFIED AS AUTHORED — derived from MITRE ATT&CK DET0145, not hand-written and not tested by its author. Any lab result is on this rule's own page.Full descriptionShow less
The detection
The 4 SIEM queries below are previews produced by Siemphony’s own translator, not pySigma, and none has been executed against a real backend — review before you deploy.
detection.yml
Sentinel · KQL
Run this as a search.
DeviceProcessEvents| where ((FolderPath endswith "\\netsh.exe" and (ProcessCommandLine contains "state off" or ProcessCommandLine contains "set opmode disable" or ProcessCommandLine contains "advfirewall reset")) or (FolderPath endswith "\\netsh.exe" and (ProcessCommandLine contains "firewall add rule" and ProcessCommandLine contains "action=allow")) or (ProcessCommandLine contains "Set-NetFirewallProfile" or ProcessCommandLine contains "New-NetFirewallRule" or ProcessCommandLine contains "Disable-NetFirewallRule" or ProcessCommandLine contains "Remove-NetFirewallRule") or ((FolderPath endswith "\\sc.exe" or FolderPath endswith "\\net.exe" or FolderPath endswith "\\net1.exe") and ProcessCommandLine contains "mpssvc") or (ProcessCommandLine contains "SharedAccess\\Parameters\\FirewallPolicy" and ProcessCommandLine contains "EnableFirewall"))
Splunk · SPL
Run this as a search.
index=* ((Image="*\\netsh.exe" AND (CommandLine="*state off*" OR CommandLine="*set opmode disable*" OR CommandLine="*advfirewall reset*")) OR (Image="*\\netsh.exe" AND (CommandLine="*firewall add rule*" AND CommandLine="*action=allow*")) OR (CommandLine="*Set-NetFirewallProfile*" OR CommandLine="*New-NetFirewallRule*" OR CommandLine="*Disable-NetFirewallRule*" OR CommandLine="*Remove-NetFirewallRule*") OR ((Image="*\\sc.exe" OR Image="*\\net.exe" OR Image="*\\net1.exe") AND CommandLine="*mpssvc*") OR (CommandLine="*SharedAccess\\Parameters\\FirewallPolicy*" AND CommandLine="*EnableFirewall*"))Elastic · ES|QL
Run this as a search.
FROM logs-*| WHERE ((TO_LOWER(process.executable) LIKE "*\\\\netsh.exe" AND (TO_LOWER(process.command_line) LIKE "*state off*" OR TO_LOWER(process.command_line) LIKE "*set opmode disable*" OR TO_LOWER(process.command_line) LIKE "*advfirewall reset*")) OR (TO_LOWER(process.executable) LIKE "*\\\\netsh.exe" AND (TO_LOWER(process.command_line) LIKE "*firewall add rule*" AND TO_LOWER(process.command_line) LIKE "*action=allow*")) OR (TO_LOWER(process.command_line) LIKE "*set-netfirewallprofile*" OR TO_LOWER(process.command_line) LIKE "*new-netfirewallrule*" OR TO_LOWER(process.command_line) LIKE "*disable-netfirewallrule*" OR TO_LOWER(process.command_line) LIKE "*remove-netfirewallrule*") OR ((TO_LOWER(process.executable) LIKE "*\\\\sc.exe" OR TO_LOWER(process.executable) LIKE "*\\\\net.exe" OR TO_LOWER(process.executable) LIKE "*\\\\net1.exe") AND TO_LOWER(process.command_line) LIKE "*mpssvc*") OR (TO_LOWER(process.command_line) LIKE "*sharedaccess\\\\parameters\\\\firewallpolicy*" AND TO_LOWER(process.command_line) LIKE "*enablefirewall*"))
Wazuh · XML rule
Deploy to your manager — this is a rule, not a search.
<group name="sigma,windows,process_creation,"> <!-- Rule ids must be unique on your manager; 100000+ is the user range. --> <!-- 5 rules: the Sigma condition ORs across different fields, which one rule cannot express. Any one matching is a hit. --> <rule id="100000" level="5"> <!-- Set <if_sid> to the decoder/base rule for windows so this only evaluates relevant events. --> <field name="Image" type="pcre2">(?i)\\netsh\.exe$</field> <field name="CommandLine" type="pcre2">(?i)(state off|set opmode disable|advfirewall reset)</field> <description>Host firewall disabled or opened from a command line (1/5)</description> <mitre> <id>T1686</id> </mitre> </rule> <rule id="100001" level="5"> <!-- Set <if_sid> to the decoder/base rule for windows so this only evaluates relevant events. --> <field name="Image" type="pcre2">(?i)\\netsh\.exe$</field> <field name="CommandLine" type="pcre2">(?i)(?=.*(?:firewall add rule))(?=.*(?:action=allow)).*</field> <description>Host firewall disabled or opened from a command line (2/5)</description> <mitre> <id>T1686</id> </mitre> </rule> <rule id="100002" level="5"> <!-- Set <if_sid> to the decoder/base rule for windows so this only evaluates relevant events. --> <field name="CommandLine" type="pcre2">(?i)(Set-NetFirewallProfile|New-NetFirewallRule|Disable-NetFirewallRule|Remove-NetFirewallRule)</field> <description>Host firewall disabled or opened from a command line (3/5)</description> <mitre> <id>T1686</id> </mitre> </rule> <rule id="100003" level="5"> <!-- Set <if_sid> to the decoder/base rule for windows so this only evaluates relevant events. --> <field name="Image" type="pcre2">(?i)(\\sc\.exe$|\\net\.exe$|\\net1\.exe$)</field> <field name="CommandLine" type="pcre2">(?i)mpssvc</field> <description>Host firewall disabled or opened from a command line (4/5)</description> <mitre> <id>T1686</id> </mitre> </rule> <rule id="100004" level="5"> <!-- Set <if_sid> to the decoder/base rule for windows so this only evaluates relevant events. --> <field name="CommandLine" type="pcre2">(?i)(?=.*(?:SharedAccess\\Parameters\\FirewallPolicy))(?=.*(?:EnableFirewall)).*</field> <description>Host firewall disabled or opened from a command line (5/5)</description> <mitre> <id>T1686</id> </mitre> </rule></group>
Verdicts · reactions · comments
Community
Verdicts from engineers who actually deployed it, and the conversation around it.
Nobody has run this in a real environment and said what happened.
Verdicts from engineers who deployed it
0 castNo verdicts reported yet. The first one is worth more than the tenth — say what you ran it against.
Log in to report a verdict.
Log in to join the discussion.
1 thread
@nadia-brandt
Ran this across 30 days of our estate and got a little over 2,400 hits. All but six were New-NetFirewallRule from Intune remediation converging on the same handful of hosts. Scoring it low is correct, but I would go further in the description: the detection value is almost entirely in the `state off` / `advfirewall reset` arm. The `firewall add rule` + `action=allow` arm is a software inventory feed wearing a detection's clothes.
@owen-mackay
Same shape here, and we ended up splitting it into two rules rather than tuning one. The disable arm is medium and pages; the add-rule arm is informational and feeds a hunt dashboard. A single rule carrying two different levels of truth never survives contact with a triage queue — someone eventually mutes the whole thing to get rid of the loud half.