-
Notifications
You must be signed in to change notification settings - Fork 729
Description
Bug description
Describe the bug
IPReassembly::processPacket(...) function crashes when handling a malformed packet. The payload size indicated in the packet is incorrect - it is far larger than what is actually present. The code does not have a check for correctness of the payload size value in the IP header. That leads to the problem.
I am having trouble adding the PCAP for you to test. Let me know if I can send it through alternate means. Here is the hex dump of the offending packet:
0000 ac 85 3d b9 fe 0d ac 85 3d b9 fd e4 88 47 00 00 ..=.....=....G..
0010 8f 01 4f a6 0f 01 01 04 00 24 00 1d f7 e3 00 00 ..O......$......
0020 00 01 00 00 00 01 ff 03 c0 21 09 14 00 08 43 3e .........!....C>
0030 f2 1d 00 00 00 00 00 00 00 00 00 00 ............
Code example to reproduce
void process(pcpp::RawPacket &raw)
{
pcpp::IPReassembly reassembler ;
pcpp::IPReassembly::ReassemblyStatus status ;
pcpp::Packet parsedPacket(raw, pcpp::UDP) ;
pcpp::Packet *assembled = reassembler.processPacket(&parsedPacket, status) ;
:
:
:
:
}Expected behavior
IP reassembler should return MALFORMED_FRAGMENT.
PcapPlusPlus versions tested on
PcapPlusPlus master branch
Other PcapPlusPlus version (if applicable)
No response
Operating systems tested on
Linux
Other operation systems (if applicable)
No response
Compiler version
GCC 12.3.0
Packet capture backend (if applicable)
libpcap