Since the introduction of LLMs and Agentic AI, code is ever written at an ever- increasing speed. however not all of it is checked through rigorous testing phases, often leading to unknown bugs that can produce global-scale outages. Moreover, even if tests were set during development, they are not a guarantee of code quality, as it depends on both the diversity of testcases and the environment of such tests. As a matter of fact, testcases are written to cover the so-called "edge-cases", but it needs expertise and creativity to create them and , since time is involved in the equation, only the most common and disruptive ones are usually covered. To solve this problem, and increase the coverage of tests, a common approach is to use a Fuzzer, a program capable to automatically test another one, usually called "SUT" - "System Under Test", by various means. However, the problem of this approach lies in the tight coupling between the system architecture and the fuzzing methodology. In fact, many are the fuzzers that exist in literature due to this. Some are oriented at programs written for constrained devices such as microcontrollers; others focus on kernels, testing syscall interactions; and some focus on testing binaries, for those programs whose code can’t be openly accessed. In general, there exists a Fuzzer which has been built to address a specific problem or language. Among the most popular fuzzers available today we find AFL++, which is ori- ented at testing clang compilable programs for various architectures. Nevertheless, when challenged with the task of fuzzing network oriented SUTs, notoriously slow to test due to the presence of network overheads, the recommendation is to use AFLNet, a fuzzer inspired by the original AFL, but oriented in fuzzing stateful protocols. Even though AFLNet demonstrated its validity as a stateful protocol fuzzer, it has some difficulties in testing new, or obscure, protocols and relies on human expertise to write custom handlers to solve the problem. This thesis will present a novel approach which exploits LLMs, and their code knowledge capabilities, to bridge this gap by firstly extracting "FSMs" - "Finite State Machines" from natural language documents, such as RFCs, and then us- ing this knowledge to program a library capable of generating compliant protocol i messages to explore more states of the SUT.
Since the introduction of LLMs and Agentic AI, code is ever written at an ever- increasing speed. however not all of it is checked through rigorous testing phases, often leading to unknown bugs that can produce global-scale outages. Moreover, even if tests were set during development, they are not a guarantee of code quality, as it depends on both the diversity of testcases and the environment of such tests. As a matter of fact, testcases are written to cover the so-called "edge-cases", but it needs expertise and creativity to create them and , since time is involved in the equation, only the most common and disruptive ones are usually covered. To solve this problem, and increase the coverage of tests, a common approach is to use a Fuzzer, a program capable to automatically test another one, usually called "SUT" - "System Under Test", by various means. However, the problem of this approach lies in the tight coupling between the system architecture and the fuzzing methodology. In fact, many are the fuzzers that exist in literature due to this. Some are oriented at programs written for constrained devices such as microcontrollers; others focus on kernels, testing syscall interactions; and some focus on testing binaries, for those programs whose code can’t be openly accessed. In general, there exists a Fuzzer which has been built to address a specific problem or language. Among the most popular fuzzers available today we find AFL++, which is ori- ented at testing clang compilable programs for various architectures. Nevertheless, when challenged with the task of fuzzing network oriented SUTs, notoriously slow to test due to the presence of network overheads, the recommendation is to use AFLNet, a fuzzer inspired by the original AFL, but oriented in fuzzing stateful protocols. Even though AFLNet demonstrated its validity as a stateful protocol fuzzer, it has some difficulties in testing new, or obscure, protocols and relies on human expertise to write custom handlers to solve the problem. This thesis will present a novel approach which exploits LLMs, and their code knowledge capabilities, to bridge this gap by firstly extracting "FSMs" - "Finite State Machines" from natural language documents, such as RFCs, and then us- ing this knowledge to program a library capable of generating compliant protocol i messages to explore more states of the SUT.
EXPLORING STATEFUL PROTOCOLS VIA AGENTIC AI
RISI, CHRISTIAN
2025/2026
Abstract
Since the introduction of LLMs and Agentic AI, code is ever written at an ever- increasing speed. however not all of it is checked through rigorous testing phases, often leading to unknown bugs that can produce global-scale outages. Moreover, even if tests were set during development, they are not a guarantee of code quality, as it depends on both the diversity of testcases and the environment of such tests. As a matter of fact, testcases are written to cover the so-called "edge-cases", but it needs expertise and creativity to create them and , since time is involved in the equation, only the most common and disruptive ones are usually covered. To solve this problem, and increase the coverage of tests, a common approach is to use a Fuzzer, a program capable to automatically test another one, usually called "SUT" - "System Under Test", by various means. However, the problem of this approach lies in the tight coupling between the system architecture and the fuzzing methodology. In fact, many are the fuzzers that exist in literature due to this. Some are oriented at programs written for constrained devices such as microcontrollers; others focus on kernels, testing syscall interactions; and some focus on testing binaries, for those programs whose code can’t be openly accessed. In general, there exists a Fuzzer which has been built to address a specific problem or language. Among the most popular fuzzers available today we find AFL++, which is ori- ented at testing clang compilable programs for various architectures. Nevertheless, when challenged with the task of fuzzing network oriented SUTs, notoriously slow to test due to the presence of network overheads, the recommendation is to use AFLNet, a fuzzer inspired by the original AFL, but oriented in fuzzing stateful protocols. Even though AFLNet demonstrated its validity as a stateful protocol fuzzer, it has some difficulties in testing new, or obscure, protocols and relies on human expertise to write custom handlers to solve the problem. This thesis will present a novel approach which exploits LLMs, and their code knowledge capabilities, to bridge this gap by firstly extracting "FSMs" - "Finite State Machines" from natural language documents, such as RFCs, and then us- ing this knowledge to program a library capable of generating compliant protocol i messages to explore more states of the SUT.I documenti in UNITESI sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.
https://hdl.handle.net/20.500.14253/110794