Added fix to harden quic detection and limit it to port 80/443 UDP
This commit is contained in:
@@ -106,8 +106,14 @@ void ndpi_search_quic(struct ndpi_detection_module_struct *ndpi_struct, struct n
|
||||
u_int ver_offs;
|
||||
|
||||
if(packet->udp != NULL) {
|
||||
u_int16_t sport = ntohs(packet->udp->source), dport = ntohs(packet->udp->dest);
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_QUIC, ndpi_struct, NDPI_LOG_DEBUG, "calculating quic over udp.\n");
|
||||
|
||||
if(((packet->payload[0] & 0xF0) != 0)
|
||||
|| (!(sport == 80 || dport == 80 || sport == 443 || dport == 443)))
|
||||
goto exclude_quic;
|
||||
|
||||
// Settings without version. First check if PUBLIC FLAGS & SEQ bytes are 0x0. SEQ must be 1 at least.
|
||||
if ((packet->payload[0] == 0x00 && packet->payload[1] != 0x00) || ((packet->payload[0] & QUIC_NO_V_RES_RSV) == 0))
|
||||
{
|
||||
@@ -148,6 +154,7 @@ void ndpi_search_quic(struct ndpi_detection_module_struct *ndpi_struct, struct n
|
||||
}
|
||||
} else
|
||||
{
|
||||
exclude_quic:
|
||||
NDPI_LOG(NDPI_PROTOCOL_QUIC, ndpi_struct, NDPI_LOG_DEBUG, "exclude quic.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_QUIC);
|
||||
}
|
||||
|
||||
+4
-1
@@ -15,13 +15,16 @@ build_results() {
|
||||
check_results() {
|
||||
for f in $PCAPS; do
|
||||
if [ -f result/$f.out ]; then
|
||||
$READER -q -i pcap/$f -w /tmp/reader.out
|
||||
CMD="$READER -q -i pcap/$f -w /tmp/reader.out"
|
||||
$CMD
|
||||
NUM_DIFF=`diff result/$f.out /tmp/reader.out | wc -l`
|
||||
|
||||
if [ $NUM_DIFF -eq 0 ]; then
|
||||
echo "$f\t OK"
|
||||
else
|
||||
echo "$f\t ERROR"
|
||||
echo "$CMD"
|
||||
diff result/$f.out /tmp/reader.out
|
||||
fi
|
||||
|
||||
/bin/rm /tmp/reader.out
|
||||
|
||||
@@ -1 +1 @@
|
||||
Unknown 413 254874 1
|
||||
Quic 413 254874 1
|
||||
|
||||
Reference in New Issue
Block a user