Module is easy to crash with an unexpected packet from outside.
This patch weakens the checks from an assert to a silent skip.
PR: 243096
Differential D23091
netgraph/ng_nat: Prevent crash by malformated packets donner on Jan 8 2020, 5:38 PM. Authored by Tags None Referenced Files
Details
Module is easy to crash with an unexpected packet from outside. PR: 243096 Bind module to an external interface as described in the bug report.
Diff Detail
Event Timeline
Comment Actions So this provides some basic validation, but it is not clear what assumptions libalias makes on input packets. Do we also need to verify the IP header checksum? For fragments, do we need to duplicate some of the validation implemented by ip_reass()?
Comment Actions I don't think we should make a habit documenting kernel panics in NEGRAPH code. Such bugs must be fixed, not documented. Comment Actions This patch fixes the (obvious) panic and (as requested in the bug report) documents, that there might be an unexplored rabbit hole of further bugs. Comment Actions
If there is no known case leading to a panic, we should not scare users with manual. It's still bad wording IMO. If there is known vector that may lead to panic, another checks should be added to make sure panic does not happen. Comment Actions I just look this issue up in sys/netinet/libalias/alias.c So the precondition for calling libalias is that the IP packet is pulled completely and has version 4 set Any further tests are unnecessary. Comment Actions I note also that it uses a differential checksum rather than recomputing the entire IP header checksum, so it should not silently hide corrupted packets. Comment Actions I applied this patch and recompiled. I can confirm that I'm no longer seeing a panic for the example configuration in the ng_nat manpage. Im also happy to hear that libalias has the necessary validations. Comment Actions I have no objection to this. I think the checks are cheap enough that they won't hurt, and after spending some time reading libalias I believe they are sufficient. |