mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Fix handling of IP packets with bogus IP header lengths
Credit to OSS-Fuzz for discovery https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34711 (Link to details becomes public 30 days after patch release)
This commit is contained in:
parent
f861a194f9
commit
0e34f2e02f
5 changed files with 24 additions and 1 deletions
|
@ -235,6 +235,13 @@ bool IPAnalyzer::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet)
|
||||||
|
|
||||||
packet->proto = proto;
|
packet->proto = proto;
|
||||||
|
|
||||||
|
// Double check the lengths one more time before forwarding this on.
|
||||||
|
if ( packet->ip_hdr->TotalLen() < packet->ip_hdr->HdrLen() )
|
||||||
|
{
|
||||||
|
Weird("bogus_IP_header_lengths", packet);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
switch ( proto ) {
|
switch ( proto ) {
|
||||||
case IPPROTO_NONE:
|
case IPPROTO_NONE:
|
||||||
// If the packet is encapsulated in Teredo, then it was a bubble and
|
// If the packet is encapsulated in Teredo, then it was a bubble and
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
|
#separator \x09
|
||||||
|
#set_separator ,
|
||||||
|
#empty_field (empty)
|
||||||
|
#unset_field -
|
||||||
|
#path weird
|
||||||
|
#open XXXX-XX-XX-XX-XX-XX
|
||||||
|
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p name addl notice peer source
|
||||||
|
#types time string addr port addr port string string bool string string
|
||||||
|
XXXXXXXXXX.XXXXXX - 118.181.144.194 0 136.255.115.116 0 ip_hdr_len_zero - F zeek IP
|
||||||
|
XXXXXXXXXX.XXXXXX - 118.181.144.194 0 136.255.115.116 0 bogus_IP_header_lengths - F zeek IP
|
||||||
|
#close XXXX-XX-XX-XX-XX-XX
|
BIN
testing/btest/Traces/ip-bogus-header-len.pcap
Normal file
BIN
testing/btest/Traces/ip-bogus-header-len.pcap
Normal file
Binary file not shown.
|
@ -2,6 +2,10 @@
|
||||||
# OOB reads in Zeek. It has a number of packets broken in weird ways.
|
# OOB reads in Zeek. It has a number of packets broken in weird ways.
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: gunzip -c $TRACES/trunc/mpls-6in6-broken.pcap.gz | zeek -C -b -r - %INPUT
|
# @TEST-EXEC: gunzip -c $TRACES/trunc/mpls-6in6-broken.pcap.gz | zeek -C -b -r - %INPUT
|
||||||
# @TEST-EXEC: btest-diff weird.log
|
# @TEST-EXEC: mv weird.log mpls-6in6-broken-wierd.log
|
||||||
|
# @TEST-EXEC: btest-diff mpls-6in6-broken-wierd.log
|
||||||
|
# @TEST-EXEC: zeek -C -b -r $TRACES/ip-bogus-header-len.pcap %INPUT
|
||||||
|
# @TEST-EXEC: mv weird.log ip-bogus-header-weird.log
|
||||||
|
# @TEST-EXEC: btest-diff ip-bogus-header-weird.log
|
||||||
|
|
||||||
@load base/frameworks/notice/weird
|
@load base/frameworks/notice/weird
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue