# libFuzzer targets for every boundary that parses untrusted or # attacker-influenced input. Build with clang: # CC=clang CXX=clang++ meson setup build/fuzz -Denable_fuzzing=true -Denable_app=disabled # nice -n 19 ninja -C build/fuzz -j2 # scripts/run_fuzzers.sh 60 # each target for 60 s, capped fuzz_args = ['-fsanitize=fuzzer'] fuzz_targets = { 'fuzz_ioc_list': ['fuzz_ioc_list.cpp', '../src/rule_updater.cpp', '../src/ioc_list.cpp', '../src/yara_scanner.cpp'], 'fuzz_policy_apply': ['fuzz_policy_apply.cpp'], 'fuzz_governor_parsers': ['fuzz_governor_parsers.cpp'], 'fuzz_status_snapshot': ['fuzz_status_snapshot.cpp'], 'fuzz_config': ['fuzz_config.cpp'], 'fuzz_record_decoder': ['fuzz_record_decoder.cpp'], 'fuzz_block_decoder': ['fuzz_block_decoder.cpp'], 'fuzz_segment_reader': ['fuzz_segment_reader.cpp'], 'fuzz_manifest': ['fuzz_manifest.cpp'], 'fuzz_evidence_records': ['fuzz_evidence_records.cpp'], 'fuzz_legacy_kv': ['fuzz_legacy_kv.cpp'], 'fuzz_telemetry_records': ['fuzz_telemetry_records.cpp'], 'fuzz_cmdline_redactor': ['fuzz_cmdline_redactor.cpp'], 'fuzz_tokenizer': ['fuzz_tokenizer.cpp'], 'fuzz_replay': ['fuzz_replay.cpp'], 'fuzz_trace_dsl': ['fuzz_trace_dsl.cpp'], 'fuzz_model_file': ['fuzz_model_file.cpp'], 'fuzz_rarity_state': ['fuzz_rarity_state.cpp'], 'fuzz_opensnitch_events': ['fuzz_opensnitch_events.cpp'], 'fuzz_procargs': ['fuzz_procargs.cpp'], } foreach name, sources : fuzz_targets extra = name == 'fuzz_ioc_list' ? [updater_feature_dep, yara_dep, yara_feature_dep] : [] executable(name, sources, include_directories: inc_dirs, dependencies: [strawberry_core_dep] + extra, link_args: fuzz_args, ) endforeach # I/O-failure fuzzing: its sources are compiled with the fault injector on, so # it does not link strawberry_core (whose objects have no injector). executable('fuzz_io_faults', 'fuzz_io_faults.cpp', '../src/hash_utils.cpp', '../src/resource_governor.cpp', include_directories: inc_dirs, cpp_args: ['-DSTRAWBERRY_FAULT_INJECTION=1'], dependencies: [openssl_dep, threads_dep], link_args: fuzz_args, ) if get_option('enable_mcp').allowed() executable('fuzz_mcp_handle', 'fuzz_mcp_handle.cpp', include_directories: inc_dirs, link_with: strawberry_mcp_lib, dependencies: [nlohmann_json_dep, strawberry_core_dep], link_args: fuzz_args, ) endif