-
Notifications
You must be signed in to change notification settings - Fork 674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Heap-buffer-overflow(read) in TLVRecordReader::getNextTLVRecord() with two positions #1129
Comments
I found another bad .pcap file which lead to a heap-buffer-overflow (read) issue in Poc: ASAN says:
|
@seladb sorry for response delay. if it helps, I will check it after this interval |
@jafar75 thanks for your reply! There's no pressure, this issue can wait a week or two until you have some time to look |
@jafar75 do you have time to work on it now? |
@seladb sorry for delay, I will check it in the next 2 days |
investigating the problem... |
@jafar75 any progress on this? |
@seladb very sorry for delay, after some investigation, I realized that pcap files attached to issue are corrupted maybe. when opening with wireshark, the message "The capture file appears to have been cut short in the middle of a packet." Unfortunately, I won't have enough time to work on issue. |
@jafar75 The pcap files attached are generated by fuzzer, so they are corrupted with high probability:). I think you should debug it with debugger or maybe find something. Heap buffer overflow issues usually occur due to unchecked boundary conditions, maybe there're some unchecked bounds in TLVData.h/NflogLayer.h. Hope that helps. |
@jafar75 For example: PcapPlusPlus/Packet++/header/NflogLayer.h Lines 104 to 122 in e96b741
In line 119 m_Data = (NflogTLVRawData*)recordRawData , we assume that recordRawData's real allocated left is less than sizeof NflogTLVRawData(due to corrupted pcap file). Then, when you call getTotalSize in line 104, m_Data->recordLen may point to unallocated memory area, which lead to heap-buffer-overflow. Just for an example, maybe there're more issues in code. I have no idea how to fix these issues more elegantly.🤔
|
The fix by @sashashura was merged to Thanks @bladchan for reporting this issue, and thanks @sashashura for providing the fix! 🙏 🙏 |
Describe the bug
Bad .pcap files which can lead TLVRecordReader::getNextTLVRecord to heap-buffer-overflow (read) issues with two positions: one is in NflogTlv::getType(), the other is in NflogTlv::assign().
Pocs here:
heap_buffer_overflow_pocs.zip
To Reproduce
Expected behavior
The code snippet where the issue happened should avoid the out-bounds read operation.
Environment (please complete the following information):
Additional context
For
poc_assign
, ASAN says:For
poc_gettype
, ASAN says:The text was updated successfully, but these errors were encountered: