nDPI/fuzz
Ze Sheng e3801f4d14
fuzz: reset flow state and populate headers in fuzz_is_stun (#3128)
Fix three issues in the STUN fuzzer that reduce fuzzing effectiveness:

1. ndpi_flow is static and never reset between calls, causing stale
   state from previous inputs to affect subsequent ones. This makes
   fuzzing results non-reproducible and prevents proper per-input
   isolation. Fix: memset flow to zero at the start of each call and
   call ndpi_free_flow_data() at the end for cleanup.

2. iph (IP header) is all zeros, meaning version=0, ihl=0, protocol=0.
   This is not a valid IPv4 header and causes is_stun() to skip
   protocol-specific code paths. Fix: set version=4, ihl=5, and
   protocol=17 (UDP) or 6 (TCP) depending on the build variant.

3. udph/tcph (transport headers) are all zeros, meaning port=0.
   STUN-related code paths check for specific ports. Fix: set source
   and destination ports to 3478 (STUN default).

Since fuzz_is_stun_tcp.c is a symlink to fuzz_is_stun.c, this fix
applies to both UDP and TCP variants via the existing STUN_TCP ifdef.
2026-03-09 11:12:58 +01:00
..
corpus fuzz: add a new fuzzer to test ndpi_match_custom_category() 2026-02-10 13:38:33 +00:00
bd_param.txt fuzz: extend coverage (#2073) 2023-08-20 15:18:19 +02:00
dictionary.dict UBNTAC2,Ookla: improve detection (#2793) 2025-04-10 13:18:44 +02:00
dictionary_tls_certificate.dict fuzz: add a new fuzzer to test TLS certificates (#1901) 2023-03-20 17:00:46 +01:00
fuzz_alg_bins.cpp fuzz: some improvements and add two new fuzzers (#1881) 2023-02-09 20:02:12 +01:00
fuzz_alg_bytestream.c fuzz: extend fuzz coverage (#1888) 2023-02-16 18:04:34 +01:00
fuzz_alg_crc32_md5.c fuzz: fix a warning 2026-02-18 13:33:25 +01:00
fuzz_alg_hll.cpp fuzz: some improvements and add two new fuzzers (#1881) 2023-02-09 20:02:12 +01:00
fuzz_alg_hw_rsi_outliers_da.cpp fuzz: extend fuzzing coverage (#2750) 2025-02-28 12:38:15 +01:00
fuzz_alg_hw_rsi_outliers_da.options fuzz: extend fuzzing coverage (#2205) 2023-12-11 12:48:50 +01:00
fuzz_alg_jitter.cpp fuzz: some improvements and add two new fuzzers (#1881) 2023-02-09 20:02:12 +01:00
fuzz_alg_memmem.cpp fuzz: extend fuzzing coverage 2025-06-24 15:04:35 +02:00
fuzz_alg_quick_encryption.cpp fuzz: improve coverage (#2612) 2024-11-01 18:17:22 +01:00
fuzz_alg_ranking.cpp fuzz: add fuzzer to test ranking algorithm (#3024) 2025-11-09 16:49:35 +01:00
fuzz_alg_ranking.options fuzz: add fuzzer to test ranking algorithm (#3024) 2025-11-09 16:49:35 +01:00
fuzz_alg_ses_des.cpp fuzz: improve fuzzing coverage (#2239) 2024-01-02 15:22:44 +01:00
fuzz_alg_shoco.cpp fuzz: improve fuzzing coverage (#2474) 2024-06-17 13:45:47 +02:00
fuzz_alg_strnstr.cpp fuzz: extend coverage (#2786) 2025-03-31 17:54:14 +02:00
fuzz_binaryfusefilter.cpp fuzz: extend fuzzing coverage 2023-09-16 11:26:11 +02:00
fuzz_common_code.c fuzz: fix configuration loading in fuzz_init_detection_module() 2026-02-10 13:38:33 +00:00
fuzz_common_code.h fuzz: fix configuration loading in fuzz_init_detection_module() 2026-02-10 13:38:33 +00:00
fuzz_community_id.cpp Add some fuzzers to test other data structures. (#1870) 2023-01-25 11:44:59 +01:00
fuzz_config.cpp fuzz: fuzz_config: restore custom logic for memory allocation failure (#3105) 2026-01-27 16:59:49 +01:00
fuzz_config.options fuzz: extend fuzzing coverage (#2750) 2025-02-28 12:38:15 +01:00
fuzz_dga.c fuzz: fix configuration loading in fuzz_init_detection_module() 2026-02-10 13:38:33 +00:00
fuzz_dga.options fuzz: fuzz_dga: set a reasonable limit on entries size 2026-02-17 10:06:42 +01:00
fuzz_ds_address_cache.cpp fuzz: try to improve fuzzing coverage (#2981) 2025-10-06 20:44:31 +02:00
fuzz_ds_ahocorasick.cpp fuzz: improve fuzzing coverage (#2474) 2024-06-17 13:45:47 +02:00
fuzz_ds_ahocorasick.options fuzz: improve fuzzing coverage (#2239) 2024-01-02 15:22:44 +01:00
fuzz_ds_bitmap.cpp fuzz: add new fuzzers for bitmask and filter data structures (#2937) 2025-09-02 16:54:08 +02:00
fuzz_ds_bitmap64_fuse.cpp Added support for roaring bitmap v3 (#2355) 2024-03-25 08:15:19 +01:00
fuzz_ds_btree.cpp fuzz: add 2 new fuzzers for KD-trees and Ball-trees (#2670) 2025-01-13 17:31:45 +01:00
fuzz_ds_cmsketch.cpp fuzz: extend fuzzing coverage (#2052) 2023-07-18 07:41:56 +02:00
fuzz_ds_domain_classify.cpp Extend values saved in hash data structure to u_int64_t (#3013) 2025-10-24 17:58:08 +02:00
fuzz_ds_filter.cpp fuzz: add new fuzzers for bitmask and filter data structures (#2937) 2025-09-02 16:54:08 +02:00
fuzz_ds_hash.cpp Extended ja4 protocol rule with the ability to specify tls blocks (#3125) 2026-02-20 23:15:02 +01:00
fuzz_ds_kdtree.cpp fuzz: add 2 new fuzzers for KD-trees and Ball-trees (#2670) 2025-01-13 17:31:45 +01:00
fuzz_ds_libcache.cpp Add some fuzzers to test other data structures. (#1870) 2023-01-25 11:44:59 +01:00
fuzz_ds_patricia.cpp fuzz: extend fuzzing coverage (#2281) 2024-01-24 21:16:58 +01:00
fuzz_ds_ptree.cpp Small fixes after API cleanup done in c63446e59 (#2449) 2024-05-20 19:06:24 +02:00
fuzz_ds_tree.cpp Disable -Wno-unused-parameter -Wno-unused-function. (#2358) 2024-04-03 14:10:21 +02:00
fuzz_filecfg_categories.c New API to enable/disable protocols; remove ndpi_set_protocol_detection_bitmask2() (#2853) 2025-06-03 09:45:46 +02:00
fuzz_filecfg_category.c New API to enable/disable protocols; remove ndpi_set_protocol_detection_bitmask2() (#2853) 2025-06-03 09:45:46 +02:00
fuzz_filecfg_config.c New API to enable/disable protocols; remove ndpi_set_protocol_detection_bitmask2() (#2853) 2025-06-03 09:45:46 +02:00
fuzz_filecfg_malicious_ja4.c New API to enable/disable protocols; remove ndpi_set_protocol_detection_bitmask2() (#2853) 2025-06-03 09:45:46 +02:00
fuzz_filecfg_malicious_sha1.c Unify ndpi debug logging to always use a u16 protocol id (#2613) 2024-11-11 15:17:33 +01:00
fuzz_filecfg_protocols.c New API to enable/disable protocols; remove ndpi_set_protocol_detection_bitmask2() (#2853) 2025-06-03 09:45:46 +02:00
fuzz_filecfg_risk_domains.c New API to enable/disable protocols; remove ndpi_set_protocol_detection_bitmask2() (#2853) 2025-06-03 09:45:46 +02:00
fuzz_gcrypt_aes.cpp fuzz: extend fuzzing coverage (#2205) 2023-12-11 12:48:50 +01:00
fuzz_gcrypt_cipher.cpp fuzz: improve fuzzing coverage (#2474) 2024-06-17 13:45:47 +02:00
fuzz_gcrypt_gcm.cpp fuzz: extend fuzzing coverage (#2205) 2023-12-11 12:48:50 +01:00
fuzz_gcrypt_light.cpp fuzz: improve fuzzing coverage (#2309) 2024-02-09 19:19:03 +01:00
fuzz_is_stun.c fuzz: reset flow state and populate headers in fuzz_is_stun (#3128) 2026-03-09 11:12:58 +01:00
fuzz_is_stun_tcp.c fuzz: improve per-fuzzer introspector statistics (#2970) 2025-09-21 17:20:45 +02:00
fuzz_libinjection.c fuzz: extend fuzzing coverage 2023-10-15 12:00:26 +02:00
fuzz_match_custom_category.c fuzz: add a new fuzzer to test ndpi_match_custom_category() 2026-02-10 13:38:33 +00:00
fuzz_match_custom_category.options fuzz: add a new fuzzer to test ndpi_match_custom_category() 2026-02-10 13:38:33 +00:00
fuzz_ndpi_reader.c ndpiReader: better memory statistics: malloc vs realloc 2026-03-04 18:27:58 +01:00
fuzz_ndpi_reader_alloc_fail.c fuzz: improve per-fuzzer introspector statistics (#2970) 2025-09-21 17:20:45 +02:00
fuzz_ndpi_reader_alloc_fail.options fuzz: extend fuzzing coverage (#2750) 2025-02-28 12:38:15 +01:00
fuzz_ndpi_reader_nalloc.c fuzz: test *alloc/read/write/recv/send failures via nallocfuzz (#3082) 2026-01-14 15:44:38 +01:00
fuzz_ndpi_reader_payload_analyzer.c fuzz: improve per-fuzzer introspector statistics (#2970) 2025-09-21 17:20:45 +02:00
fuzz_ndpi_reader_payload_analyzer.options fuzz: extend fuzzing coverage 2023-10-15 12:00:26 +02:00
fuzz_ndpi_reader_pl7m.c fuzz: an attempt to get better introspector stats (#2968) 2025-09-16 16:57:05 +02:00
fuzz_ndpi_reader_pl7m.options fuzz: improve fuzzers using pl7m (#2486) 2024-06-29 18:01:05 +02:00
fuzz_ndpi_reader_pl7m_64k.c fuzz: an attempt to get better introspector stats (#2968) 2025-09-16 16:57:05 +02:00
fuzz_ndpi_reader_pl7m_64k.options fuzz: improve fuzzers using pl7m (#2486) 2024-06-29 18:01:05 +02:00
fuzz_ndpi_reader_pl7m_internal.c fuzz: improve per-fuzzer introspector statistics (#2970) 2025-09-21 17:20:45 +02:00
fuzz_ndpi_reader_pl7m_internal.options fuzz: improve fuzzers using pl7m (#2486) 2024-06-29 18:01:05 +02:00
fuzz_ndpi_reader_pl7m_internal_simplest.options fuzz: improve fuzzers using pl7m (#2486) 2024-06-29 18:01:05 +02:00
fuzz_ndpi_reader_pl7m_only_subclassification.c fuzz: improve per-fuzzer introspector statistics (#2970) 2025-09-21 17:20:45 +02:00
fuzz_ndpi_reader_pl7m_randomize_ports.c fuzz: improve per-fuzzer introspector statistics (#2970) 2025-09-21 17:20:45 +02:00
fuzz_ndpi_reader_pl7m_simplest.c fuzz: improve per-fuzzer introspector statistics (#2970) 2025-09-21 17:20:45 +02:00
fuzz_ndpi_reader_pl7m_simplest.options fuzz: improve fuzzers using pl7m (#2486) 2024-06-29 18:01:05 +02:00
fuzz_ndpi_reader_pl7m_simplest_internal.c fuzz: improve per-fuzzer introspector statistics (#2970) 2025-09-21 17:20:45 +02:00
fuzz_process_packet.c fuzz: fix configuration loading in fuzz_init_detection_module() 2026-02-10 13:38:33 +00:00
fuzz_quic_get_crypto_data.c fuzz: fix configuration loading in fuzz_init_detection_module() 2026-02-10 13:38:33 +00:00
fuzz_readerutils_workflow.cpp ndpiReader: better memory statistics: malloc vs realloc 2026-03-04 18:27:58 +01:00
fuzz_serialization.cpp fuzz: extend fuzzing coverage (#2626) 2024-11-20 13:36:41 +01:00
fuzz_tls_certificate.c fuzz: allow allocation failures in fuzz_tls_certificate 2026-02-10 13:38:33 +00:00
ipv4_addresses.txt fuzz: extend fuzzing coverage (#2281) 2024-01-24 21:16:58 +01:00
ipv6_addresses.txt Fix/improve fuzzing (#2426) 2024-05-08 11:46:02 +02:00
Makefile.am fuzz: add a new fuzzer to test ndpi_match_custom_category() 2026-02-10 13:38:33 +00:00
random_list.list fuzz: extend fuzzing coverage 2023-09-16 11:26:11 +02:00
splt_param.txt fuzz: extend coverage (#2073) 2023-08-20 15:18:19 +02:00