-
Notifications
You must be signed in to change notification settings - Fork 684
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
Fix vuln OSV-2023-1168 #1697
base: dev
Are you sure you want to change the base?
Fix vuln OSV-2023-1168 #1697
Conversation
void PPP_PPTPLayer::computeCalculateFields() | ||
{ | ||
ppp_pptp_header* header = getPPP_PPTPHeader(); | ||
if (m_DataLen < sizeof(ppp_pptp_header)) | ||
{ | ||
PCPP_LOG_ERROR("Insufficient data length for PPP_PPTP header"); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't that be above the ppp_pptp_header* header = getPPP_PPTPHeader();
line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Emmm,yes. Should be checked at the beginning of the function.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #1697 +/- ##
==========================================
- Coverage 83.16% 83.10% -0.07%
==========================================
Files 277 277
Lines 48193 48204 +11
Branches 9966 9922 -44
==========================================
- Hits 40081 40058 -23
- Misses 7234 7244 +10
- Partials 878 902 +24
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
[Warning] This PR is generated by AI
PR Title: Fix for Heap-Buffer-Overflow Vulnerability in PcapPlusPlus - OSV-2023-1168
PR Description:
pcpp::PPP_PPTPLayer::computeCalculateFields()
function in the PcapPlusPlus project. This issue occurs when the program attempts to access a heap object outside of its allocated memory, specifically trying to write 2 bytes at an offset of 31 bytes, which is beyond the allocated size.m_DataLen
) is sufficient before accessing theppp_pptp_header
structure. If the data length is insufficient, an error is logged and the function exits early, preventing out-of-bounds memory access. This fix improves the security and stability of the program by mitigating the risk of memory corruption due to heap-buffer-overflow.Sanitizer Report Summary:
The AddressSanitizer identified a heap-buffer-overflow in the
pcpp::PPP_PPTPLayer::computeCalculateFields()
function. The program attempted to access 2 bytes at an offset of 31 bytes, which is outside the allocated memory region. The error originated fromPacket++/src/GreLayer.cpp:609
and was called by other functions in the program. The issue stemmed from insufficient bounds checking before accessing the buffer.Full Sanitizer Report:
Files Modified:
Packet++/src/GreLayer.cpp
Patch Validation: The patch has been validated using the provided PoC and resolved the heap-buffer-overflow vulnerability identified in the sanitizer report. No new issues have been introduced.
Links: