From b3f2b1bb7f90c18a7542ab06acdf26318cdfa6fe Mon Sep 17 00:00:00 2001 From: Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> Date: Mon, 11 Dec 2023 14:53:12 +0100 Subject: STUN: rework extra dissection (#2202) Keep looking for RTP packets but remove the monitoring concept. We will re-introduce a more general concept of "flow in monitoring state" later. The function was disabled by default. Some configuration knobs will be provided when/if #2190 is merged. --- fuzz/fuzz_config.cpp | 15 +-------------- fuzz/fuzz_ndpi_reader.c | 3 --- 2 files changed, 1 insertion(+), 17 deletions(-) (limited to 'fuzz') diff --git a/fuzz/fuzz_config.cpp b/fuzz/fuzz_config.cpp index 0abf63515..afd9367fb 100644 --- a/fuzz/fuzz_config.cpp +++ b/fuzz/fuzz_config.cpp @@ -13,7 +13,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { struct ndpi_detection_module_struct *ndpi_info_mod; struct ndpi_flow_struct flow; u_int8_t protocol_was_guessed; - u_int32_t i, num, num2; + u_int32_t i, num; u_int16_t random_proto, bool_value; int random_value; NDPI_PROTOCOL_BITMASK enabled_bitmask; @@ -36,7 +36,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { 6 + /* files */ ((NDPI_LRUCACHE_MAX + 1) * 5) + /* LRU caches */ 2 + 1 + 4 + /* ndpi_set_detection_preferences() */ - 1 + 3 + 1 + 3 + /* Monitoring */ 7 + /* Opportunistic tls */ 2 + /* Pid */ 2 + /* Category */ @@ -108,18 +107,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ndpi_set_detection_preferences(ndpi_info_mod, static_cast(0xFF), 0xFF); /* Invalid preference */ - if(fuzzed_data.ConsumeBool()) { - ndpi_set_monitoring_state(ndpi_info_mod, NDPI_PROTOCOL_STUN, - fuzzed_data.ConsumeIntegralInRange(0, (1 << 16)), - fuzzed_data.ConsumeIntegralInRange(0, 7)); - ndpi_get_monitoring_state(ndpi_info_mod, NDPI_PROTOCOL_STUN, &num, &num2); - } - - random_proto = fuzzed_data.ConsumeIntegralInRange(0, (1 << 16) - 1); - random_value = fuzzed_data.ConsumeIntegralInRange(0,2); - ndpi_set_monitoring_state(ndpi_info_mod, random_proto, random_value, random_value); - ndpi_get_monitoring_state(ndpi_info_mod, random_proto, &num, &num2); - ndpi_set_opportunistic_tls(ndpi_info_mod, NDPI_PROTOCOL_MAIL_SMTP, fuzzed_data.ConsumeBool()); ndpi_get_opportunistic_tls(ndpi_info_mod, NDPI_PROTOCOL_MAIL_SMTP); ndpi_set_opportunistic_tls(ndpi_info_mod, NDPI_PROTOCOL_MAIL_IMAP, fuzzed_data.ConsumeBool()); diff --git a/fuzz/fuzz_ndpi_reader.c b/fuzz/fuzz_ndpi_reader.c index 5f2d980c5..cd2292e66 100644 --- a/fuzz/fuzz_ndpi_reader.c +++ b/fuzz/fuzz_ndpi_reader.c @@ -74,9 +74,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { ndpi_set_detection_preferences(workflow->ndpi_struct, ndpi_pref_enable_tls_block_dissection, 0 /* unused */); - ndpi_set_monitoring_state(workflow->ndpi_struct, NDPI_PROTOCOL_STUN, - 10, NDPI_MONITORING_STUN_SUBCLASSIFIED); - memset(workflow->stats.protocol_counter, 0, sizeof(workflow->stats.protocol_counter)); memset(workflow->stats.protocol_counter_bytes, 0, -- cgit v1.2.3