kex: fix null pointer dereference in diffie_hellman_sha_algo()#1508
Merged
willco007 merged 1 commit intolibssh2:masterfrom Feb 28, 2025
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Warning] This PR is generated by AI
PR Title: Fix NPD in libssh2
PR Description:
libssh2program where an invalid memory access occurred due to dereferencing aNULLpointer. The issue was identified in thediffie_hellman_sha_algofunction withinkex.c.NULLpointer check forsession->hostkeybefore dereferencing it. If the pointer isNULL, a corresponding error is returned, and the function exits gracefully. This fix ensures the program does not attempt to access invalid memory. The patch improves the security and stability of the program by preventing segmentation faults caused by invalid memory access.Sanitizer Report Summary:
The sanitizer detected an invalid memory access error, caused by the program attempting to dereference a
NULLpointer at address0x000000000010. This occurred indiffie_hellman_sha_algowithinkex.c:574:30. The issue propagated through various functions, ultimately causing a segmentation fault.Full Sanitizer Report:
Files Modified:
src/kex.cPatch Validation: The patch has been validated and confirmed to resolve the issue identified in the sanitizer report. Testing with the provided PoC confirmed that the invalid memory access no longer occurs, and no new issues were introduced.
Links: