Address possible vulnerability in preauth lengths in hybrid KEM#2
Draft
alharrison wants to merge 1 commit intoOQS-v10from
Draft
Address possible vulnerability in preauth lengths in hybrid KEM#2alharrison wants to merge 1 commit intoOQS-v10from
alharrison wants to merge 1 commit intoOQS-v10from
Conversation
Signed-off-by: Alexander Harrison <Alexander.R.Harrison@gmail.com>
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.
Martin Ramkellyn (martin-r-dev) found during an AI-assisted exploration into crafting malformed packets to exploit an SSH server.
The use of the blob does not ensure proper lengths before being passed into the KEM handling code. This allows a possible underflow.
Example that would generate the underflow:
client_blob_len = 1567
kem->length_public_key = 1568
ecdh_part_len = 1567 - 1568 = 18446744073709551615 (size_t wrap)
Cases that Martin tested with his crafted script:
All cases below refer to message-30 (
SSH2_MSG_KEX_ECDH_INIT) mutation formlkem1024nistp384-sha384.q_c_lenq_c_blobbytes sentincomplete message [preauth]OQS_KEM_encapsfails, handshake aborts, no underflow traceOQS_KEM_encapsmay succeed; split underflow path observed; pre-auth allocation failure and connection abortAdditional local observations:
799repeatedly showed encapsulation failure.1535and1540repeatedly showed encapsulation success followed by downstream failure on malformed split handling.1567is a deterministic underflow demonstration (ec_lenwrap).What was observed: