{"componentChunkName":"component---src-templates-post-template-js","path":"/a-part-of-anti-virus-3-01-en","result":{"data":{"markdownRemark":{"id":"80237161-84f0-5f40-aa9a-d7f7fab254c9","html":"<blockquote>\n<p>This page has been machine-translated from the <a href=\"/a-part-of-anti-virus-3-01\">original page</a>.</p>\n</blockquote>\n<p>In this chapter, I explain the overview and basic architecture of WFP.</p>\n<p>When discussing endpoint security on Windows, especially the monitoring and control of network traffic, WFP is a mechanism you cannot avoid.</p>\n<p>WFP is used not only by the Microsoft Defender Firewall built into the OS, but also for many other purposes, including endpoint security products such as Antivirus and EDR.</p>\n<p>In this chapter, as groundwork for creating tools and drivers that use WFP in Chapter 2 and later, I explain as simply as possible why WFP is used in security products, as well as how its overall structure and components work together to process packets.</p>\n<h2 id=\"what-is-wfp\" style=\"position:relative;\"><a href=\"#what-is-wfp\" aria-label=\"what is wfp permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What Is WFP</h2>\n<h3 id=\"overview-of-wfp\" style=\"position:relative;\"><a href=\"#overview-of-wfp\" aria-label=\"overview of wfp permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Overview of WFP</h3>\n<p>WFP is a set of APIs and system services that provides a platform for creating network filtering applications on Windows Vista and Windows Server 2008 and later.</p>\n<p>WFP supports IPv4/IPv6 and makes it possible to filter, modify, and re-inject data, as well as handle both packets and streams.\nIt can also provide security until the Base Filtering Engine (BFE) starts during system boot, and handle data both before and after IPsec encryption.<sup id=\"fnref-1\"><a href=\"#fn-1\" class=\"footnote-ref\">1</a></sup></p>\n<p>By using WFP, developers and application vendors can implement a wide range of software for Windows, including firewalls, intrusion detection/prevention systems (IDS/IPS), Antivirus products, and network monitoring tools.</p>\n<p>For example, Microsoft Defender Firewall, which is built into Windows by default, also uses WFP to implement a stateful firewall and traffic filtering based on various conditions.<sup id=\"fnref-2\"><a href=\"#fn-2\" class=\"footnote-ref\">2</a></sup></p>\n<p>By actually checking the WFP filters registered in the system with tools such as WFP Explorer, you can confirm that WFP is used by many applications other than firewalls, including Antivirus software and VPN software.</p>\n<p>As a platform for creating such network filtering applications, WFP includes facilities for monitoring, receiving, and processing network traffic at every level within the Windows network stack.</p>\n<p>The figure below shows the architecture of WFP’s various components.<sup id=\"fnref-3\"><a href=\"#fn-3\" class=\"footnote-ref\">3</a></sup></p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 698px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/3c134abd02766189b253ab0509a587e8/487bb/01-wfp-001.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 122.49999999999999%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAZCAIAAAC+dZmEAAAACXBIWXMAAAsTAAALEwEAmpwYAAACmElEQVQ4y33U6U5bQQwF4Pv+z4SEhAoCxCJBxR7WsCUEyAokIemXOWlEq1L/mPjaPvaxx5NqMplMp9OXl5eDg4NarXZ1dUU5PT09OTnZ29vzeXl5GcvFxQW9VmQ4HEJV0yJSjEajj4+P8Xj8+fkZRcSoCIUln5T39/eUnIMjYA8PD9fX181mc5F0+r38Dd7f319aWnKen59jfnd39/T0JJeTThHzbzCqujo+Pj47O9va2lpZWanX680iwHrG639gbsibm5ujoyMDA3h8fLy9vWXPKeZbsLGr9vz8vGALfH9/32q1gH3+AUbD9MyQYjxgbkIo/imreSOUlAXYwBezrN7e3n4U6ff7HGDdbncwGIhDQTVIlRcsQoT0er0Z+GcR1k6noyv3OSmyuKrX11eJuGCMw+bIqEYllKnRaKCXHUpXumi32wCQi9tWqV1EGewqodw+GkUkZs0aaYSrX2RQRDWuMBJQRcvt+bYJmpFbhzBCYUwRVeOgiAkvLKoMeXFVmYqCrSLmFJ6m7QTOtOeVNWmk0iuYIjB0DJ3A3d+iNWe64BJZpeG8mOTDBx0WOm/eE8v4iwiWokLSW9VqmmFNP+bMZVUpvEK/PrI5bc24NBEURXBOb3lDOnIFAQugG4qzU6TqFcnVSUZHUmWXr0M3zwWMhUVaX1/f3Nzc2NjwWmf3nEnwyadD6TM2g2T0sGQBzs6vrq4uLy9vb28jK35WGZPsMJ5qagl5C6d/ML1IZD2x2N3d9c5ltEsmNZu2H1khNZZW0y1SCsoOyX54eIj22toa2nlqs8oZRm6FSS6W0NnZ2YHEMHvOqz67XubTVpZVhzhnZqLzJPyfKJ4/Ay5cJI0ye1U++IIcFskCsKipvTzGbEHuORtNfgG25HecvvWqZAAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/3c134abd02766189b253ab0509a587e8/8ac56/01-wfp-001.webp 240w,\n/static/3c134abd02766189b253ab0509a587e8/d3be9/01-wfp-001.webp 480w,\n/static/3c134abd02766189b253ab0509a587e8/d1b7f/01-wfp-001.webp 698w\"\n              sizes=\"(max-width: 698px) 100vw, 698px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/3c134abd02766189b253ab0509a587e8/8ff5a/01-wfp-001.png 240w,\n/static/3c134abd02766189b253ab0509a587e8/e85cb/01-wfp-001.png 480w,\n/static/3c134abd02766189b253ab0509a587e8/487bb/01-wfp-001.png 698w\"\n            sizes=\"(max-width: 698px) 100vw, 698px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/3c134abd02766189b253ab0509a587e8/487bb/01-wfp-001.png\"\n            alt=\"WFP architecture\"\n            title=\"WFP architecture\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>As shown in this architecture diagram, WFP is broadly composed of the following components.\nDetails of each component are described later.</p>\n<ul>\n<li>Filter Engine</li>\n<li>Base Filtering Engine (BFE)</li>\n<li>Shim</li>\n<li>Callout driver</li>\n</ul>\n<h3 id=\"wfp-in-the-windows-network-stack\" style=\"position:relative;\"><a href=\"#wfp-in-the-windows-network-stack\" aria-label=\"wfp in the windows network stack permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>WFP in the Windows Network Stack</h3>\n<p>The figure below, quoted from <em>Inside Windows, 6th Edition, Vol. 1</em>, provides an overview of Windows network components. (At the time of writing, the newer <em>Inside Windows, 7th Edition</em> no longer includes the networking chapter, so I refer to the 6th edition.)<sup id=\"fnref-4\"><a href=\"#fn-4\" class=\"footnote-ref\">4</a></sup></p>\n<p>This figure also shows that WFP performs processing at various levels within the Windows network stack.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 864px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/2e0ade6cf9b94253d37dc92e1f29d3ae/9cab2/01-wfp-002.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 122.49999999999999%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAZCAYAAAAxFw7TAAAACXBIWXMAABYlAAAWJQFJUiTwAAAF2UlEQVQ4y0WV629bdxnHzTuk8YYXvIL/YBXS3m6T0ITQhBAS0rhIbPBihWoFBNVQJSAtrCCgHYINrVq7Sk3bNWlI2sZ1Ls795jg3+/h+vx37nGM7vqRJ7NjOxUk+PD7NkiM98s8//87Hz/e5/Syq61NUx1WSwVHiiUUMw8tOfYvI0Nv4e17FN/p7PA9fI2j9CY36BvVGhaqxQqMwT/sQeY7Z39+nVCqxtbWFJTv8bbK9X8M3+wGK7xGJmJXnGxuEnR/isl/C67jJyvCv8c78mY1qAS3vRBm5iDb+I9rHnD4b8s7Ozg6WcmyAcuAmxayTYjFEqRih2WigGx7UrINczksi7SQn33d2NonGp3GNXiZgfYfyhiFeqTSbDTY3N9ne3sZirLvIVcKkDRehxDze0CRu/6iYnUhqlpTmJKOOsbVZFmCTXGGJyNwfiVq/h16YEaljsr9FpVyRM5tY9JQD/+PzeAZ+ifL4PRy9F3H0vIf3ya/wP72I0v8LjPQcY9Mr3OudZmPdQ2L5FuraJ2zVVgWyQKu1cyrdsq67yc13YTivkZjqIjzWRWS8i9TMFfLOv5KZ7aJacLPqUlhYDlMc+y3rt79OauIa9ZZH4jojkutnwHRmmEJ1Fr00QyonMpM2grFBWY+KvAm04iTJ1ADFfJLtRpvs4M+ofPJlUiO/Y7vpFeA0u7s71LZrNCT2Fo8yzMpyH27XUzweK0vOPoKBMRLxOVLJedOi0TlazZrpgW57l8rNr6COXyZfdmJooxwctKhWpaTqdQF6bcTiQwKwEvL3EYs9k4yVaR8gBw/Z2zugLfVxfHx0CtQ/egl17DKF8hKGPipnGmeSBx91sTB1nYBkbqr7u1RKI9RqJTloiHcJdE0ToNBPgJoAw/946YWHpRcefgE8Pj7Gsjz5dwJLNwh7bqPM/oVk0kqtXjUP7B/si7U5koPHR4enwPiNM6AuwN29nTNgKjWFmhlFcffjUQbwunsIBQbxe58Qi0jC9An03Dx7u61TYPG/L4DGCbDd3j0Drg//kOePzhH97BWMe+cw+r+F2vMaqTvnCN1+Be3ey6j2C7T22yfA85RPklKsLJmSS6X8GXCl9+cEul/H/+A7JHvfoNLzMot3v0/s4Ruy9ybp7m9SGPoxzf0XkvXBt6l8/CXU0UsUqyvi4YiEKXoCPJIY2v/Nmu0PrA5dwTvyJ+L295m3foDL3LuK33aJ5MK/OHjBIzt1jdz9V0lM36DWcFOpSMjU5JmH+WIKVYuQ1cPk9ChpLSG96yOR8pNIymBIeQlFfRJnhXTGT2atj+ziLTKBSUnestTfDLqeFXBVBoX0sqFNkFMfywtWcrK2912l//qbPL3zG6am72If+Q9DtluM2T/GZvsU5ebrhP75VULDV2js+cxOSSaiHB4emXPRotz/AavXv4HL8RlpdRKf8oiA8jkBr3RMcFC6xIrbbSXgf0IwZCXifUhw7Q4R6aatrc7ImyAeC5uSDw8PsYSmPpLJ8j4RGVnF4jKalIghQ9QwFs11Zy8WX5A4zZHNzokKB9mcQ8IhCdHHyWSGKBR0Ke596eldkVzNk6tq5IpJVIlhRguSzoUkliGJa9Qcuvm8R8wnQzeMZvhNyxeiApokb4yb8/C09Xz2v6H0/RT3wAWm7l1g9sG7uPrPs9b7DqvPrlDZWJaXxIv1WdyTH7LY/RZL99/C7+xmvbwgSuzS+xX543W5BqpypwTHSS7dIrn6gIjzLtGlu6TXPie1coeE8lQyvkZWXZLrwC1xmyKw+j+xATQ1KB7OoGljbNeeU6/VZS42sWj5FKHYHEnVQywl8Uo6SWU9RJOLJDMuwuFJ/HIdxOMOKZsVwtEZKaVFmq26SH0usIp5OXUS0m63sSQSbunhThZHTPN6hsRsKIpN9sU8w+aezzdBQDxUlGeyHpEEnE3pVqslnmpSkyK5MxQ72elkqXOv6rpu/lgoFMx1Pp83151PwzBM61yZHUir1TRvvI7UL57/A4JKqzRmWKYnAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/2e0ade6cf9b94253d37dc92e1f29d3ae/8ac56/01-wfp-002.webp 240w,\n/static/2e0ade6cf9b94253d37dc92e1f29d3ae/d3be9/01-wfp-002.webp 480w,\n/static/2e0ade6cf9b94253d37dc92e1f29d3ae/b4e26/01-wfp-002.webp 864w\"\n              sizes=\"(max-width: 864px) 100vw, 864px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/2e0ade6cf9b94253d37dc92e1f29d3ae/8ff5a/01-wfp-002.png 240w,\n/static/2e0ade6cf9b94253d37dc92e1f29d3ae/e85cb/01-wfp-002.png 480w,\n/static/2e0ade6cf9b94253d37dc92e1f29d3ae/9cab2/01-wfp-002.png 864w\"\n            sizes=\"(max-width: 864px) 100vw, 864px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/2e0ade6cf9b94253d37dc92e1f29d3ae/9cab2/01-wfp-002.png\"\n            alt=\"OSI model and Windows network components\"\n            title=\"OSI model and Windows network components\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>In WFP, filtering operations on network traffic are performed by the filter engine.\nThe filter engine has multiple filtering layers, and at key points in the network stack it matches traffic passed from the Shim (packets/streams/events) against the set of filters registered in each layer to determine the final action.</p>\n<h3 id=\"how-wfp-is-used-in-endpoint-security\" style=\"position:relative;\"><a href=\"#how-wfp-is-used-in-endpoint-security\" aria-label=\"how wfp is used in endpoint security permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>How WFP Is Used in Endpoint Security</h3>\n<p>Network traffic is commonly used as the starting point for endpoint intrusion by malicious attackers, such as access to malicious URLs, malware downloads, remote logon attempts, or attacks against services with open ports on the network.</p>\n<p>Also, if a device is compromised and an attacker gains access to an organization’s network, network communication is used at many points throughout the attack sequence, including collecting information within the organization’s network, receiving remote-control commands from the outside, expanding the scope of compromise through what is called lateral movement, and leaking confidential information to the outside.</p>\n<p>For that reason, monitoring network traffic is one of the most important points from a security perspective.</p>\n<p>However, in order to deploy an intrusion detection system such as what is generally called a NIDS (Network Intrusion Detection System), it is necessary to place equipment capable of monitoring traffic on the network path being monitored.</p>\n<p>Note: The NIDS described here is different from the Windows Network Driver Interface Specification (NDIS).<sup id=\"fnref-5\"><a href=\"#fn-5\" class=\"footnote-ref\">5</a></sup></p>\n<p>Because of this characteristic, a NIDS can effectively monitor traffic at boundaries such as between an organization’s network and the Internet, but placing network devices between all endpoints within a network is often difficult in terms of operations and cost, and as a result it cannot monitor communication between individual endpoints inside the organization’s network.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 960px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/273b0616b21019cd37b6a35489f018d0/0d98f/01-wfp-003.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 54.58333333333334%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAABYlAAAWJQFJUiTwAAABBUlEQVQoz31TWw6DMAzj/rcECW0/G+VNgZLVkdxZSFukqM84dppW53nauq62LEtxrOnbtllKyWDXdbnrXB1WIYCB+75bjNHnNIBxfQdT414FgOM43J/Phx+SFYOwVjAFwT0qcIZghQD4NE3OErJRChqSKhiSqzKODsjLlEo2zI7geZ49kYKlnFBV4BzugNjr+2BN01jXha+k7O/Xy+q6zvudB4M9RiQJIeS43tUwUWEI9HEcCxMyxDmCeA9BnLN+VIF5Rap8CEq/y9GHYN20K/gwBTDGzdq2zfSTX9be07pqO0GqPl5pGwCCNupDlmral/960BkCaBgGd7QNR/4UbaFfv0T3PnwLYbgAiba1AAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/273b0616b21019cd37b6a35489f018d0/8ac56/01-wfp-003.webp 240w,\n/static/273b0616b21019cd37b6a35489f018d0/d3be9/01-wfp-003.webp 480w,\n/static/273b0616b21019cd37b6a35489f018d0/e46b2/01-wfp-003.webp 960w,\n/static/273b0616b21019cd37b6a35489f018d0/63399/01-wfp-003.webp 1276w\"\n              sizes=\"(max-width: 960px) 100vw, 960px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/273b0616b21019cd37b6a35489f018d0/8ff5a/01-wfp-003.png 240w,\n/static/273b0616b21019cd37b6a35489f018d0/e85cb/01-wfp-003.png 480w,\n/static/273b0616b21019cd37b6a35489f018d0/d9199/01-wfp-003.png 960w,\n/static/273b0616b21019cd37b6a35489f018d0/0d98f/01-wfp-003.png 1276w\"\n            sizes=\"(max-width: 960px) 100vw, 960px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/273b0616b21019cd37b6a35489f018d0/d9199/01-wfp-003.png\"\n            alt=\"Illustration of network traffic monitoring by a NIDS\"\n            title=\"Illustration of network traffic monitoring by a NIDS\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>Also, even if communication between endpoints can be monitored to some extent by using a centralized configuration, such as placing network devices in each network segment within the organization, some security challenges still remain.</p>\n<p>One of them is that most major network communication today is encrypted with TLS.</p>\n<p>If traffic is encrypted with TLS, devices placed on the network path cannot inspect the monitored network data, so monitoring or blocking based on the communication contents generally requires decryption and re-encryption of the traffic through a man-in-the-middle (MiTM) approach, often referred to as TLS inspection.</p>\n<p>Another issue is that information collected by network devices on the communication path does not include information about the process (application) on the device that initiated the communication.</p>\n<p>As a result, network-device-based monitoring cannot record information about the process that initiated the communication, making it difficult to analyze or investigate traffic in the context of the application.</p>\n<p>There are also other issues with network-device-based monitoring, such as being unable to monitor cases where endpoints connect by a method that does not pass through the network equipment, or when devices are connected to networks other than the organization’s network, such as during remote work.</p>\n<p>Against the background of issues such as those above with network-device-based NIDS, endpoint-based network monitoring is regarded as an important part of endpoint security measures.</p>\n<p>Endpoint-based network monitoring means analyzing and monitoring the network traffic sent and received by a device using services running on the endpoint itself, rather than network equipment on the communication path.</p>\n<p>Compared with network-device-based approaches, endpoint-based network monitoring generally has the following advantages.</p>\n<ul>\n<li>It can analyze packet data on the endpoint before encryption or after decryption</li>\n<li>It can filter and monitor communication using application context</li>\n<li>It can monitor the device’s communication regardless of the network or communication path to which the device is connected</li>\n</ul>\n<p>These endpoint-based network monitoring capabilities are provided by various types of software, including Antivirus, EDR, and other network monitoring products.</p>\n<p>And the primary platform that such software uses to implement endpoint-based network monitoring on Windows is WFP, which this book explains.</p>\n<h2 id=\"wfp-architecture\" style=\"position:relative;\"><a href=\"#wfp-architecture\" aria-label=\"wfp architecture permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>WFP Architecture</h2>\n<p>In this section, I explain the mechanism by which WFP performs filtering and monitoring of network communication.</p>\n<p>The figure below shows the architecture of WFP-related components described in Microsoft’s public documentation.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 698px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/3c134abd02766189b253ab0509a587e8/487bb/01-wfp-001.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 122.49999999999999%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAZCAIAAAC+dZmEAAAACXBIWXMAAAsTAAALEwEAmpwYAAACmElEQVQ4y33U6U5bQQwF4Pv+z4SEhAoCxCJBxR7WsCUEyAokIemXOWlEq1L/mPjaPvaxx5NqMplMp9OXl5eDg4NarXZ1dUU5PT09OTnZ29vzeXl5GcvFxQW9VmQ4HEJV0yJSjEajj4+P8Xj8+fkZRcSoCIUln5T39/eUnIMjYA8PD9fX181mc5F0+r38Dd7f319aWnKen59jfnd39/T0JJeTThHzbzCqujo+Pj47O9va2lpZWanX680iwHrG639gbsibm5ujoyMDA3h8fLy9vWXPKeZbsLGr9vz8vGALfH9/32q1gH3+AUbD9MyQYjxgbkIo/imreSOUlAXYwBezrN7e3n4U6ff7HGDdbncwGIhDQTVIlRcsQoT0er0Z+GcR1k6noyv3OSmyuKrX11eJuGCMw+bIqEYllKnRaKCXHUpXumi32wCQi9tWqV1EGewqodw+GkUkZs0aaYSrX2RQRDWuMBJQRcvt+bYJmpFbhzBCYUwRVeOgiAkvLKoMeXFVmYqCrSLmFJ6m7QTOtOeVNWmk0iuYIjB0DJ3A3d+iNWe64BJZpeG8mOTDBx0WOm/eE8v4iwiWokLSW9VqmmFNP+bMZVUpvEK/PrI5bc24NBEURXBOb3lDOnIFAQugG4qzU6TqFcnVSUZHUmWXr0M3zwWMhUVaX1/f3Nzc2NjwWmf3nEnwyadD6TM2g2T0sGQBzs6vrq4uLy9vb28jK35WGZPsMJ5qagl5C6d/ML1IZD2x2N3d9c5ltEsmNZu2H1khNZZW0y1SCsoOyX54eIj22toa2nlqs8oZRm6FSS6W0NnZ2YHEMHvOqz67XubTVpZVhzhnZqLzJPyfKJ4/Ay5cJI0ye1U++IIcFskCsKipvTzGbEHuORtNfgG25HecvvWqZAAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/3c134abd02766189b253ab0509a587e8/8ac56/01-wfp-001.webp 240w,\n/static/3c134abd02766189b253ab0509a587e8/d3be9/01-wfp-001.webp 480w,\n/static/3c134abd02766189b253ab0509a587e8/d1b7f/01-wfp-001.webp 698w\"\n              sizes=\"(max-width: 698px) 100vw, 698px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/3c134abd02766189b253ab0509a587e8/8ff5a/01-wfp-001.png 240w,\n/static/3c134abd02766189b253ab0509a587e8/e85cb/01-wfp-001.png 480w,\n/static/3c134abd02766189b253ab0509a587e8/487bb/01-wfp-001.png 698w\"\n            sizes=\"(max-width: 698px) 100vw, 698px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/3c134abd02766189b253ab0509a587e8/487bb/01-wfp-001.png\"\n            alt=\"WFP architecture\"\n            title=\"WFP architecture\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>As mentioned earlier, WFP is broadly composed of the following components.</p>\n<ul>\n<li>Filter Engine</li>\n<li>Base Filtering Engine (BFE)</li>\n<li>Shim</li>\n<li>Callout driver</li>\n</ul>\n<h3 id=\"filter-engine\" style=\"position:relative;\"><a href=\"#filter-engine\" aria-label=\"filter engine permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Filter Engine</h3>\n<p>The WFP filter engine is a component for performing tasks such as filtering network data, and it exists in both user mode and kernel mode. (UM Filter Engine and KM Filter Engine in the architecture diagram)</p>\n<p>The filter engine includes multiple filtering layers mapped to the layers of the Windows network stack.</p>\n<p>In particular, on the network and transport layers of the TCP/IP stack, which are important in the security context covered in this book, filter processing and the invocation of Callout functions are handled by kernel-mode components.<sup id=\"fnref-6\"><a href=\"#fn-6\" class=\"footnote-ref\">6</a></sup></p>\n<h3 id=\"filtering-layers-and-sublayers\" style=\"position:relative;\"><a href=\"#filtering-layers-and-sublayers\" aria-label=\"filtering layers and sublayers permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Filtering Layers and Sublayers</h3>\n<p>A filtering layer (layer) is a container managed by the filter engine and has the function of organizing filters as a set.<sup id=\"fnref-7\"><a href=\"#fn-7\" class=\"footnote-ref\">7</a></sup></p>\n<p>Each layer, which is managed by an internally assigned GUID, defines the kinds of filters that can be added to that layer.<sup id=\"fnref-8\"><a href=\"#fn-8\" class=\"footnote-ref\">8</a></sup></p>\n<p>In addition, each layer is divided into sublayers and evaluated according to the priority (weight) of the sublayers.\nIn addition to the sublayers built into the system by default, developers can also add and define their own.</p>\n<h3 id=\"filter\" style=\"position:relative;\"><a href=\"#filter\" aria-label=\"filter permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Filter</h3>\n<p>A filter is a rule that is matched against received or transmitted packets, streams, events, and so on, and it tells the filter engine how to handle packets, such as blocking traffic that matches certain conditions or invoking a Callout function.</p>\n<h3 id=\"base-filtering-engine-bfe\" style=\"position:relative;\"><a href=\"#base-filtering-engine-bfe\" aria-label=\"base filtering engine bfe permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Base Filtering Engine (BFE)</h3>\n<p>The Base Filtering Engine (BFE) is a user-mode service that coordinates the WFP components.</p>\n<p>BFE implements the user-mode API of WFP, manages the platform, and communicates with kernel-mode components.<sup id=\"fnref-9\"><a href=\"#fn-9\" class=\"footnote-ref\">9</a></sup></p>\n<p>The primary tasks of BFE are adding and deleting filters from the system, storing filter configuration, and enforcing WFP configuration security.<sup id=\"fnref-10\"><a href=\"#fn-10\" class=\"footnote-ref\">10</a></sup></p>\n<p>As explained in detail from Chapter 2 onward, applications use the WFP API to request operations from BFE, such as registering filters.</p>\n<h3 id=\"shim\" style=\"position:relative;\"><a href=\"#shim\" aria-label=\"shim permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Shim</h3>\n<p>A Shim is a kernel component that performs “Classifying” for one or more filtering layers.<sup id=\"fnref-11\"><a href=\"#fn-11\" class=\"footnote-ref\">11</a></sup></p>\n<p>A Shim is positioned between the network stack and the filter engine. As packets, streams, and events pass through the network stack, the Shim analyzes them, extracts conditions and values that can be classified, and then calls the filter engine to compare them with filters in a specific layer.</p>\n<p>Based on the results of that matching, it allows or blocks specific network traffic in the corresponding network stack.</p>\n<p>Put simply, a Shim is a component that provides the WFP filter engine with visibility into packets passing through the Windows network stack.</p>\n<p>The following summarizes the flow in which the corresponding Shim determines an action for a packet passing through the network stack based on the result of WFP filter matching.<sup id=\"fnref-12\"><a href=\"#fn-12\" class=\"footnote-ref\">12</a></sup></p>\n<ol>\n<li>A packet enters the network stack.</li>\n<li>The network stack identifies and invokes the appropriate Shim.</li>\n<li>The Shim invokes the “Classifying” process at a specific layer.</li>\n<li>During the classification process, registered filters are matched and an action is determined according to the result.</li>\n<li>If the classification process matches a Callout filter, the corresponding Callout function is invoked.</li>\n<li>Based on the final filtering decision, the Shim performs operations such as dropping the packet.</li>\n</ol>\n<h3 id=\"callout-driver\" style=\"position:relative;\"><a href=\"#callout-driver\" aria-label=\"callout driver permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Callout driver</h3>\n<p>A Callout driver extends WFP’s filtering functionality by registering custom Callout functions with kernel-mode filtering layers in the filter engine.<sup id=\"fnref-13\"><a href=\"#fn-13\" class=\"footnote-ref\">13</a></sup></p>\n<p>WFP Callouts support detailed analysis and modification of packets, and they are also used by security software such as Antivirus.</p>\n<h3 id=\"filtering-layers-and-filters\" style=\"position:relative;\"><a href=\"#filtering-layers-and-filters\" aria-label=\"filtering layers and filters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Filtering Layers and Filters</h3>\n<p>A filtering layer (layer) is a container managed by the filter engine and has the function of organizing filters as a set.\nAlso, each layer, which is managed by an internally assigned GUID, defines the kinds of filters that can be added to that layer.</p>\n<p>There are multiple filtering layers depending on the corresponding network stack.</p>\n<p>The following are examples of major WFP filtering layers.</p>\n<ul>\n<li>Inbound/Outbound ALE layers</li>\n<li>Stream/Datagram layers</li>\n<li>Inbound/Outbound Transport layers</li>\n<li>Inbound/Outbound IP layers</li>\n</ul>\n<p>For example, when a device makes a TCP connection using IPv4, the TCP connection request is first inspected by the outbound ALE layer (<code class=\"language-text\">FWPM_LAYER_ALE_AUTH_CONNECT_V4</code>).<sup id=\"fnref-14\"><a href=\"#fn-14\" class=\"footnote-ref\">14</a></sup>\n(The ALE layers support filtering in the application context and are extremely important layers for endpoint security use cases.)</p>\n<p>If the TCP connection request passes the ALE layer, the SYN packet is inspected in order by the outbound Transport layer (<code class=\"language-text\">FWPM_LAYER_OUTBOUND_TRANSPORT_V4</code>) and the outbound IP layer (<code class=\"language-text\">FWPM_LAYER_OUTBOUND_IPPACKET_V4</code>) before it is sent.<sup id=\"fnref-15\"><a href=\"#fn-15\" class=\"footnote-ref\">15</a></sup></p>\n<p>Data sent after the TCP connection is established is also inspected at the Stream layer (<code class=\"language-text\">FWPM_LAYER_STREAM_V4</code>), as well as the outbound Transport and IP layers.</p>\n<p>Developers can register filters in the appropriate filtering layers according to their goals and use cases.</p>\n<p>However, because filters are components that can be added by various applications, situations can arise where filters specifying conflicting handling (permit or block) for specific communication are applied at the same time.</p>\n<p>For that reason, WFP defines logic called “Filter Arbitration” to determine the final verdict.<sup id=\"fnref-16\"><a href=\"#fn-16\" class=\"footnote-ref\">16</a></sup></p>\n<p>The following are particularly important factors in how Filter Arbitration makes the final decision.</p>\n<ul>\n<li>The priority of the sublayers assigned to each filtering layer (also called Weight)</li>\n<li>The handling defined by the filters assigned to each sublayer (permit/block, and so on)</li>\n<li>The priority (Weight) of the filters assigned to each sublayer</li>\n<li>Whether override permissions such as <code class=\"language-text\">FWPS_RIGHT_ACTION_WRITE</code> are allowed</li>\n</ul>\n<p>This book does not cover the detailed patterns by which communication is permitted or blocked by the Filter Arbitration logic, but the decision logic at a given filtering layer is basically as follows.</p>\n<ol>\n<li>A layer is divided into sublayers, and network traffic is evaluated in descending order of sublayer priority (Weight).</li>\n<li>Within each sublayer, filters whose conditions match are evaluated in descending order of Weight.</li>\n<li>As matching filters in a sublayer are evaluated, once “Permit” or “Block” is returned, evaluation of the remaining filters in that sublayer is skipped, and the action of the last evaluated filter becomes the result for that sublayer. (A filter may also return “Continue”.)</li>\n<li>For the layer as a whole, the final action is determined by aggregating the results from each sublayer.</li>\n<li>Whether overriding is allowed can be controlled for each filter. <code class=\"language-text\">FWPS_RIGHT_ACTION_WRITE</code> and <code class=\"language-text\">FWPM_FILTER_FLAG_CLEAR_ACTION_RIGHT</code> are used to perform “soft” or “hard” permit/block behavior.\nFor example, a “soft block” may be overwritten by a permit action in another sublayer, but a “hard block” cannot be permitted in a different sublayer, and therefore the block becomes the final verdict.<sup id=\"fnref-17\"><a href=\"#fn-17\" class=\"footnote-ref\">17</a></sup></li>\n</ol>\n<p>The figure below is an illustration of the Filter Arbitration logic quoted from Microsoft’s public documentation.<sup id=\"fnref-18\"><a href=\"#fn-18\" class=\"footnote-ref\">18</a></sup></p>\n<p>Each box inside a layer represents a sublayer, and it shows that after all sublayers in the ALE layer are evaluated, the block action of FW2 (Firewall 2), whose priority as a sublayer is lower than FW1 (Firewall 1), is ultimately used as the final verdict.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 508px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/eb6a47cefb8328049acff04858b9acf3/2fd48/01-wfp-004.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 74.16666666666667%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAIAAABr+ngCAAAACXBIWXMAAAsTAAALEwEAmpwYAAACEUlEQVQoz32T667aMBCE8/7PhMRPjkQP4lLUInEJCQkhV9uJ48QB0i+hRUet1FWE1mOvZ2fWON8+P6fT6WQyWa/X8/n8Y/Yxm81Wq1Xf988x+i/xF+KkaRbHcRAERVGUZRmG4dnzQF5Hq0pHUXQbg0QIWY5xv9/btnXaxlyCIB72bmfX1bp+bXTWmrou8jwM2Q98zzseD2VFWSekqEqVZZmjtU7TVAy0KrgEomCjrLVujCnyQgjxbpIb4VBKceDnj93p5DpN275lWGu7zkopaOP+uEuyQjyfj8vFP7knVsktBgGHNs+zobjrOiTFaSKlaq1lA83w4MKLGSFN2+h6CDpqmgawqiqH7PF46EqXFe2UqADpbMc2y69tg5eKkgoQRb5/cWAwxkhVGvypdZ7l9Hw4HCCHmUPjiPoXPx1jTW0Mznue56BTKnn2/SAM5aBSuEfCrWtDbZZmlHEvXcHs+V4UXWHmasb2u+1rFPm+nxdFkqTe2ccOangC+ZhwOgxCVHC1GgkYJKCDW3hg25YPwUpxpkqSZDBAcVq+NVOAYGRizstOp/8nGJxpDDOztq11DZPrHuMkwRJZCMbC5PI8H9zu/xtcQDuDvYVARTJ+iEJwHCeDYePbGGLgov8/CDlsmPzKGQpsPEfeOk6BO7vdbrFYfB9js9mQg/CvYrndbpfLJUtwfmkEa6NrtN/vm6Zl+Qs93E8tKbyEjAAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/eb6a47cefb8328049acff04858b9acf3/8ac56/01-wfp-004.webp 240w,\n/static/eb6a47cefb8328049acff04858b9acf3/d3be9/01-wfp-004.webp 480w,\n/static/eb6a47cefb8328049acff04858b9acf3/7b066/01-wfp-004.webp 508w\"\n              sizes=\"(max-width: 508px) 100vw, 508px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/eb6a47cefb8328049acff04858b9acf3/8ff5a/01-wfp-004.png 240w,\n/static/eb6a47cefb8328049acff04858b9acf3/e85cb/01-wfp-004.png 480w,\n/static/eb6a47cefb8328049acff04858b9acf3/2fd48/01-wfp-004.png 508w\"\n            sizes=\"(max-width: 508px) 100vw, 508px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/eb6a47cefb8328049acff04858b9acf3/2fd48/01-wfp-004.png\"\n            alt=\"Illustration of Filter Arbitration\"\n            title=\"Illustration of Filter Arbitration\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<h2 id=\"how-to-inspect-information-about-wfp-filters\" style=\"position:relative;\"><a href=\"#how-to-inspect-information-about-wfp-filters\" aria-label=\"how to inspect information about wfp filters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>How to Inspect Information About WFP Filters</h2>\n<p>In this section, I explain how to inspect information about WFP components actually registered in the system and the current state of communication filtering.</p>\n<h3 id=\"using-wfp-explorer\" style=\"position:relative;\"><a href=\"#using-wfp-explorer\" aria-label=\"using wfp explorer permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Using WFP Explorer</h3>\n<p>One of the most effective ways to inspect WFP components registered in the system is to use WFP Explorer.</p>\n<p>WFP Explorer is a GUI tool published by Pavel Yosifovich, who is also an author of <em>Inside Windows, 7th Edition</em>, and can be downloaded from the following repository.</p>\n<p>WFP Explorer</p>\n<p><a href=\"https://github.com/zodiacon/AllTools/blob/master/WFPExp.exe\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://github.com/zodiacon/AllTools/blob/master/WFPExp.exe</a></p>\n<p>By using WFP Explorer, you can intuitively browse various information in a GUI, such as the providers and filters registered in the system. (Depending on the security descriptor specified when an application registers filters and so on, the information may not be shown in tools such as WFP Explorer or in the output of <code class=\"language-text\">netsh</code> commands.)</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 960px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/e89d650c359a34463a15b853f452088d/0d98f/01-wfp-005.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 47.5%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAABYlAAAWJQFJUiTwAAABmklEQVQoz21Sa4+CMBDk//+1+3IfLjFnVEpbKqW8RB6i1Lndgp4Xr8nQ0sDs7MxG2fGINE3Bu9YpulOLefa43wFPAMKD3u8r+GY5e+8Dbrcbrtdr2KM8L7FJLJLcYZeW0J8fKFMB07TQzqKlAnVdY15/9LflRyb8b0VKpVDWwZYliuaEoiiQuxJSxNhuvqBMjsIVqJoadVWhKzNUZYWmadDUDS6XC/q+D/vsZ0RGK1hrcTQmIEkSInTIbQ5xSDBdpmfLvwYgEDoqxPdMyK0HhVIISKWhpIKISdX2G5LOhnw97PZwZAX78+ojr4KKWirKi9UtPpKHWkoKxUATqSa1MZFySI4+liLBnki7c/dGOA4jWVAHZcMwkOJTQKSpRVbECpVSOBzikHa+EopYoO/6v22/BMLnRwdLKETIClkVIyZCQ14+CPm974fwsfcvCscR51V5UEgB8V3wMKNQ2DNWyC1rrYmQRmlV2Lbnt/EYqMg0TU9yDoaVRjIoXMgYHIyhIbdZRimLQMpIyWP2jGdyIewDyUPhieaVw/kB34v6dKH0LHUAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/e89d650c359a34463a15b853f452088d/8ac56/01-wfp-005.webp 240w,\n/static/e89d650c359a34463a15b853f452088d/d3be9/01-wfp-005.webp 480w,\n/static/e89d650c359a34463a15b853f452088d/e46b2/01-wfp-005.webp 960w,\n/static/e89d650c359a34463a15b853f452088d/63399/01-wfp-005.webp 1276w\"\n              sizes=\"(max-width: 960px) 100vw, 960px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/e89d650c359a34463a15b853f452088d/8ff5a/01-wfp-005.png 240w,\n/static/e89d650c359a34463a15b853f452088d/e85cb/01-wfp-005.png 480w,\n/static/e89d650c359a34463a15b853f452088d/d9199/01-wfp-005.png 960w,\n/static/e89d650c359a34463a15b853f452088d/0d98f/01-wfp-005.png 1276w\"\n            sizes=\"(max-width: 960px) 100vw, 960px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/e89d650c359a34463a15b853f452088d/d9199/01-wfp-005.png\"\n            alt=\"Browsing the list of providers in WFP Explorer\"\n            title=\"Browsing the list of providers in WFP Explorer\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>This information can also be inspected using the <code class=\"language-text\">netsh wfp</code> commands described later, but WFP Explorer is more suitable when you want to quickly check information such as filters.</p>\n<h3 id=\"using-the-netsh-wfp-command\" style=\"position:relative;\"><a href=\"#using-the-netsh-wfp-command\" aria-label=\"using the netsh wfp command permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Using the <code class=\"language-text\">netsh wfp</code> Command</h3>\n<p>The <code class=\"language-text\">netsh wfp</code> command is a tool provided for WFP management and troubleshooting.<sup id=\"fnref-19\"><a href=\"#fn-19\" class=\"footnote-ref\">19</a></sup></p>\n<p>The <code class=\"language-text\">netsh wfp</code> command has various options, but the commands used especially in this book are summarized below.</p>\n<h3 id=\"netsh-wfp-show-state\" style=\"position:relative;\"><a href=\"#netsh-wfp-show-state\" aria-label=\"netsh wfp show state permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code class=\"language-text\">netsh wfp show state</code></h3>\n<p>The following command outputs the current state of WFP and IPsec to a file.</p>\n<p>By replacing the file path portion with <code class=\"language-text\">-</code>, as in <code class=\"language-text\">netsh wfp show state file=-</code>, the result can also be output to the console, but because the amount of data is large, it is usually saved to a file and then inspected.</p>\n<div class=\"gatsby-highlight\" data-language=\"powershell\"><pre class=\"language-powershell\"><code class=\"language-powershell\">netsh wfp show state file=<span class=\"token operator\">%</span>USERPROFILE%\\Downloads\\wfpstate<span class=\"token punctuation\">.</span>xml</code></pre></div>\n<p>The XML output by this command consists of elements like the following, and you can inspect information such as providers and sublayers.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 805px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/ae610aa2e9af0b6fd7949239b7eaf48e/c946b/01-wfp-006.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 58.333333333333336%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAACXBIWXMAABYlAAAWJQFJUiTwAAACGklEQVQoz32SW4ucQBCF/f8/Jm/JayAPgUDCksDsOF7Hyzi2d+211ZnWk2MPybIkrPBR3UVXeepiPf34CvfpM/xfX5AePyH6+Q1NkaMtS5SiRiVaNDy3RWFskTWEvqo2vv1dXez+jtaH5fhn2E6AIPRwTT8gvcyQeYOlriCbEX19w9z1uDUVJlIlE+p0wUTfUha48Z1qWtSJpv0IK4ljnM8h4jjCNAFdB8QpIEqgKhSyc4DymuGS5LikAmUlUDclsusVg9TkEaMYu39WEATwPR++72MYWlSlguOMiM8SMoygTgc0rMD7LnFNFMZpxDi+4EWSl9EgJa3c/SOs4/EIz/OYMEBN+Wna43Tq4LodUl9AOBFK9wxxTJCfclRX9jbv0feE0vr+lY5363A4wHFdo1DKHkLMsG2qdGckoUTh5hiiFJ2foXJqDDUTtTOmeWKL/sWybdski6KICQdUleJ5JApJMlLxyD/vpc6GaVJkL08ZlHqLUehSYRiG5nFdr7zf2YY7J38355C2aTWWboAWwky2yxdugYZe77jfX7Hsk419MDttWyFnfzzv0UOXNgg6XC6PHrXdo0/vYT0/P3OqDoMuDLrRrlSkkWUr7yu0XrFtf9BYV6K18a8761v+lhxzH5vmBq4XkwG5ABMCy8IdUzA7Os9gEN79zFD2tdkVKqVZ9p5wY+kbl3fjoDbu58OO40ZlG8M2qv0/vwGz4Io7Wfh40wAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/ae610aa2e9af0b6fd7949239b7eaf48e/8ac56/01-wfp-006.webp 240w,\n/static/ae610aa2e9af0b6fd7949239b7eaf48e/d3be9/01-wfp-006.webp 480w,\n/static/ae610aa2e9af0b6fd7949239b7eaf48e/82ef0/01-wfp-006.webp 805w\"\n              sizes=\"(max-width: 805px) 100vw, 805px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/ae610aa2e9af0b6fd7949239b7eaf48e/8ff5a/01-wfp-006.png 240w,\n/static/ae610aa2e9af0b6fd7949239b7eaf48e/e85cb/01-wfp-006.png 480w,\n/static/ae610aa2e9af0b6fd7949239b7eaf48e/c946b/01-wfp-006.png 805w\"\n            sizes=\"(max-width: 805px) 100vw, 805px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/ae610aa2e9af0b6fd7949239b7eaf48e/c946b/01-wfp-006.png\"\n            alt=\"State of WFP\"\n            title=\"State of WFP\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<h3 id=\"netsh-wfp-show-filters\" style=\"position:relative;\"><a href=\"#netsh-wfp-show-filters\" aria-label=\"netsh wfp show filters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code class=\"language-text\">netsh wfp show filters</code></h3>\n<p>The following command outputs information about filters that include specified conditions.</p>\n<div class=\"gatsby-highlight\" data-language=\"powershell\"><pre class=\"language-powershell\"><code class=\"language-powershell\">netsh wfp show filters verbose=ON file=<span class=\"token operator\">%</span>USERPROFILE%\\Downloads\\wfpfilters<span class=\"token punctuation\">.</span>xml</code></pre></div>\n<p>For the conditions, you can specify the protocol, local/remote address or port number, application path, user SID, traffic direction, and so on.</p>\n<p>For example, if you want to use the path of the application sending or receiving traffic as a condition, specify the full path of the target application in <code class=\"language-text\">appid</code>, as in the following example.</p>\n<div class=\"gatsby-highlight\" data-language=\"powershell\"><pre class=\"language-powershell\"><code class=\"language-powershell\">netsh wfp show filters verbose=OFF file=<span class=\"token operator\">%</span>USERPROFILE%\\Downloads\\wfpfilters<span class=\"token punctuation\">.</span>xml appid=<span class=\"token string\">\"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe\"</span></code></pre></div>\n<h3 id=\"netsh-wfp-show-netevents\" style=\"position:relative;\"><a href=\"#netsh-wfp-show-netevents\" aria-label=\"netsh wfp show netevents permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code class=\"language-text\">netsh wfp show netevents</code></h3>\n<p>The following command outputs recent network events.</p>\n<p>You can inspect results such as how WFP filters handled network traffic.</p>\n<div class=\"gatsby-highlight\" data-language=\"powershell\"><pre class=\"language-powershell\"><code class=\"language-powershell\">netsh wfp show netevents file=<span class=\"token operator\">%</span>USERPROFILE%\\Downloads\\wfpnetevents<span class=\"token punctuation\">.</span>xml</code></pre></div>\n<p>In the case of <code class=\"language-text\">netevents</code> as well, you can specify conditions such as the protocol, local/remote address or port number, application path, and user SID.</p>\n<h3 id=\"netsh-wfp-capture\" style=\"position:relative;\"><a href=\"#netsh-wfp-capture\" aria-label=\"netsh wfp capture permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code class=\"language-text\">netsh wfp capture</code></h3>\n<p>The following command starts a capture session for network events processed by WFP.</p>\n<p>After starting a capture session by running <code class=\"language-text\">netsh wfp capture start</code>, you can capture events until you run <code class=\"language-text\">netsh wfp capture stop</code>.</p>\n<div class=\"gatsby-highlight\" data-language=\"powershell\"><pre class=\"language-powershell\"><code class=\"language-powershell\">netsh wfp capture <span class=\"token function\">start</span> cab=off file=<span class=\"token operator\">%</span>USERPROFILE%\\Downloads\\wfpdiag\n\nnetsh wfp capture stop</code></pre></div>\n<p>You can inspect network events from the resulting <code class=\"language-text\">wfpdiag.xml</code> generated by this command.</p>\n<p>The following is an excerpt of a drop event contained in <code class=\"language-text\">wfpdiag.xml</code>.</p>\n<div class=\"gatsby-highlight\" data-language=\"xml\"><pre class=\"language-xml\"><code class=\"language-xml\"><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>netEvent</span><span class=\"token punctuation\">></span></span>\n   <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>header</span><span class=\"token punctuation\">></span></span>\n   \t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>timeStamp</span><span class=\"token punctuation\">></span></span>2026-02-11T01:28:57.540Z<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>timeStamp</span><span class=\"token punctuation\">></span></span>\n   \t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>ipVersion</span><span class=\"token punctuation\">></span></span>FWP_IP_VERSION_V4<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>ipVersion</span><span class=\"token punctuation\">></span></span>\n   \t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>ipProtocol</span><span class=\"token punctuation\">></span></span>6<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>ipProtocol</span><span class=\"token punctuation\">></span></span>\n   \t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>localAddrV4</span><span class=\"token punctuation\">></span></span>192.168.52.236<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>localAddrV4</span><span class=\"token punctuation\">></span></span>\n   \t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>remoteAddrV4</span><span class=\"token punctuation\">></span></span>8.8.8.8<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>remoteAddrV4</span><span class=\"token punctuation\">></span></span>\n   \t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>localPort</span><span class=\"token punctuation\">></span></span>50685<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>localPort</span><span class=\"token punctuation\">></span></span>\n   \t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>remotePort</span><span class=\"token punctuation\">></span></span>80<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>remotePort</span><span class=\"token punctuation\">></span></span>\n   \t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>appId</span><span class=\"token punctuation\">></span></span>\n   \t\t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>asString</span><span class=\"token punctuation\">></span></span>\\.d.e.v.i.c.e.\\.h.a.r.d.d.i.s.k.v.o.l.u.m.e.3.\\.p.r.o.g.r.a.m. .f.i.l.e.s. .(.x.8.6.).\\.m.i.c.r.o.s.o.f.t.\\.e.d.g.e.\\.a.p.p.l.i.c.a.t.i.o.n.\\.m.s.e.d.g.e...e.x.e...<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>asString</span><span class=\"token punctuation\">></span></span>\n   \t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>appId</span><span class=\"token punctuation\">></span></span>\n   \t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>header</span><span class=\"token punctuation\">></span></span>\n   <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>type</span><span class=\"token punctuation\">></span></span>FWPM_NET_EVENT_TYPE_CLASSIFY_DROP<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>type</span><span class=\"token punctuation\">></span></span>\n   <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>classifyDrop</span><span class=\"token punctuation\">></span></span>\n   \t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>filterId</span><span class=\"token punctuation\">></span></span>71422<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>filterId</span><span class=\"token punctuation\">></span></span>\n   \t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>layerId</span><span class=\"token punctuation\">></span></span>48<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>layerId</span><span class=\"token punctuation\">></span></span>\n   <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>classifyDrop</span><span class=\"token punctuation\">></span></span>\n   <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>internalFields</span><span class=\"token punctuation\">></span></span>\n   \t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>terminatingFiltersInfo</span> <span class=\"token attr-name\">numItems</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>2<span class=\"token punctuation\">\"</span></span><span class=\"token punctuation\">></span></span>\n   \t\t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>item</span><span class=\"token punctuation\">></span></span>\n   \t\t\t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>filterId</span><span class=\"token punctuation\">></span></span>71422<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>filterId</span><span class=\"token punctuation\">></span></span>\n   \t\t\t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>subLayer</span><span class=\"token punctuation\">></span></span>32768<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>subLayer</span><span class=\"token punctuation\">></span></span>\n   \t\t\t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>actionType</span><span class=\"token punctuation\">></span></span>FWP_ACTION_BLOCK<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>actionType</span><span class=\"token punctuation\">></span></span>\n   \t\t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>item</span><span class=\"token punctuation\">></span></span>\n   \t\t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>item</span><span class=\"token punctuation\">></span></span>\n   \t\t\t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>filterId</span><span class=\"token punctuation\">></span></span>69913<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>filterId</span><span class=\"token punctuation\">></span></span>\n   \t\t\t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>subLayer</span><span class=\"token punctuation\">></span></span>FWPP_SUBLAYER_INTERNAL_FIREWALL_WF<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>subLayer</span><span class=\"token punctuation\">></span></span>\n   \t\t\t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>actionType</span><span class=\"token punctuation\">></span></span>FWP_ACTION_PERMIT<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>actionType</span><span class=\"token punctuation\">></span></span>\n   \t\t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>item</span><span class=\"token punctuation\">></span></span>\n   \t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>terminatingFiltersInfo</span><span class=\"token punctuation\">></span></span>\n   \t<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>policyAppId</span><span class=\"token punctuation\">/></span></span>\n   <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>internalFields</span><span class=\"token punctuation\">></span></span>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>netEvent</span><span class=\"token punctuation\">></span></span></code></pre></div>\n<p>From this event, you can see that communication by <code class=\"language-text\">msedge.exe</code> to port 80 on <code class=\"language-text\">8.8.8.8</code> was dropped, as indicated by <code class=\"language-text\">FWPM_NET_EVENT_TYPE_CLASSIFY_DROP</code>, and that it was evaluated as blocked with <code class=\"language-text\">FWP_ACTION_BLOCK</code> by the filter with filter ID 71422.</p>\n<p>Also, by combining this with information output by <code class=\"language-text\">netsh wfp show state</code> and similar commands, you can verify that the communication was judged to be blocked at the layer with <code class=\"language-text\">layerId</code> 48 (<code class=\"language-text\">FWPM_LAYER_ALE_AUTH_CONNECT_V4</code>) by the filter with <code class=\"language-text\">filterId</code> 71422 (<code class=\"language-text\">Block Edge</code>).</p>\n<h2 id=\"summary\" style=\"position:relative;\"><a href=\"#summary\" aria-label=\"summary permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Summary</h2>\n<p>In this chapter, we confirmed that WFP is a filtering platform built into the Windows network stack and that it is widely used to implement Microsoft Defender Firewall, Antivirus, EDR, and similar products.</p>\n<p>We also organized the roles of WFP’s main components—the Filter Engine, BFE, Shim, and Callout driver—and the relationships among filtering layers, sublayers, and filters, while explaining how the final permit/block verdict is determined based on the priority of sublayers and filters and whether overrides are allowed.</p>\n<p>In the next chapter, I will explain sample code that uses WFP filters from user mode to filter traffic.</p>\n<h2 id=\"table-of-contents\" style=\"position:relative;\"><a href=\"#table-of-contents\" aria-label=\"table of contents permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Table of Contents</h2>\n<ul>\n<li><a href=\"/a-part-of-anti-virus-3-00-en\">Preface</a></li>\n<li><a href=\"/a-part-of-anti-virus-3-01-en\">Chapter 1: Overview and Architecture of WFP</a></li>\n<li><a href=\"/a-part-of-anti-virus-3-02-en\">Chapter 2: Sample That Performs Access Control with WFP</a></li>\n<li><a href=\"/a-part-of-anti-virus-3-03-en\">Chapter 3: Sample That Performs Access Control with a Callout Driver</a></li>\n</ul>\n<div class=\"footnotes\">\n<hr>\n<ol>\n<li id=\"fn-1\">\n<p>WFP Features <a href=\"https://learn.microsoft.com/ja-jp/windows/win32/fwp/about-windows-filtering-platform#wfp-features\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows/win32/fwp/about-windows-filtering-platform#wfp-features</a></p>\n<a href=\"#fnref-1\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-2\">\n<p>Inside Windows, 6th Edition, Vol. 1, p.736 (by Mark E. Russinovich, David A. Solomon, Alex Inescu / translated by Quiip Co., Ltd. / Nikkei BP / 2012)</p>\n<a href=\"#fnref-2\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-3\">\n<p>WFP Architecture <a href=\"https://learn.microsoft.com/ja-jp/windows/win32/fwp/windows-filtering-platform-architecture-overview\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows/win32/fwp/windows-filtering-platform-architecture-overview</a></p>\n<a href=\"#fnref-3\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-4\">\n<p>Inside Windows, 6th Edition, Vol. 1, p.653 (by Mark E. Russinovich, David A. Solomon, Alex Inescu / translated by Quiip Co., Ltd. / Nikkei BP / 2012)</p>\n<a href=\"#fnref-4\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-5\">\n<p>Overview of NDIS driver types <a href=\"https://learn.microsoft.com/ja-jp/windows-hardware/drivers/network/ndis-drivers\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows-hardware/drivers/network/ndis-drivers</a></p>\n<a href=\"#fnref-5\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-6\">\n<p>Filter Engine <a href=\"https://learn.microsoft.com/ja-jp/windows/win32/fwp/windows-filtering-platform-architecture-overview#filter-engine\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows/win32/fwp/windows-filtering-platform-architecture-overview#filter-engine</a></p>\n<a href=\"#fnref-6\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-7\">\n<p>WFP Operation <a href=\"https://learn.microsoft.com/ja-jp/windows/win32/fwp/basic-operation\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows/win32/fwp/basic-operation</a></p>\n<a href=\"#fnref-7\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-8\">\n<p>Filtering conditions available at each filtering layer <a href=\"https://learn.microsoft.com/ja-jp/windows/win32/fwp/filtering-conditions-available-at-each-filtering-layer\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows/win32/fwp/filtering-conditions-available-at-each-filtering-layer</a></p>\n<a href=\"#fnref-8\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-9\">\n<p>Windows Kernel Programming, Second Edition, p.472 (by Pavel Yosifovich / Independently published / 2023)</p>\n<a href=\"#fnref-9\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-10\">\n<p>Base Filtering Engine <a href=\"https://learn.microsoft.com/ja-jp/windows/win32/fwp/windows-filtering-platform-architecture-overview#base-filtering-engine\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows/win32/fwp/windows-filtering-platform-architecture-overview#base-filtering-engine</a></p>\n<a href=\"#fnref-10\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-11\">\n<p>Shims <a href=\"https://learn.microsoft.com/ja-jp/windows/win32/fwp/basic-operation#shims\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows/win32/fwp/basic-operation#shims</a></p>\n<a href=\"#fnref-11\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-12\">\n<p>WFP Operation <a href=\"https://learn.microsoft.com/ja-jp/windows/win32/fwp/basic-operation#wfp-operation-1\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows/win32/fwp/basic-operation#wfp-operation-1</a></p>\n<a href=\"#fnref-12\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-13\">\n<p>Callout Drivers <a href=\"https://learn.microsoft.com/ja-jp/windows/win32/fwp/windows-filtering-platform-architecture-overview#callout-drivers\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows/win32/fwp/windows-filtering-platform-architecture-overview#callout-drivers</a></p>\n<a href=\"#fnref-13\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-14\">\n<p>Packet Inspection Points <a href=\"https://learn.microsoft.com/ja-jp/windows-hardware/drivers/network/packet-inspection-points\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows-hardware/drivers/network/packet-inspection-points</a></p>\n<a href=\"#fnref-14\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-15\">\n<p>TCP Packet Flows <a href=\"https://learn.microsoft.com/ja-jp/windows/win32/fwp/tcp-packet-flows\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows/win32/fwp/tcp-packet-flows</a></p>\n<a href=\"#fnref-15\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-16\">\n<p>Filter Arbitration <a href=\"https://learn.microsoft.com/ja-jp/windows/win32/fwp/filter-arbitration\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows/win32/fwp/filter-arbitration</a></p>\n<a href=\"#fnref-16\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-17\">\n<p>Configurable Override Policy <a href=\"https://learn.microsoft.com/ja-jp/windows/win32/fwp/filter-arbitration#configurable-override-policy\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows/win32/fwp/filter-arbitration#configurable-override-policy</a></p>\n<a href=\"#fnref-17\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-18\">\n<p>Filter Arbitration <a href=\"https://learn.microsoft.com/ja-jp/windows/win32/fwp/filter-arbitration\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows/win32/fwp/filter-arbitration</a></p>\n<a href=\"#fnref-18\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn-19\">\n<p>netsh wfp <a href=\"https://learn.microsoft.com/ja-jp/windows-server/administration/windows-commands/netsh-wfp\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://learn.microsoft.com/ja-jp/windows-server/administration/windows-commands/netsh-wfp</a></p>\n<a href=\"#fnref-19\" class=\"footnote-backref\">↩</a>\n</li>\n</ol>\n</div>","fields":{"slug":"/a-part-of-anti-virus-3-01-en","tagSlugs":["/tag/a-part-of-anti-virus-3-en/","/tag/windows-en/","/tag/win-dbg-en/","/tag/anti-virus-en/","/tag/english/"]},"frontmatter":{"date":"2026-04-11","description":"This is the WEB edition of A PART OF ANTI-VIRUS 3 distributed at Tech Book Fest 20.","tags":["A PART OF ANTI-VIRUS 3 (en)","Windows (en)","WinDbg (en)","AntiVirus (en)","English"],"title":"A PART OF ANTI-VIRUS 3 - Learning Windows Filtering Platform (WFP) from Public Sample Code - (WEB Edition) [Chapter 1: Overview and Architecture of WFP]","socialImage":{"publicURL":"/static/272acc1e889df0e25d89217e89d5fd13/a-part-of-anti-virus-3.png"}}}},"pageContext":{"slug":"/a-part-of-anti-virus-3-01-en"}},"staticQueryHashes":["251939775","401334301","825871152"]}