فهم شبكات Windows_WFP

  • فهم شبكات Windows_WFP

فهم شبكات Windows

  • فهم شبكات Windows

WFP

شرح المصطلحات

https://learn.microsoft.com/en-us/windows/win32/fwp/object-model https://learn.microsoft.com/en-us/windows/win32/fwp/basic-operation https://learn.microsoft.com/en-us/windows-hardware/drivers/network

callout: A callout provides functionality that extends the capabilities of the Windows Filtering Platform. A callout consists of a set of callout functions and a GUID key that uniquely identifies the callout. callout driver: A callout driver is a driver that registers callouts with the Windows Filtering Platform. A callout driver is a type of filter driver. callout function: A callout function is a function that is called by the Windows Filtering Platform to perform a specific task. A callout function is associated with a callout. filter: A filter is a set of functions that are called by the Windows Filtering Platform to perform filtering operations. A filter consists of a set of filter functions and a GUID key that uniquely identifies the filter. filter engine: The filter engine is the component of the Windows Filtering Platform that performs filtering operations. The filter engine is responsible for calling the filter functions that are registered with the Windows Filtering Platform. filter layer: A filter layer is a set of functions that are called by the Windows Filtering Platform to perform filtering operations. A filter layer consists of a set of filter layer functions and a GUID key that uniquely identifies the filter layer.

يتم تشغيل ردود النداء (callbacks) لطابور الموزع (Dispatcher queue) في أسرع وقت ممكن، دون الحاجة إلى انتظار امتلاء الطابور، مما يلبي متطلبات الوقت الفعلي. عندما يكون رد نداء المستخدم بطيئًا، يتم إدراج الحزم المحجوبة في الطابور التالي قدر الإمكان، مع حد أقصى للطابور يبلغ 256. يتم تخزين الحزم المحجوبة الإضافية مؤقتًا من قبل النظام، وقدرة التخزين المؤقت في الاختبار التقريبي هي 16500، وقد تختلف قدرة التخزين المؤقت للنظام بناءً على أداء الآلة وتكوينها. عند معالجة رد نداء المستخدم للحزم، توجد نسختان من كيان الحزمة: حزمة النواة، يتم تحريرها بالكامل بعد أن ينتهي رد النداء من معالجة الطابور. لذلك، عندما يكون رد النداء بطيئًا، سيؤدي تنفيذ رد النداء الواحد إلى قفل قدرة تخزين النظام بما يصل إلى 256 حزمة. النسخة الموجودة في رد النداء، يتم تحريرها فورًا بعد معالجة حزمة واحدة.

في FwppNetEvent1Callback، يتم تجميع نسخة من الحزمة، ولا يتم التعامل مع الحزمة الأصلية، مما لا يؤثر على العملية التجارية.

يمكن للاشتراكات استخدام مرشحات القوالب (Template filters) لتقليل عدد الحزم التي تحتاج إلى المعالجة:

https://learn.microsoft.com/en-us/windows/win32/api/fwpmtypes/ns-fwpmtypes-fwpm_net_event_enum_template0

filterCondition

An array of FWPM_FILTER_CONDITION0 structures that contain distinct filter conditions (duplicated filter conditions will generate an error). All conditions must be true for the action to be performed. In other words, the conditions are AND’ed together. If no conditions are specified, the action is always performed.

لا يمكن استخدام نفس المرشح (Filter) العلاقة بين جميع المرشحات هي “AND” (و)، مما يعني ضرورة استيفاء جميع الشروط. توثيق مايكروسوفت يشير إلى وجود ثمانية أنواع من المرشحات المدعومة، ولكن في الواقع هناك مرشحات مدعومة أكثر من ذلك.

FWPM_CONDITION_IP_PROTOCOL

The IP protocol number, as specified in RFC 1700. FWPM_CONDITION_IP_LOCAL_ADDRESS

The local IP address. FWPM_CONDITION_IP_REMOTE_ADDRESS

The remote IP address. FWPM_CONDITION_IP_LOCAL_PORT

The local transport protocol port number. For ICMP, the message type. FWPM_CONDITION_IP_REMOTE_PORT

The remote transport protocol port number. For ICMP, the message code. FWPM_CONDITION_SCOPE_ID

The interface IPv6 scope identifier. Reserved for internal use. FWPM_CONDITION_ALE_APP_ID

The full path of the application. FWPM_CONDITION_ALE_USER_ID

The identification of the local user. عند تعداد الاشتراكات المسجلة في النظام، تم العثور على اشتراكين اثنين، وبالنظر إلى مفتاح الجلسة (GUID) الخاص بهما، لا يمكن تأكيد من قام بتسجيلهما. عند تحليلهما، تبين أن كل اشتراك ينفذ الوظائف التالية:

اشترك في جميع الحزم من نوع FWPM_NET_EVENT_TYPE_CLASSIFY_DROP، وقام بإحصاء جميع الحزم التي تم إسقاطها. اشترك في جميع الحزم من نوع FWPM_NET_EVENT_TYPE_CLASSIFY_ALLOW، ويمكن استخدامه لإجراء إحصائيات حركة المرور. شرط المرشح (condition filter) المستخدم في هذين الاشتراكين هو FWPM_CONDITION_NET_EVENT_TYPE (206e9996-490e-40cf-b831-b38641eb6fcb)، مما يشير إلى أن مرشحات التصفية المتاحة لا تقتصر على الثمانية المذكورة في توثيق مايكروسوفت.

أظهرت الأبحاث الإضافية أن واجهة استدعاء وضع المستخدم يمكنها فقط التقاط أحداث الإسقاط (drop events)، بينما تتطلب الأحداث غير الإسقاط استخدام وضع النواة للحصول عليها. لذلك، لا يمكن للعزل الدقيق (Micro-segmentation) استخدام FWPM_CONDITION_NET_EVENT_TYPE للحصول على الأحداث.