export CXXFLAGS="${CXXFLAGS} -std=c++17 -stdlib=libc++ -Wno-unused-parameter -Wno-unused-value"
# Build non-dhcp specific fuzzers
-for fuzzer in fuzz_cc fuzz_d2 fuzz_agent fuzz_util fuzz_dhcpsrv fuzz_dhcpsrv_csv_lease fuzz_dns fuzz_encode fuzz_cryptolink
+for fuzzer in fuzz_cc fuzz_d2 fuzz_util fuzz_dhcpsrv fuzz_dhcpsrv_csv_lease fuzz_dns fuzz_encode fuzz_cryptolink
do
extra_lib=""
case "$fuzzer" in fuzz_hook_tsig)
# Prepare maximum size option for configuration parsing related fuzzers
for fuzzer in fuzz_eval4 fuzz_eval6 fuzz_dhcp_parser4 fuzz_dhcp_parser6 \
- fuzz_dhcp_pkt4 fuzz_dhcp_pkt6 fuzz_cc fuzz_d2 fuzz_agent \
+ fuzz_dhcp_pkt4 fuzz_dhcp_pkt6 fuzz_cc fuzz_d2 \
fuzz_config_kea_dhcp4 fuzz_config_kea_dhcp6
do
printf '[libfuzzer]\nmax_len=25600\n' > "${OUT}/${fuzzer}.options"
zip -j "${OUT}/fuzz_dhcpsrv_seed_corpus.zip" "${SRC}/kea/src/fuzz/corp"/*.json
zip -j "${OUT}/fuzz_dhcp_parser4_seed_corpus.zip" "${SRC}/kea/src/fuzz/corp"/*.json
zip -j "${OUT}/fuzz_dhcp_parser6_seed_corpus.zip" "${SRC}/kea/src/fuzz/corp"/*.json
-zip -j "${OUT}/fuzz_agent_seed_corpus.zip" "${SRC}/kea/src/bin/agent/tests/testdata"/*.json
zip -j "${OUT}/fuzz_d2_seed_corpus.zip" "${SRC}/kea/src/bin/d2/tests/testdata"/*.json
+++ /dev/null
-// Copyright (C) 2026 Internet Systems Consortium, Inc. ("ISC")
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-////////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 2025 Ada Logics Ltd.
-//
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-////////////////////////////////////////////////////////////////////////////////
-#include "config.h"
-#include <fuzzer/FuzzedDataProvider.h>
-
-#include <agent/parser_context.h>
-#include <agent/simple_parser.h>
-#include <agent/ca_cfg_mgr.h>
-
-#include <cc/data.h>
-#include <exceptions/exceptions.h>
-
-#include <string>
-#include <memory>
-
-using namespace isc::agent;
-using namespace isc::data;
-
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- FuzzedDataProvider fdp(data, size);
- bool checkOnly = fdp.ConsumeBool();
-
- AgentSimpleParser simpleParser;
- CtrlAgentCfgContextPtr ctxPtr(new CtrlAgentCfgContext());
- ParserContext ctx;
- ElementPtr elem;
-
- // Generate random parsing mode
- const uint8_t mode = fdp.ConsumeIntegralInRange<uint8_t>(0, 2);
- ParserContext::ParserType type = ParserContext::PARSER_JSON;
- if (mode == 1) {
- type = ParserContext::PARSER_AGENT;
- } else if (mode == 2) {
- type = ParserContext::PARSER_SUB_AGENT;
- }
-
- const std::string payload = fdp.ConsumeRemainingBytesAsString();
-
- // Target context parseString
- try {
- ctx.parseString(payload, type);
- } catch (const isc::Exception&) {
- // Silent exceptions
- }
-
- // Parse payload to JSON
- try {
- elem = Element::fromJSON(payload);
- } catch (...) {
- // If failed to parse the payload, early exit
- return 0;
- }
-
- // Target SimpleParser
- try {
- AgentSimpleParser::setAllDefaults(elem);
- simpleParser.checkTlsSetup(elem);
- simpleParser.parse(ctxPtr, elem, checkOnly);
- } catch (const isc::Exception&) {
- // Silent exceptions
- }
-
- return 0;
-}
+++ /dev/null
-"{"
-"}"
-"["
-"]"
-":"
-","
-"\""
-"\"\""
-"null"
-"true"
-"false"
-" "
-"\\n"
-"\\r\\n"
-"\"Control-agent\""
-"\"control-agent\""
-"\"http-host\""
-"\"http-port\""
-"\"http-ciphers\""
-"\"http-headers\""
-"\"http-max-body-size\""
-"\"http-status\""
-"\"http-response-headers\""
-"\"localhost\""
-"\"127.0.0.1\""
-"\"::1\""
-"\"0.0.0.0\""
-"0"
-"53"
-"67"
-"80"
-"443"
-"8080"
-"65535"
-"\"tls\""
-"\"enable-tls\""
-"\"cert-file\""
-"\"key-file\""
-"\"ca-file\""
-"\"trust-anchor\""
-"\"verify-peer\""
-"\"cipher-list\""
-"\"cipher-suite\""
-"\"protocols\""
-"\"min-tls-version\""
-"\"max-tls-version\""
-"\"/etc/kea/ctrl-agent.crt\""
-"\"/etc/kea/ctrl-agent.key\""
-"\"/etc/ssl/certs/ca-certificates.crt\""
-"\"/tmp/kea.crt\""
-"\"/tmp/kea.key\""
-"\"REQUIRED\""
-"\"OPTIONAL\""
-"\"NONE\""
-"\"TLSv1.2\""
-"\"TLSv1.3\""
-"\"control-sockets\""
-"\"dhcp4\""
-"\"dhcp6\""
-"\"d2\""
-"\"netconf\""
-"\"socket-type\""
-"\"socket-name\""
-"\"socket-url\""
-"\"unix\""
-"\"http\""
-"\"/tmp/kea4-ctrl.sock\""
-"\"/tmp/kea6-ctrl.sock\""
-"\"/tmp/kea-d2-ctrl.sock\""
-"\"http://127.0.0.1:8000/\""
-"\"http://[::1]:8000/\""
-"\"commands\""
-"\"command\""
-"\"arguments\""
-"\"access-list\""
-"\"whitelist\""
-"\"blacklist\""
-"\"allowed-clients\""
-"\"paths\""
-"\"path\""
-"\"GET\""
-"\"POST\""
-"\"Logging\""
-"\"name\""
-"\"output_options\""
-"\"output\""
-"\"flush\""
-"\"maxsize\""
-"\"maxver\""
-"\"file-name\""
-"\"severity\""
-"\"debuglevel\""
-"\"INFO\""
-"\"WARN\""
-"\"ERROR\""
-"\"DEBUG\""
-"\"kea-ctrl-agent\""
-"\"stdout\""
-"\"stderr\""
-"\"/var/log/kea-ctrl-agent.log\""
-"\"interfaces\""
-"\"hooks-libraries\""
-"\"library\""
-"\"parameters\""
-"\"user-context\""
-"\"comment\""
-"\"config-control\""
-"\"config-databases\""
-"\"database\""
-"\"type\""
-"\"host\""
-"\"port\""
-"\"user\""
-"\"password\""
-"\"name\""
-"\"Control-agent\":{"
-"\"http-host\":\""
-"\"http-port\":"
-"\"enable-tls\":"
-"\"cert-file\":\""
-"\"key-file\":\""
-"\"ca-file\":\""
-"\"verify-peer\":"
-"\"control-sockets\":{"
-"\"dhcp4\":{"
-"\"dhcp6\":{"
-"\"d2\":{"
-"\"netconf\":{"
-"\"socket-type\":\""
-"\"socket-name\":\""
-"\"Logging\":[{"
-"\"output_options\":[{"
-"\"severity\":\""
-"\"debuglevel\":"
-"}]"
-"}]"
-"}"
-"\"\""
-"\" \""
-"\"\\u0000\""
-"\"\\uD800\""
-"\"\\x\""
-"-1"
-"2147483647"
-"4294967295"
-"9223372036854775807"
-"3.14159"
-"\"[],{}:\""
-"\":{"
-"\": ["
-"]}"
-"}]"
-"},"
-"],"
-"\" : "
-" , "