Operator On The Wire
Join
← Back to Knowledge Base
BLUE TEAM / THREAT HUNT / WINDOWS / NETWORK

Firewall

This note documents detection patterns related to Windows Firewall Activity within Windows environments.


Direct Indicators

LogEvent IDMeaningForensic ValueNotes
Security5156Allowed connectionCriticalMost important firewall allow event. Includes process and ports.
Security5157Blocked connectionCriticalDetects denied outbound/inbound traffic.
Security5152Packet droppedHighLow-level packet filtering evidence.
Security5153Packet allowedHighRaw packet acceptance event.
Security4946Firewall rule addedCriticalNew inbound/outbound rule created.
Security4947Firewall rule modifiedCriticalExisting rule altered.
Security4948Firewall rule deletedCriticalRule removed.
Security4949Firewall settings restoredHighFirewall restored to default configuration.
Security4950Firewall setting changedHighGeneral policy modification.
Security4954Firewall Group Policy changedHighFirewall policy applied through Group Policy.
Sysmon3Network connectionCriticalStrongest process-to-network correlation.
Firewall Provider2004Rule addedCriticalRule creation (validate channel on target OS).
Firewall Provider2005Rule modifiedCriticalRule changed (validate channel on target OS).
Firewall Provider2006Rule deletedCriticalRule removed (validate channel on target OS).
Firewall Provider2033Setting changedHighPolicy altered (validate channel on target OS).

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
Rare outbound portHigh destination port uncommon for hostHighPossible C2 or exfiltration
Internal host unusual targetLateral movement pathCriticalSuspicious east-west traffic
Block immediately followed by allowRule tamperingCriticalPolicy bypass clue
Firewall disabled then activity startsDefense evasionCriticalStrong malicious indicator
New allow rule for uncommon binaryPersistenceCriticalOften malware staging
Repeated dropped outbound attemptsBeacon retryHighMalware trying fallback
SYSTEM process unusual outboundPrivileged abuseCriticalOften service abuse

Common Tools

ToolUsage
netsh advfirewallFirewall rule management
PowerShell NetFirewall* cmdletsRule creation / modification
wf.mscGUI firewall management
netstatConnection visibility
TCPViewLive process-to-port mapping
SysmonProcess-linked network telemetry

Relevant Artifacts

  • Security Event IDs 5156, 5157, 5152, 5153

  • Security Event IDs 4946, 4947, 4948, 4950

  • Sysmon Event ID 3

  • Firewall policy files:

    • %systemroot%\system32\LogFiles\Firewall\pfirewall.log
  • Registry:

    • HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy
  • GPO firewall rules

  • EDR network lineage


MITRE ATT&CK References

  • T1071 Application Layer Protocol

  • T1049 System Network Connections Discovery

  • T1562.004 Disable or Modify Firewall

  • T1021 Remote Services


Decision Tree

  1. Was traffic allowed or blocked?
    • 5156
    • 5157
  2. Which process owns traffic?
    • Process ID
    • Sysmon correlation
  3. Destination suspicious?
    • External
    • Internal lateral
  4. Rule changed?
    • Added
    • Modified
    • Deleted
  5. Timing relation:
    • Before compromise
    • During execution
    • Before persistence
  6. Expand:
    • Parent process
    • DNS
    • File creation

Detection

KQL

SecurityEvent
| where EventID == 5156
| project TimeGenerated, Computer, Application, SourceAddress, DestAddress, DestPort
SecurityEvent
| where EventID in (4946,4947,4948)
| project TimeGenerated, Computer, EventID, Activity

EQL

network where event.code == "5156"
sequence by host.name with maxspan=5m
  [ process where true ]
  [ network where true ]

Sigma

title: Suspicious Firewall Rule Modification
id: firewall-rule-modification
status: experimental
description: Detects firewall rule creation or modification
references:
  - https://attack.mitre.org/
author: Vergil
date: 2026-03-12
logsource:
  product: windows
  service: security
detection:
  selection:
    EventID:
      - 4946
      - 4947
      - 4948
  condition: selection
fields:
  - SubjectUserName
  - RuleName
falsepositives:
  - Administrator changes
level: high
tags:
  - attack.defense_evasion
  - attack.t1562.004

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
Firewall auditingEnable 5156 / 5157CriticalEssential visibility
Rule monitoringAlert on 4946-4948CriticalDetect policy tampering
Egress filteringRestrict outboundHighLimits beaconing
Rule baselineCompare against standardHighDetect rogue entries
Sysmon correlationProcess + networkCriticalStrongest investigation path