Page MenuHomeFreeBSD

netinet: Disallow unspecified addresses in ICMP-embedded packets
ClosedPublic

Authored by markj on Mar 6 2023, 10:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 3, 6:14 PM
Unknown Object (File)
Fri, May 3, 5:18 PM
Unknown Object (File)
Fri, May 3, 5:05 PM
Unknown Object (File)
Thu, Apr 25, 10:05 PM
Unknown Object (File)
Mar 17 2024, 2:38 AM
Unknown Object (File)
Jan 7 2024, 2:32 AM
Unknown Object (File)
Jan 7 2024, 2:32 AM
Unknown Object (File)
Jan 7 2024, 2:32 AM

Details

Summary

Reported by: glebius
Reported by: syzbot+981c528ccb5c5534dffc@syzkaller.appspotmail.com

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Mar 6 2023, 10:21 PM
This revision is now accepted and ready to land.Mar 6 2023, 10:30 PM
glebius requested changes to this revision.Mar 8 2023, 5:19 PM

Continuing out discussion that we had before in email. After more thinking on this I'm convinced we should filter this out at ICMP input and don't let it down to TCP/UDP control input method. Any legitimate ICMP in principle is a reaction to a packet that we sent. We never send a packet with zero source address. Let's for a minute imagine that we did! In that case an ICMP reply to this packet should go to zero address. How is it going to reach us in that case? The only absolutely imaginary situation that I can see is that we send from 0.0.0.0 and the closest gateway sends us that packet back wrapped into ICMP and uses layer 2 header to determine where it actually should send it to.

This revision now requires changes to proceed.Mar 8 2023, 5:19 PM

Continuing out discussion that we had before in email. After more thinking on this I'm convinced we should filter this out at ICMP input and don't let it down to TCP/UDP control input method. Any legitimate ICMP in principle is a reaction to a packet that we sent. We never send a packet with zero source address. Let's for a minute imagine that we did! In that case an ICMP reply to this packet should go to zero address. How is it going to reach us in that case? The only absolutely imaginary situation that I can see is that we send from 0.0.0.0 and the closest gateway sends us that packet back wrapped into ICMP and uses layer 2 header to determine where it actually should send it to.

Ok, I will update the patch.

Or I can formulate it other way. The source address in the IP packet embedded into ICMP must be the same as destination address of the outer IP packet. If they are different, the ICMP packet is illegitimate.

Filter out unspecified addresses in the ICMP layer.

This revision is now accepted and ready to land.Mar 13 2023, 2:38 PM