Fixed invalid QUIC header parsing

This commit is contained in:
Luca Deri
2017-03-13 14:33:03 +01:00
parent 6bc35b92d3
commit 9962eb1f08
2 changed files with 36 additions and 31 deletions
+6 -2
View File
@@ -81,8 +81,11 @@ void ndpi_search_quic(struct ndpi_detection_module_struct *ndpi_struct,
NDPI_LOG(NDPI_PROTOCOL_QUIC, ndpi_struct, NDPI_LOG_DEBUG, "found QUIC.\n"); NDPI_LOG(NDPI_PROTOCOL_QUIC, ndpi_struct, NDPI_LOG_DEBUG, "found QUIC.\n");
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_QUIC, NDPI_PROTOCOL_UNKNOWN); ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_QUIC, NDPI_PROTOCOL_UNKNOWN);
if(udp_len > quic_hlen + 17 + 4 && if(packet->payload[quic_hlen+12] != 0xA0)
!strncmp((char*)&packet->payload[quic_hlen+17], "CHLO" /* Client Hello */, 4)) { quic_hlen++;
if(udp_len > quic_hlen + 16 + 4) {
if(!strncmp((char*)&packet->payload[quic_hlen+16], "CHLO" /* Client Hello */, 4)) {
/* Check if SNI (Server Name Identification) is present */ /* Check if SNI (Server Name Identification) is present */
for(i=quic_hlen+12; i<udp_len-3; i++) { for(i=quic_hlen+12; i<udp_len-3; i++) {
if((packet->payload[i] == 'S') if((packet->payload[i] == 'S')
@@ -118,6 +121,7 @@ void ndpi_search_quic(struct ndpi_detection_module_struct *ndpi_struct,
} }
} }
} }
}
return; return;
} }
+5 -4
View File
@@ -1,5 +1,6 @@
QUIC 289 191639 3 YouTube 258 178495 1
Google 31 13144 2
1 UDP 192.168.1.7:53859 <-> 216.58.205.66:443 [proto: 188/QUIC][18 pkts/8665 bytes] 1 UDP 192.168.1.7:53859 <-> 216.58.205.66:443 [proto: 188.126/QUIC.Google][18 pkts/8665 bytes][Host: googleads.g.doubleclick.net]
2 UDP 192.168.1.7:54997 <-> 216.58.205.66:443 [proto: 188/QUIC][13 pkts/4479 bytes] 2 UDP 192.168.1.7:54997 <-> 216.58.205.66:443 [proto: 188.126/QUIC.Google][13 pkts/4479 bytes][Host: pagead2.googlesyndication.com]
3 UDP 192.168.1.7:56074 <-> 216.58.198.33:443 [proto: 188/QUIC][258 pkts/178495 bytes] 3 UDP 192.168.1.7:56074 <-> 216.58.198.33:443 [proto: 188.124/QUIC.YouTube][258 pkts/178495 bytes][Host: yt3.ggpht.com]