Quic fixes (#1106)
* QUIC: fix heap-buffer-overflow * TLS: fix parsing of QUIC Transport Parameters
This commit is contained in:
@@ -98,6 +98,12 @@ static uint8_t get_u8_quic_ver(uint32_t version)
|
|||||||
if (version == 0x00000001) {
|
if (version == 0x00000001) {
|
||||||
return 33;
|
return 33;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (version == V_MVFST_22)
|
||||||
|
return 22;
|
||||||
|
if (version == V_MVFST_27 || version == V_MVFST_EXP)
|
||||||
|
return 27;
|
||||||
|
|
||||||
/* "Versions that follow the pattern 0x?a?a?a?a are reserved for use in
|
/* "Versions that follow the pattern 0x?a?a?a?a are reserved for use in
|
||||||
forcing version negotiation to be exercised".
|
forcing version negotiation to be exercised".
|
||||||
It is tricky to return a correct draft version: such number is primarly
|
It is tricky to return a correct draft version: such number is primarly
|
||||||
@@ -876,14 +882,11 @@ static int quic_derive_initial_secrets(uint32_t version,
|
|||||||
err = hkdf_extract(GCRY_MD_SHA256, hanshake_salt_draft_t51,
|
err = hkdf_extract(GCRY_MD_SHA256, hanshake_salt_draft_t51,
|
||||||
sizeof(hanshake_salt_draft_t51),
|
sizeof(hanshake_salt_draft_t51),
|
||||||
cid, cid_len, secret);
|
cid, cid_len, secret);
|
||||||
} else if(is_quic_ver_less_than(version, 22) ||
|
} else if(is_quic_ver_less_than(version, 22)) {
|
||||||
version == V_MVFST_22) {
|
|
||||||
err = hkdf_extract(GCRY_MD_SHA256, handshake_salt_draft_22,
|
err = hkdf_extract(GCRY_MD_SHA256, handshake_salt_draft_22,
|
||||||
sizeof(handshake_salt_draft_22),
|
sizeof(handshake_salt_draft_22),
|
||||||
cid, cid_len, secret);
|
cid, cid_len, secret);
|
||||||
} else if(is_quic_ver_less_than(version, 28) ||
|
} else if(is_quic_ver_less_than(version, 28)) {
|
||||||
version == V_MVFST_27 ||
|
|
||||||
version == V_MVFST_EXP) {
|
|
||||||
err = hkdf_extract(GCRY_MD_SHA256, handshake_salt_draft_23,
|
err = hkdf_extract(GCRY_MD_SHA256, handshake_salt_draft_23,
|
||||||
sizeof(handshake_salt_draft_23),
|
sizeof(handshake_salt_draft_23),
|
||||||
cid, cid_len, secret);
|
cid, cid_len, secret);
|
||||||
@@ -982,6 +985,12 @@ static uint8_t *decrypt_initial_packet(struct ndpi_detection_module_struct *ndpi
|
|||||||
packet_number = pkn32;
|
packet_number = pkn32;
|
||||||
|
|
||||||
offset = pn_offset + pkn_len;
|
offset = pn_offset + pkn_len;
|
||||||
|
if (!(pn_offset + payload_length >= offset + 16)) {
|
||||||
|
NDPI_LOG_DBG(ndpi_struct, "No room for Auth Tag %d %d",
|
||||||
|
pn_offset + payload_length, offset);
|
||||||
|
quic_ciphers_reset(&ciphers);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
quic_decrypt_message(&ciphers.pp_cipher, &packet->payload[0], pn_offset + payload_length,
|
quic_decrypt_message(&ciphers.pp_cipher, &packet->payload[0], pn_offset + payload_length,
|
||||||
offset, first_byte, pkn_len, packet_number, &decryption);
|
offset, first_byte, pkn_len, packet_number, &decryption);
|
||||||
|
|
||||||
|
|||||||
@@ -1474,7 +1474,7 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
#ifdef DEBUG_TLS
|
#ifdef DEBUG_TLS
|
||||||
printf("Client SSL [QUIC TP: Param 0x%x Len %d]\n", (int)param_type, (int)param_len);
|
printf("Client SSL [QUIC TP: Param 0x%x Len %d]\n", (int)param_type, (int)param_len);
|
||||||
#endif
|
#endif
|
||||||
if(s_offset+param_len >= final_offset)
|
if(s_offset+param_len > final_offset)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(param_type==0x3129) {
|
if(param_type==0x3129) {
|
||||||
|
|||||||
Reference in New Issue
Block a user