Added new risk for NDPI_UNSAFE_PROTOCOL that identifies protocols that are not condidered safe/secure

This commit is contained in:
Luca Deri
2020-08-30 20:48:58 +02:00
parent 647c7d59bb
commit 638624869a
17 changed files with 96 additions and 79 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ typedef enum {
NDPI_SSH_OBSOLETE_SERVER_VERSION_OR_CIPHER,
NDPI_SMB_INSECURE_VERSION,
NDPI_TLS_SUSPICIOUS_ESNI_USAGE,
NDPI_BLACKLISTED_HOST,
NDPI_UNSAFE_PROTOCOL,
/* Leave this as last member */
NDPI_MAX_RISK /* must be <= 31 due to (**) */
+19 -2
View File
@@ -805,7 +805,7 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp
no_master, no_master, "eDonkey", NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT,
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
ndpi_set_proto_defaults(ndpi_str, NDPI_PROTOCOL_UNSAFE, NDPI_PROTOCOL_BITTORRENT, 0 /* can_have_a_subprotocol */,
ndpi_set_proto_defaults(ndpi_str, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_BITTORRENT, 0 /* can_have_a_subprotocol */,
no_master, no_master, "BitTorrent", NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT,
ndpi_build_default_ports(ports_a, 51413, 53646, 0, 0, 0) /* TCP */,
ndpi_build_default_ports(ports_b, 6771, 51413, 0, 0, 0) /* UDP */);
@@ -1303,6 +1303,10 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp
no_master, no_master, "TeamSpeak", NDPI_PROTOCOL_CATEGORY_VOIP,
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
ndpi_set_proto_defaults(ndpi_str, NDPI_PROTOCOL_POTENTIALLY_DANGEROUS, NDPI_PROTOCOL_TOR, 0 /* can_have_a_subprotocol */,
no_master, no_master, "Tor", NDPI_PROTOCOL_CATEGORY_VPN,
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
ndpi_set_proto_defaults(ndpi_str, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_SKINNY, 0 /* can_have_a_subprotocol */,
no_master, no_master, "CiscoSkinny", NDPI_PROTOCOL_CATEGORY_VOIP,
ndpi_build_default_ports(ports_a, 2000, 0, 0, 0, 0) /* TCP */,
@@ -4464,7 +4468,6 @@ static void ndpi_reconcile_protocols(struct ndpi_detection_module_struct *ndpi_s
Skype for a host doing MS Teams means MS Teams
(MS Teams uses Skype as transport protocol for voice/video)
*/
if(flow) {
/* Do not go for DNS when there is an application protocol. Example DNS.Apple */
if((flow->detected_protocol_stack[1] != NDPI_PROTOCOL_UNKNOWN)
@@ -4511,6 +4514,20 @@ static void ndpi_reconcile_protocols(struct ndpi_detection_module_struct *ndpi_s
}
break;
} /* switch */
if(flow) {
switch(ndpi_get_proto_breed(ndpi_str, ret->app_protocol)) {
case NDPI_PROTOCOL_UNSAFE:
case NDPI_PROTOCOL_POTENTIALLY_DANGEROUS:
case NDPI_PROTOCOL_DANGEROUS:
NDPI_SET_BIT(flow->risk, NDPI_UNSAFE_PROTOCOL);
break;
default:
/* Nothign to do */
break;
}
}
}
/* ********************************************************************************* */
+2 -2
View File
@@ -1537,8 +1537,8 @@ const char* ndpi_risk2str(ndpi_risk_enum risk) {
case NDPI_TLS_SUSPICIOUS_ESNI_USAGE:
return("TLS Suspicious ESNI Usage");
case NDPI_BLACKLISTED_HOST:
return("Blacklisted Host");
case NDPI_UNSAFE_PROTOCOL:
return("Unsafe Protocol");
default:
snprintf(buf, sizeof(buf), "%d", (int)risk);