Event ID 4948
Event ID 4948: Firewall Rule Deleted
A change was made to the Windows Firewall exception list. A rule was deleted
- Log source
- Security
- How to enable it
- Policy Change > Audit MPSSVC Rule-Level Policy Change (Success)
- Category
- Defense Evasion
- Priority
- Medium
- Typical volume
- Medium
- MITRE ATT&CK
What Event ID 4948 means
4948 records that a Windows Firewall rule was deleted. The consequence depends on the kind of rule. Deleting an allow rule closes a path, which is harmless or disruptive. Deleting a block rule opens one, and that is the case that matters.
Because the event does not say which kind it was, the name and the identifier must be compared with a baseline. A simple export of rules from a reference host is enough to recognize the handful of block rules that your hardening depends on.
Its second use is cleanup. Intruders who added a rule for their tunnel may delete it afterwards. A rule that was added and removed within hours has a 4946 and a 4948 with the same RuleId, and that interval tells you when the access was in use.
Key fields to inspect
| Field | Meaning | Suspicious when |
|---|---|---|
RuleId | Unique identifier of the deleted rule. | The same value as a recent 4946. |
RuleName | Display name of the deleted rule. | Your own block rules, or a name added shortly before. |
ProfileChanged | Profiles affected. | All or Public on a server. |
Computer | Host that lost the rule, from the event header. | Several hosts in the same minutes, which points to a script. |
Detection queries
Find rules that existed for less than a day on a host. Adjust names and thresholds to your environment. About these queries.
Splunk SPL
index=windows source="XmlWinEventLog:Security" (EventCode=4946 OR EventCode=4948)
| stats earliest(eval(if(EventCode=4946,_time,null()))) AS added latest(eval(if(EventCode=4948,_time,null()))) AS deleted values(RuleName) AS name BY Computer RuleId
| eval hours=round((deleted-added)/3600, 2)
| where hours>=0 AND hours<24 Microsoft Sentinel KQL
let rules = SecurityEvent
| where EventID in (4946, 4948)
| extend RuleId = extract(@'Name="RuleId">([^<]+)', 1, EventData), RuleName = extract(@'Name="RuleName">([^<]+)', 1, EventData);
rules
| where EventID == 4946
| project Computer, RuleId, RuleName, Added = TimeGenerated
| join kind=inner (rules | where EventID == 4948 | project Computer, RuleId, Deleted = TimeGenerated) on Computer, RuleId
| where Deleted between (Added .. 1d)
| project Added, Deleted, Computer, RuleName, RuleId PowerShell
Get-WinEvent -FilterHashtable @{ LogName = 'Security'; Id = 4948; StartTime = (Get-Date).AddDays(-7) } |
ForEach-Object { $d = @{ Time = $_.TimeCreated }; ([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }; [pscustomobject]$d } |
Select-Object Time, RuleName, RuleId, ProfileChanged | Format-Table -AutoSize Attack scenarios
Removing a hardening rule
A block on SMB or Remote Desktop between workstations is deleted so that lateral movement can proceed. The deletion on several hosts within minutes shows scripted preparation.
Cleaning up after access
A rule for a listener is removed when the operator leaves. Combined with the matching 4946 and the connections in 5156, it frames the period of access.
Investigation checklist
- Look up RuleId in your baseline to learn whether it allowed or blocked.
- Find the matching 4946 and calculate how long the rule existed.
- Search 5156 for connections that the rule permitted in that period.
- Recreate any block rule that was removed, and find the process responsible.
Common benign causes
- Software removal and upgrades that delete and recreate their rules.
- Store apps, whose rules change for each user and version.
- Group Policy or scripts that rebuild the local rule set.
Event ID 4948 FAQ
How can I see what a deleted firewall rule did?
The event does not include it. Check the Windows Firewall operational log (event 2006, or 2052 on newer versions), a registry backup, or the same rule on a similar computer.
Why are many 4948 events followed by 4946?
Updates often delete a program's rules and create them again with a new version. Pairs with the same RuleName within seconds are typical of that.
Is deleting all rules logged as one event?
Each deleted rule has its own 4948. Restoring the default policy is recorded separately as 4949.