5157 Security log · Filtering Platform Connection low severity medium volume

Windows Event ID 5157 — The Windows Filtering Platform has blocked a connection

WFP blocked a network connection. Indicates a firewall rule blocked traffic.

Why event 5157 matters

Blocked connections from attack tools can indicate attacker enumeration of firewall rules. High volume of blocks from a single process may indicate port scanning or C2 beacon failures.

How to detect it

Alert: clustered blocks from PowerShell or cmd. Alert: blocks indicating lateral movement attempt (SMB, RDP to internal hosts in rapid succession).

Log source
Security
Advanced Audit Policy — enable the 'Filtering Platform Connection' subcategory (Success and/or Failure).
Fields to pivot on
SubjectUserNameTargetUserNameLogonTypeIpAddressWorkstationName

Detection queries

Starting points — adapt the log source, projected fields and thresholds for your environment.

Sentinel / Defender KQL
SecurityEvent
| where EventID == 5157   // The Windows Filtering Platform has blocked a connection
| project TimeGenerated, Computer, SubjectUserName, TargetUserName, LogonType, IpAddress, WorkstationName
| sort by TimeGenerated desc
Splunk SPL
index=* sourcetype="WinEventLog:Security" EventCode=5157
| stats count earliest(_time) as first_seen latest(_time) as last_seen by ComputerName
| sort - count   `# The Windows Filtering Platform has blocked a connection — add EventData fields: SubjectUserName, TargetUserName, LogonType, IpAddress`
Hunt event 5157 in Sentinel/Defender →
Build a KQL query for this event in the KQL Query Builder.
Search all event IDs →
Open the interactive Windows Event ID lookup.

Related Filtering Platform Connection events

5154 The Windows Filtering Platform has permitted an application to listen on a port 5155 The Windows Filtering Platform has blocked an application from listening on a port 5156 The Windows Filtering Platform has permitted a connection 5158 The Windows Filtering Platform has permitted a bind to a local port

Frequently asked questions

What is Windows Event ID 5157?

The Windows Filtering Platform has blocked a connection. WFP blocked a network connection. Indicates a firewall rule blocked traffic.

Which log records event 5157?

Event 5157 is written to the Security channel by Microsoft-Windows-Security-Auditing. Advanced Audit Policy — enable the 'Filtering Platform Connection' subcategory (Success and/or Failure).

How do you detect activity around event 5157?

Alert: clustered blocks from PowerShell or cmd. Alert: blocks indicating lateral movement attempt (SMB, RDP to internal hosts in rapid succession).