Add ICMP checksum check and set risk if mismatch detected. (#1464)

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
Toni
2022-03-02 13:12:01 +01:00
committed by GitHub
parent 6c4df21238
commit e8559a4127
5 changed files with 42 additions and 0 deletions
+6
View File
@@ -3066,6 +3066,12 @@ u_int16_t ndpi_guess_protocol_id(struct ndpi_detection_module_struct *ndpi_str,
if (NDPI_ENTROPY_ENCRYPTED_OR_RANDOM(flow->entropy) != 0) {
ndpi_set_risk(ndpi_str, flow, NDPI_SUSPICIOUS_ENTROPY);
}
struct ndpi_icmphdr * const icmphdr = (struct ndpi_icmphdr *)packet->payload;
u_int16_t chksm = ndpi_calculate_icmp4_checksum(packet->payload, packet->payload_packet_len);
if (icmphdr->checksum != chksm) {
ndpi_set_risk(ndpi_str, flow, NDPI_MALFORMED_PACKET);
}
}
}
}