About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
An application cannot reach a server, or a server will not answer a program, and the Security log holds an event 5157 that reads "The Windows Filtering Platform has blocked a connection." Beside it, or instead of it, there may be a 5152, "The Windows Filtering Platform blocked a packet." Both come from the Windows Filtering Platform, which Microsoft's subcategory page says enables independent software vendors to filter and modify TCP/IP packets and to monitor or authorise connections. A block is a decision that platform made. Whether it is the decision you wanted is the question.
What follows explains what each event contains, how the two differ, how to find the filter that did the blocking, and what Microsoft says to watch. Nothing before the Fix section changes anything.
What the error means
Microsoft has one page for each event. The page for 5157 is titled "5157(F): The Windows Filtering Platform has blocked a connection." and says: "This event generates when Windows Filtering Platform has blocked a connection." The page for 5152 is titled "5152(F): The Windows Filtering Platform blocked a packet." and says: "This event generates when Windows Filtering Platform has blocked a network packet. This event is generated for every received network packet." The "F" in both titles is, as general knowledge, the mark of a failure event. Both have no required server role and a minimum of Windows Server 2008 or Windows Vista.
The difference is the unit. A connection is one conversation, and a packet is one piece of it. The page that describes the Audit Filtering Platform Packet Drop subcategory is direct about it: "Failure events volume typically is very high for this subcategory and typically used for troubleshooting." It advises: "If you need to monitor blocked connections, it is better to use" event 5157, "because it contains almost the same information and generates per-connection, not per-packet." The subcategory page for connections adds: "It is much more important to audit Failure events (blocked connections, for example)."
The fields are the same in both events, as Microsoft's two event pages define them:
- Process ID and Application Name: the process that attempted the connection, and "full path and the name of the executable for the process." The disk appears in the form \device\harddiskvolume#, and the page says the volume numbers can be listed with the diskpart utility and its command
list volume. - Direction: the page says Inbound for inbound connections and, in its words, "Outbound – for unbound connections."
- Source Address and Source Port, Destination Address and Destination Port.
- Protocol: a number. The page's table includes 1 for ICMP, 6 for TCP, 17 for UDP, 47 for GRE, 50 for ESP and 51 for AH.
- Filter Run-Time ID: the "unique filter ID that blocked the connection" (the 5152 page says "blocked the packet").
- Layer Name and Layer Run-Time ID: the Windows Filtering Platform layer.
5157 also has Remote User ID and Remote Machine ID in its example XML; the 5152 example does not.
Likely causes
Neither page lists causes, because a block is a result and not a fault. The reasons a connection or packet is blocked, as our own reading and general practice:
| Situation | What the event shows | What to ask |
|---|---|---|
| The firewall is working as set: a program that should not be reachable is being reached | An inbound Direction, an address you do not know | Is this traffic meant to be stopped? |
| A new program has no allow rule | The program's own path, a port it has just started to use | Was it installed or updated recently? |
| A security product added its own filter | A filter ID that does not match any firewall rule you wrote | Which product installed it? |
| An address or a port has changed | The Destination is the new one | Did a server move or a port change? |
| Scanning or probing | Many events from one address across many ports | Where does that address belong? |
Our guide to firewall rules that stop working on the Public network profile covers one cause of a block. None of the fields the 5157 page lists is a network profile, so the event names the filter that blocked, not the profile that applied.
Prove the cause before changing anything
Everything here only reads, except that two of the commands write one file each. The warning for those is below, before them.
- In Event Viewer on the computer that logged the event, open Windows Logs and then Security and find event ID 5157. Prefer 5157 to 5152, for the reason Microsoft gives. Write down the Application, the Direction, both addresses and ports, the Protocol and the Filter Run-Time ID.
- Decide whether the Application is the program you expected. If its path shows \device\harddiskvolume2, run
diskpartand only itslist volumecommand there, no other diskpart command, to see which volume that is. - Decide whether the address and port are expected. Take care with which side is which. The 5157 page says the Source Address is the "local IP address on which application received the connection". Its own example shows the application listener.exe with source port 3333 and the destination port 49218, which fits that. The 5152 page says "packet" where the 5157 page says "connection", and its example shows source port 49278 and destination port 3333 for the same application, which does not fit. The page does not explain the difference, so confirm which end is yours using a connection you know, not the labels alone.
- Check what is audited, with the read-only command in the last block of this section. The
auditpolcommand page gives it for all categories; it needs Read permission on the policy or the Manage auditing and security log right. - Find the filter and the layer. The page does this with two
netsh wfpcommands that each generate one file, so they come after the warning below.
Risk: the next two commands each generate one XML file, filters.xml and wfpstate.xml. The page does not say where the file is written, whether an existing file of the same name is overwritten, or how long the commands take, and it gives no step that changes a filter. As general advice, before you run them make sure no file with either name already exists in the folder you run them from, so that nothing of yours is overwritten, and use a folder only administrators can read, because the files describe the filters and filtering state of the machine.
netsh wfp show filters
netsh wfp show state
To undo it: the commands change no filter; they only add the two files. Deleting a file cannot be undone, though the commands can be run again to make the files again. If you decide to remove them, delete only the two files the commands generated, filters.xml and wfpstate.xml, each by name. If a file with either name was already there before you ran the commands, it is not one of yours to delete.
The first command generates the filters.xml file; open it and find the filter ID you wrote down in a <filterId> element. The second generates the wfpstate.xml file; open it and find the layer ID in a <layerId> element.
The auditing check from step 4 is separate and only reads:
auditpol /get /category:*
The page does not say what an entry in the XML file will name. As general advice, not a statement on the page, read the filter's name and the provider that added it before you decide anything; it may point to a Windows Firewall rule or to a security product.
Example (illustrative): a booking application on a small office's server will not accept connections from the front-desk computers. The Security log on the server shows 5157 for the application's own executable, Direction Inbound, destination port 8080, with the same Filter Run-Time ID each time. The filter ID, found in the generated file, belongs to a rule the security product installed last week. The connection is being blocked by a product the firewall rules never mention, which is why the firewall page alone did not explain it.
Fix
Neither page tells the reader to change anything, and the event itself needs no repair. What follows are decisions, and none comes with a command from Microsoft's pages:
- If the block is the firewall doing what it was set to do, nothing is wrong. Record the reason so the next person does not undo it.
- If the traffic should be allowed, the change belongs to whichever tool owns the filter you found: a Windows Firewall rule, or the product that added its own. Changing a rule is a change with its own record of the current rule and a way back. Our guide to proving a firewall change will not break hosted ports covers how to make one safely.
- If the same blocked traffic appears from many addresses, treat it as something to watch, not something to allow.
- If the block comes from the path the traffic takes, not from a filter on this machine, Connections Half-Work Through Two Gateways: Proving Asymmetric Routing covers that.
Confirm the fix
- The events you were chasing stop for that Application, address and port, and the program works.
- The Filter Run-Time ID in any new 5157 is one you can name, with an owner.
- Auditing of Filtering Platform Connection failures is still on, so a future block would be recorded.
- Nobody has turned on Success auditing for the subcategory without meaning to. Microsoft's page says Success auditing "typically generates a very high volume of events, for example, one event for every connection that was made to the system."
What to watch afterwards
Both pages give the same monitoring advice, and it is worth reading as a list of questions:
- Is the Application the program you defined for the operation, and is it in a standard folder? The page says to look for one "not in System32 or Program Files" or in a restricted folder, the example being Temporary Internet Files.
- Are there words in the application name that you have listed as restricted? The page's examples are "mimikatz" and "cain.exe".
- Is the Source Address one of the addresses assigned to the computer?
- If the computer should have no Internet access, is the Destination Address an Internet address, not one of the private ranges?
- If you have an allowlist of addresses, is the Destination Address outside it?
- Is the Protocol number one that is not typical for the device, for example anything other than 1, 6 or 17?
- If the computer's traffic to an address should always use one port, is the Destination Port any other?
Read next
Related articles you may want next.
- TroubleshootingFirewall Rules Stopped After a Move? Check the ProfileServices refused after a Windows server move? Read each connection's network category, trace why domain detection failed and fix that, not the rules.Read article
- HostingValidating firewall changes for hosted application dependenciesHow to baseline required ports for hosted applications and verify connectivity after routine firewall rule changes—not post-incident policy restore.Read article
- TroubleshootingConnections Half-Work Through Two Gateways: Proving Asymmetric RoutingTwo gateways or a second NIC and connections reset or hang? Prove the return path with captures on both legs, then fix routing, not the firewall's state checks.Read article
Risks and limits
These steps have not been run or lab-tested. Both event pages sit in Microsoft's previous-versions area, are dated 2021-09-08 and have example events timestamped 2015. The 5157 page's example XML shows Version 1, while the page says "Event Versions: 0", and neither event page explains the numeric values such as Direction %%14592 and Layer %%14610 in the examples; read your own events as Event Viewer renders them. The 5152 example shows Filter Run-Time ID 0, and the page does not say what that means. The page gives no way to map a filter ID to a firewall rule beyond finding it in the file. The table of situations and the decisions in the Fix section are our own reading and general advice. As general advice, a few blocked connections are not by themselves a sign of a fault or of an attack.
Sources
- 5157(F): The Windows Filtering Platform has blocked a connection. — Microsoft Learn, page dated 2021-09-08, accessed 3 December 2026
- 5152(F): The Windows Filtering Platform blocked a packet. — Microsoft Learn, page dated 2021-09-08, accessed 3 December 2026
- Audit Filtering Platform Connection — Microsoft Learn, page dated 2021-09-06, accessed 3 December 2026
- Audit Filtering Platform Packet Drop — Microsoft Learn, page dated 2021-09-06, accessed 3 December 2026
- auditpol get — Microsoft Learn, page dated 2024-11-01, accessed 3 December 2026
This article was originally published on .