A new Windows Firewall rule was added. RuleName and ApplicationPath are key.
Attackers add firewall rules to allow C2 traffic, open additional access ports, or allow malicious services to communicate outbound. Tools: netsh advfirewall firewall add rule.
Alert: rules added allowing inbound access on non-standard ports. Alert: rules added for processes in temp/user directories. Alert: any firewall rule addition outside change management.
SubjectUserNameTargetUserNameLogonTypeIpAddressWorkstationName | Tactic | Technique |
|---|---|
| Defense Evasion | Disable or Modify System Firewall (T1562.004) |
Starting points — adapt the log source, projected fields and thresholds for your environment.
title: Windows Firewall Rule Added
status: stable
description: Firewall exception rule added
author: theadminstack.com
date: 2026/05/16
logsource:
product: windows
service: security
detection:
selection:
EventID: 4946
condition: selection
falsepositives:
- Legitimate software installation
- IT-approved rule changes
level: medium
tags:
- attack.defense_evasion
- attack.t1562.004
SecurityEvent
| where EventID == 4946 // A change has been made to Windows Firewall exception list — a rule was added
| project TimeGenerated, Computer, SubjectUserName, TargetUserName, LogonType, IpAddress, WorkstationName
| sort by TimeGenerated desc
index=* sourcetype="WinEventLog:Security" EventCode=4946
| stats count earliest(_time) as first_seen latest(_time) as last_seen by ComputerName
| sort - count `# A change has been made to Windows Firewall exception list — a rule was added — add EventData fields: SubjectUserName, TargetUserName, LogonType, IpAddress`
A change has been made to Windows Firewall exception list — a rule was added. A new Windows Firewall rule was added. RuleName and ApplicationPath are key.
Event 4946 is written to the Security channel by Microsoft-Windows-Security-Auditing. Advanced Audit Policy — enable the 'Windows Firewall' subcategory (Success and/or Failure).
Event 4946 is associated with: Disable or Modify System Firewall (T1562.004).
Alert: rules added allowing inbound access on non-standard ports. Alert: rules added for processes in temp/user directories. Alert: any firewall rule addition outside change management.