{ "cells": [ { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": false, "run_control": { "read_only": false }, "slideshow": { "slide_type": "slide" } }, "source": [ "# Greybox Fuzzing with Grammars\n", "\n", "In this chapter, we introduce important extensions to our syntactic fuzzing techniques, all leveraging _syntactic_ parts of _existing inputs_.\n", "\n", "1. We show how to leverage _dictionaries_ of input fragments during fuzzing. The idea is to integrate such dictionaries into a _mutator_, which would then inject these fragments (typically keywords and other items of importance) into population.\n", "\n", "2. We show how to combine [parsing](Parser.ipynb) and [fuzzing](GrammarFuzzer.ipynb) with grammars. This allows _mutating_ existing inputs while preserving syntactical correctness, and to _reuse_ fragments from existing inputs while generating new ones. The combination of language-based parsing and generating, as demonstrated in this chapter, has been highly successful in practice: The _LangFuzz_ fuzzer for JavaScript has found more than 2,600 bugs in JavaScript interpreters this way.\n", "\n", "3. In the previous chapters, we have used grammars in a _black-box_ manner – that is, we have used them to generate inputs regardless of the program being tested. In this chapter, we introduce mutational _greybox fuzzing with grammars_: Techniques that make use of _feedback from the program under test_ to guide test generations towards specific goals. As in [lexical greybox fuzzing](GreyboxFuzzer.ipynb), this feedback is mostly _coverage_, allowing us to direct grammar-based testing towards uncovered code parts. This part is inspired by the _AFLSmart_ fuzzer, which combines parsing and mutational fuzzing." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:10.688611Z", "iopub.status.busy": "2024-01-18T17:17:10.688131Z", "iopub.status.idle": "2024-01-18T17:17:10.753528Z", "shell.execute_reply": "2024-01-18T17:17:10.753220Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from bookutils import YouTubeVideo\n", "YouTubeVideo('hSGzcjUj7Vs')" ] }, { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": false, "run_control": { "read_only": false }, "slideshow": { "slide_type": "subslide" } }, "source": [ "**Prerequisites**\n", "\n", "* We build on several concepts from [the chapter on greybox fuzzing (without grammars)](GreyboxFuzzer.ipynb).\n", "* As the title suggests, you should know how to fuzz with grammars [from the chapter on grammars](Grammars.ipynb)." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "skip" } }, "source": [ "## Synopsis\n", "\n", "\n", "To [use the code provided in this chapter](Importing.ipynb), write\n", "\n", "```python\n", ">>> from fuzzingbook.GreyboxGrammarFuzzer import \n", "```\n", "\n", "and then make use of the following features.\n", "\n", "\n", "This chapter introduces advanced methods for language-based grey-box fuzzing inspired by the _LangFuzz_ and _AFLSmart_ fuzzers.\n", "\n", "### Fuzzing with Dictionaries\n", "\n", "Rather than mutating strings randomly, the `DictMutator` class allows inserting tokens from a dictionary, thus increasing fuzzer performance. The dictionary comes as a list of strings, out of which random elements are picked and inserted - in addition to the given mutations such as deleting or inserting individual bytes.\n", "\n", "```python\n", ">>> dict_mutator = DictMutator([\"\", \"\", \"\", \"='a'\"])\n", ">>> seeds = [\"HelloWorld
\"]\n", ">>> for i in range(10):\n", ">>> print(dict_mutator.mutate(seeds[0]))\n", "He='a'lloWorld
\n", "Hello<title></head><body>World<br/></body></html>\n", "<html><head><title>Hello>body>World
\n", "HelloSWorld
\n", "HelloWorld
body>\n", "HelloWorld
\n", "HelloWorld
\n", "Hellobody>World
\n", "HelloWeorld
\n", "|HelloWorld
\n", "\n", "```\n", "This `DictMutator` can be used as an argument to `GreyboxFuzzer`:\n", "\n", "```python\n", ">>> runner = FunctionCoverageRunner(my_parser)\n", ">>> dict_fuzzer = GreyboxFuzzer(seeds, dict_mutator, PowerSchedule())\n", ">>> dict_fuzzer_outcome = dict_fuzzer.runs(runner, trials=5)\n", "```\n", "![](PICS/GreyboxGrammarFuzzer-synopsis-1.svg)\n", "\n", "### Fuzzing with Input Fragments\n", "\n", "The `LangFuzzer` class introduces a _language-aware_ fuzzer that can recombine fragments from existing inputs – inspired by the highly effective `LangFuzz` fuzzer. At its core is a `FragmentMutator` class that that takes a [_parser_](Parser.ipynb) as argument:\n", "\n", "```python\n", ">>> parser = EarleyParser(XML_GRAMMAR, tokens=XML_TOKENS)\n", ">>> mutator = FragmentMutator(parser)\n", "```\n", "The fuzzer itself is initialized with a list of seeds, the above `FragmentMutator`, and a power schedule:\n", "\n", "```python\n", ">>> seeds = [\"HelloWorld
\"]\n", ">>> schedule = PowerSchedule()\n", ">>> lang_fuzzer = LangFuzzer(seeds, mutator, schedule)\n", ">>> for i in range(10):\n", ">>> print(lang_fuzzer.fuzz())\n", "HelloWorld
\n", "HelloWorld
\n", "HelloWorld
\n", "\n", "World<br/>World
\n", "HelloWorld
\n", "HelloWorld
\n", "Hello</head><body>World<br/></body></html>\n", "<html><head><title>HelloWorld
\n", "HelloWorld

\n", "\n", "```\n", "![](PICS/GreyboxGrammarFuzzer-synopsis-2.svg)\n", "\n", "### Fuzzing with Input Regions\n", "\n", "The `GreyboxGrammarFuzzer` class uses two mutators:\n", "* a _tree mutator_ (a `RegionMutator` object) that can parse existing strings to identify _regions_ in that string to be swapped or deleted.\n", "* a _byte mutator_ to apply bit- and character-level mutations.\n", "\n", "```python\n", ">>> tree_mutator = RegionMutator(parser)\n", ">>> byte_mutator = Mutator()\n", "```\n", "The _schedule_ for the `GreyboxGrammarFuzzer` class can be a regular `PowerSchedule` object. However, a more sophisticated schedule is provided by `AFLSmartSchedule`, which assigns more [energy](GreyboxFuzzer.ipynb#Power-Schedules) to seeds that have a higher degree of validity.\n", "\n", "```python\n", ">>> schedule = AFLSmartSchedule(parser)\n", "```\n", "The `GreyboxGrammarFuzzer` constructor takes a set of seeds as well as the two mutators and the schedule:\n", "\n", "```python\n", ">>> aflsmart_fuzzer = GreyboxGrammarFuzzer(seeds, byte_mutator, tree_mutator, schedule)\n", "```\n", "As it relies on code coverage, it is typically combined with a `FunctionCoverageRunner`:\n", "\n", "```python\n", ">>> runner = FunctionCoverageRunner(my_parser)\n", ">>> aflsmart_outcome = aflsmart_fuzzer.runs(runner, trials=5)\n", "```\n", "![](PICS/GreyboxGrammarFuzzer-synopsis-3.svg)\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Background\n", "First, we [recall](GreyboxFuzzer.ipynb#Ingredients-for-Greybox-Fuzzing) a few basic ingredients for mutational fuzzers.\n", "* **Seed**. A _seed_ is an input that is used by the fuzzer to generate new inputs by applying a sequence of mutations.\n", "* **Mutator**. A _mutator_ implements a set of mutation operators that applied to an input produce a slightly modified input.\n", "* **PowerSchedule**. A _power schedule_ assigns _energy_ to a seed. A seed with higher energy is fuzzed more often throughout the fuzzing campaign.\n", "* **AdvancedMutationFuzzer**. Our _mutational blackbox fuzzer_ generates inputs by mutating seeds in an initial population of inputs.\n", "* **GreyboxFuzzer**. Our _greybox fuzzer_ dynamically adds inputs to the population of seeds that increased coverage.\n", "* **FunctionCoverageRunner**. Our _function coverage runner_ collects coverage information for the execution of a given Python function.\n", "\n", "Let's try to get a feeling for these concepts." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:10.776481Z", "iopub.status.busy": "2024-01-18T17:17:10.776330Z", "iopub.status.idle": "2024-01-18T17:17:10.778310Z", "shell.execute_reply": "2024-01-18T17:17:10.778061Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "import bookutils.setup" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:10.779792Z", "iopub.status.busy": "2024-01-18T17:17:10.779689Z", "iopub.status.idle": "2024-01-18T17:17:10.781200Z", "shell.execute_reply": "2024-01-18T17:17:10.780960Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "from typing import List, Set, Dict, Sequence, cast" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:10.782619Z", "iopub.status.busy": "2024-01-18T17:17:10.782532Z", "iopub.status.idle": "2024-01-18T17:17:11.225242Z", "shell.execute_reply": "2024-01-18T17:17:11.224884Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "from Fuzzer import Fuzzer\n", "from GreyboxFuzzer import Mutator, Seed, PowerSchedule\n", "from GreyboxFuzzer import AdvancedMutationFuzzer, GreyboxFuzzer\n", "from MutationFuzzer import FunctionCoverageRunner" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "The following command applies a mutation to the input \"Hello World\"." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:11.227272Z", "iopub.status.busy": "2024-01-18T17:17:11.227135Z", "iopub.status.idle": "2024-01-18T17:17:11.229574Z", "shell.execute_reply": "2024-01-18T17:17:11.229201Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ "'Lello World'" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Mutator().mutate(\"Hello World\")" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "The default power schedule assigns energy uniformly across all seeds. Let's check whether this works.\n", "\n", "We choose 10k times from a population of three seeds. As we see in the `hits` counter, each seed is chosen about a third of the time." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:11.231217Z", "iopub.status.busy": "2024-01-18T17:17:11.231008Z", "iopub.status.idle": "2024-01-18T17:17:11.254675Z", "shell.execute_reply": "2024-01-18T17:17:11.254366Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "text/plain": [ "{'A': 3387, 'B': 3255, 'C': 3358}" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "population = [Seed(\"A\"), Seed(\"B\"), Seed(\"C\")]\n", "schedule = PowerSchedule()\n", "hits = {\n", " \"A\": 0,\n", " \"B\": 0,\n", " \"C\": 0\n", "}\n", "\n", "for i in range(10000):\n", " seed = schedule.choose(population)\n", " hits[seed.data] += 1\n", "\n", "hits" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Before explaining the function coverage runner, lets import Python's HTML parser as example..." ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:11.256411Z", "iopub.status.busy": "2024-01-18T17:17:11.256292Z", "iopub.status.idle": "2024-01-18T17:17:11.258118Z", "shell.execute_reply": "2024-01-18T17:17:11.257808Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "from html.parser import HTMLParser" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "... and create a _wrapper function_ that passes each input into a new parser object." ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:11.259867Z", "iopub.status.busy": "2024-01-18T17:17:11.259732Z", "iopub.status.idle": "2024-01-18T17:17:11.261644Z", "shell.execute_reply": "2024-01-18T17:17:11.261352Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [], "source": [ "def my_parser(inp: str) -> None:\n", " parser = HTMLParser()\n", " parser.feed(inp)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "The `FunctionCoverageRunner` constructor takes a Python `function` to execute. The function `run()` takes an input, passes it on to the Python `function`, and collects the coverage information for this execution. The function `coverage()` returns a list of tuples `(function name, line number)` for each statement that has been covered in the Python `function`." ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:11.263504Z", "iopub.status.busy": "2024-01-18T17:17:11.263392Z", "iopub.status.idle": "2024-01-18T17:17:11.265848Z", "shell.execute_reply": "2024-01-18T17:17:11.265618Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "text/plain": [ "[('updatepos', 47),\n", " ('goahead', 134),\n", " ('goahead', 140),\n", " ('goahead', 137),\n", " ('goahead', 161)]" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "runner = FunctionCoverageRunner(my_parser)\n", "runner.run(\"Hello World\")\n", "cov = runner.coverage()\n", "\n", "list(cov)[:5] # Print 5 statements covered in HTMLParser" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "Our greybox fuzzer takes a seed population, mutator, and power schedule. Let's generate 5000 fuzz inputs starting with an \"empty\" seed corpus." ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:11.267545Z", "iopub.status.busy": "2024-01-18T17:17:11.267421Z", "iopub.status.idle": "2024-01-18T17:17:11.269047Z", "shell.execute_reply": "2024-01-18T17:17:11.268783Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "import time\n", "import random" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:11.270459Z", "iopub.status.busy": "2024-01-18T17:17:11.270355Z", "iopub.status.idle": "2024-01-18T17:17:11.272241Z", "shell.execute_reply": "2024-01-18T17:17:11.271985Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "n = 5000\n", "seed_input = \" \" # empty seed\n", "runner = FunctionCoverageRunner(my_parser)\n", "fuzzer = GreyboxFuzzer([seed_input], Mutator(), PowerSchedule())" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:11.273713Z", "iopub.status.busy": "2024-01-18T17:17:11.273549Z", "iopub.status.idle": "2024-01-18T17:17:11.672628Z", "shell.execute_reply": "2024-01-18T17:17:11.672323Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [], "source": [ "start = time.time()\n", "fuzzer.runs(runner, trials=n)\n", "end = time.time()" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:11.674547Z", "iopub.status.busy": "2024-01-18T17:17:11.674420Z", "iopub.status.idle": "2024-01-18T17:17:11.676747Z", "shell.execute_reply": "2024-01-18T17:17:11.676475Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ "'It took the fuzzer 0.40 seconds to generate and execute 5000 inputs.'" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\"It took the fuzzer %0.2f seconds to generate and execute %d inputs.\" % (end - start, n)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:11.678255Z", "iopub.status.busy": "2024-01-18T17:17:11.678151Z", "iopub.status.idle": "2024-01-18T17:17:11.680217Z", "shell.execute_reply": "2024-01-18T17:17:11.679971Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ "'During this fuzzing campaign, we covered 73 statements.'" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\"During this fuzzing campaign, we covered %d statements.\" % len(runner.coverage())" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Fuzzing with Dictionaries\n", "\n", "To fuzz our HTML parser, it may be useful to inform a mutational fuzzer about important keywords in the input – that is, important HTML keywords. The general idea is to have a _dictionary_ of pre-defined useful inputs that could then be inserted as such when mutating an input.\n", "\n", "This concept is illustrated in the following diagram. When mutating an input, we may insert given keywords from the dictionary (in red).\n", "\n", "![](PICS/GreyboxGrammarFuzzer-Dict.gif)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "To implement this concept, we extend our mutator to consider keywords from a dictionary." ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:11.681759Z", "iopub.status.busy": "2024-01-18T17:17:11.681655Z", "iopub.status.idle": "2024-01-18T17:17:11.683978Z", "shell.execute_reply": "2024-01-18T17:17:11.683747Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "class DictMutator(Mutator):\n", " \"\"\"Mutate strings using keywords from a dictionary\"\"\"\n", "\n", " def __init__(self, dictionary: List[str]) -> None:\n", " \"\"\"Constructor. `dictionary` is the list of keywords to use.\"\"\"\n", " super().__init__()\n", " self.dictionary = dictionary\n", " self.mutators.append(self.insert_from_dictionary)\n", "\n", " def insert_from_dictionary(self, s: str) -> str:\n", " \"\"\"Returns s with a keyword from the dictionary inserted\"\"\"\n", " pos = random.randint(0, len(s))\n", " random_keyword = random.choice(self.dictionary)\n", " return s[:pos] + random_keyword + s[pos:]" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Let's try to add a few HTML tags and attributes and see whether the coverage with `DictMutator` increases." ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:11.685503Z", "iopub.status.busy": "2024-01-18T17:17:11.685404Z", "iopub.status.idle": "2024-01-18T17:17:14.561538Z", "shell.execute_reply": "2024-01-18T17:17:14.561241Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ "'It took the fuzzer 2.87 seconds to generate and execute 5000 inputs.'" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "runner = FunctionCoverageRunner(my_parser)\n", "dict_mutator = DictMutator([\"
\", \"\", \"\", \"='a'\"])\n", "dict_fuzzer = GreyboxFuzzer([seed_input], dict_mutator, PowerSchedule())\n", "\n", "start = time.time()\n", "dict_fuzzer.runs(runner, trials=n)\n", "end = time.time()\n", "\n", "\"It took the fuzzer %0.2f seconds to generate and execute %d inputs.\" % (end - start, n)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "Clearly, it takes longer. In our experience, this means more code is covered:" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:14.563418Z", "iopub.status.busy": "2024-01-18T17:17:14.563297Z", "iopub.status.idle": "2024-01-18T17:17:14.565508Z", "shell.execute_reply": "2024-01-18T17:17:14.565228Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "text/plain": [ "'During this fuzzing campaign, we covered 110 statements.'" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\"During this fuzzing campaign, we covered %d statements.\" % len(runner.coverage())" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "How do the fuzzers compare in terms of coverage over time?" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:14.567036Z", "iopub.status.busy": "2024-01-18T17:17:14.566931Z", "iopub.status.idle": "2024-01-18T17:17:14.568526Z", "shell.execute_reply": "2024-01-18T17:17:14.568300Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "from Coverage import population_coverage" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:14.569934Z", "iopub.status.busy": "2024-01-18T17:17:14.569849Z", "iopub.status.idle": "2024-01-18T17:17:14.571513Z", "shell.execute_reply": "2024-01-18T17:17:14.571282Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "import matplotlib.pyplot as plt # type: ignore" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:14.572955Z", "iopub.status.busy": "2024-01-18T17:17:14.572867Z", "iopub.status.idle": "2024-01-18T17:17:16.794606Z", "shell.execute_reply": "2024-01-18T17:17:16.794266Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAk0AAAHHCAYAAACiOWx7AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAABlgElEQVR4nO3deVhUZfsH8O+wzACyi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pNw4YNERcXh/j4eAwaNAgqlQqXLl3C0KFDUa9evX98/5w5c/Dmm2+icePGaNeuHTZv3ozo6Ghs3bq1EqIH1q9fD29vbzRv3hyrV6/Gw4cPMW7cOABA586dYWNjgwULFmDatGmIjIxESEiIwfs9PT0RGxuL6OhoNGjQAHZ2dvj666+Rl5cnvf+rr76CtbV1iVMmEJEysdJEROUqLCwMnTp1gpWVFU6dOoUGDRoYlTABwLRp0zBz5kzMmjULrVu3xoEDB7B37154e3tXcNT5li9fjuXLl6Nt27Y4fvw49u7dK43BcnJywldffYUff/wRrVu3xtdff11oyoOhQ4eiT58+8Pf3h7OzM77++ms4Ojpi06ZN6NatG9q0aYOff/4Z33//vVFX5BGRsnBGcCKq8a5fvw4vLy+cO3eu2FuzEBGx0kRERERkBCZNREREREZg9xwRERGREVhpIiIiIjICkyYiIiIiIzBpIiIiIjICkyYiIiIiIzBpIiIiIjICkyYiIiIiIzBpIiIiIjICkyYiIiIiIzBpIiIiIjLC/wN2FUiaj9UfCgAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "_, dict_cov = population_coverage(dict_fuzzer.inputs, my_parser)\n", "_, fuzz_cov = population_coverage(fuzzer.inputs, my_parser)\n", "line_dict, = plt.plot(dict_cov, label=\"With Dictionary\")\n", "line_fuzz, = plt.plot(fuzz_cov, label=\"Without Dictionary\")\n", "plt.legend(handles=[line_dict, line_fuzz])\n", "plt.xlim(0, n)\n", "plt.title('Coverage over time')\n", "plt.xlabel('# of inputs')\n", "plt.ylabel('lines covered');" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "\n", "\n", "***Summary.*** Informing the fuzzer about important keywords already goes a long way towards achieving lots of coverage quickly.\n", "\n", "***Try it.*** Open this chapter as Jupyter notebook and add other HTML-related keywords to the dictionary in order to see whether the difference in coverage actually increases (given the same budget of 5k generated test inputs).\n", "\n", "***Read up.*** Michał Zalewski, author of AFL, wrote several great blog posts on [making up grammars with a dictionary in hand](https://lcamtuf.blogspot.com/2015/01/afl-fuzz-making-up-grammar-with.html) and [pulling JPEGs out of thin air](https://lcamtuf.blogspot.com/2014/11/pulling-jpegs-out-of-thin-air.html)!" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" }, "tags": [], "toc-hr-collapsed": false }, "source": [ "## Fuzzing with Input Fragments\n", "\n", "While dictionaries are helpful to inject important keywords into seed inputs, they do not allow maintaining the structural integrity of the generated inputs. Instead, we need to make the fuzzer aware of the _input structure_. We can do this using [grammars](Grammars.ipynb). Our first approach \n", "\n", "1. [parses](Parser.ipynb) the seed inputs, \n", "2. disassembles them into input fragments, and \n", "3. generates new files by reassembling these fragments according to the rules of the grammar." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "This combination of _parsing_ and _fuzzing_ can be very powerful. For instance, we can _swap_ existing substructures in an input:\n", "\n", "![](PICS/GreyboxGrammarFuzzer-Swap.gif)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "We can also _replace_ existing substructures by newly generated ones:\n", "\n", "![](PICS/GreyboxGrammarFuzzer-Gen.gif)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "All these operations take place on [derivation trees](GrammarFuzzer.ipynb), which can be parsed from and produced into strings at any time." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Parsing and Recombining JavaScript, or How to Make 50,000 USD in Four Weeks\n", "\n", "In \"Fuzzing with Code Fragments\" \\cite{Holler2012}, Holler, Herzig, and Zeller apply these steps to fuzz a JavaScript interpreter. They use a JavaScript grammar to\n", "\n", "1. _parse_ (valid) JavaScript inputs into parse trees,\n", "2. _disassemble_ them into fragments (subtrees),\n", "3. _recombine_ these fragments into valid JavaScript programs again, and\n", "4. _feed_ these programs into a JavaScript interpreter for execution." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "As in most fuzzing scenarios, the aim is to cause the JavaScript interpreter to crash. Here is an example of LangFuzz-generated JavaScript code (from \\cite{Holler2012}) that caused a crash in the Mozilla JavaScript interpreter:\n", "\n", "```javascript\n", "var haystack = \"foo\";\n", "var re_text = \"^foo\";\n", "haystack += \"x\";\n", "re_text += \"(x)\";\n", "var re = new RegExp(re_text);\n", "re.test(haystack);\n", "RegExp.input = Number();\n", "print(RegExp.$1);\n", "```" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "From a crash of the JavaScript interpreter, it is frequently possible to construct an *exploit* that will not only crash the interpreter, but instead have it execute code under the attacker's control. Therefore, such crashes are serious flaws, which is why you get a bug bounty if you report them." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "In the first four weeks of running his _LangFuzz_ tool, Christian Holler, first author of that paper, netted _more than USD 50,000 in bug bounties_. To date, LangFuzz has found more than 2,600 bugs in the JavaScript browsers of Mozilla Firefox, Google Chrome, and Microsoft Edge. If you use any of these browsers (say, on your Android phone), the combination of parsing and fuzzing has contributed significantly in making your browsing session secure.\n", "\n", "(Note that these are the same Holler and Zeller who are co-authors of this book. If you ever wondered why we devote a couple of chapters on grammar-based fuzzing, that's because we have had some great experience with it.)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Parsing and Recombining HTML\n", "\n", "In this book, let us stay with HTML input for a while. To generate valid HTML inputs for our Python `HTMLParser`, we should first define a simple grammar. It allows defining HTML tags with attributes. Our context-free grammar does not require that opening and closing tags must match. However, we will see that such context-sensitive features can be maintained in the derived input fragments, and thus in the generated inputs." ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:16.796617Z", "iopub.status.busy": "2024-01-18T17:17:16.796488Z", "iopub.status.idle": "2024-01-18T17:17:16.798237Z", "shell.execute_reply": "2024-01-18T17:17:16.797973Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "import string" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:16.799915Z", "iopub.status.busy": "2024-01-18T17:17:16.799790Z", "iopub.status.idle": "2024-01-18T17:17:16.866841Z", "shell.execute_reply": "2024-01-18T17:17:16.866426Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "from Grammars import is_valid_grammar, srange, Grammar" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:16.868835Z", "iopub.status.busy": "2024-01-18T17:17:16.868713Z", "iopub.status.idle": "2024-01-18T17:17:16.870427Z", "shell.execute_reply": "2024-01-18T17:17:16.870172Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [], "source": [ "XML_TOKENS: Set[str] = {\"\", \"\"}" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:16.871891Z", "iopub.status.busy": "2024-01-18T17:17:16.871786Z", "iopub.status.idle": "2024-01-18T17:17:16.874080Z", "shell.execute_reply": "2024-01-18T17:17:16.873813Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "XML_GRAMMAR: Grammar = {\n", " \"\": [\"\"],\n", " \"\": [\"\",\n", " \"\",\n", " \"\",\n", " \"\"],\n", " \"\": [\"<>\", \"< >\"],\n", " \"\": [\"</>\", \"< />\"],\n", " \"\": [\">\"],\n", " \"\": [\"=\", \" \"],\n", " \"\": [\"\", \"\"],\n", " \"\": [\"\", \"\"],\n", " \"\": srange(string.ascii_letters + string.digits +\n", " \"\\\"\" + \"'\" + \".\"),\n", " \"\": srange(string.ascii_letters + string.digits +\n", " \"\\\"\" + \"'\" + \" \" + \"\\t\"),\n", "}" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:16.875779Z", "iopub.status.busy": "2024-01-18T17:17:16.875651Z", "iopub.status.idle": "2024-01-18T17:17:16.877617Z", "shell.execute_reply": "2024-01-18T17:17:16.877294Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "assert is_valid_grammar(XML_GRAMMAR)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "In order to parse an input into a derivation tree, we use the [Earley parser](Parser.ipynb#Parsing-Context-Free-Grammars)." ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:16.879278Z", "iopub.status.busy": "2024-01-18T17:17:16.879163Z", "iopub.status.idle": "2024-01-18T17:17:16.991541Z", "shell.execute_reply": "2024-01-18T17:17:16.991239Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "from Parser import EarleyParser, Parser\n", "from GrammarFuzzer import display_tree, DerivationTree" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "Let's run the parser on a simple HTML input and display all possible parse trees. A *parse tree* represents the input structure according to the given grammar." ] }, { "cell_type": "code", "execution_count": 27, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:16.993596Z", "iopub.status.busy": "2024-01-18T17:17:16.993464Z", "iopub.status.idle": "2024-01-18T17:17:16.995092Z", "shell.execute_reply": "2024-01-18T17:17:16.994828Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "from IPython.display import display" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:16.996701Z", "iopub.status.busy": "2024-01-18T17:17:16.996585Z", "iopub.status.idle": "2024-01-18T17:17:23.111087Z", "shell.execute_reply": "2024-01-18T17:17:23.110355Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "0\n", "<start>\n", "\n", "\n", "\n", "1\n", "<xml-tree>\n", "\n", "\n", "\n", "0->1\n", "\n", "\n", "\n", "\n", "\n", "2\n", "<xml-open-tag>\n", "\n", "\n", "\n", "1->2\n", "\n", "\n", "\n", "\n", "\n", "7\n", "<xml-tree>\n", "\n", "\n", "\n", "1->7\n", "\n", "\n", "\n", "\n", "\n", "10\n", "<xml-close-tag>\n", "\n", "\n", "\n", "1->10\n", "\n", "\n", "\n", "\n", "\n", "3\n", "< (60)\n", "\n", "\n", "\n", "2->3\n", "\n", "\n", "\n", "\n", "\n", "4\n", "<id>\n", "\n", "\n", "\n", "2->4\n", "\n", "\n", "\n", "\n", "\n", "6\n", "> (62)\n", "\n", "\n", "\n", "2->6\n", "\n", "\n", "\n", "\n", "\n", "5\n", "html\n", "\n", "\n", "\n", "4->5\n", "\n", "\n", "\n", "\n", "\n", "8\n", "<text>\n", "\n", "\n", "\n", "7->8\n", "\n", "\n", "\n", "\n", "\n", "9\n", "Text\n", "\n", "\n", "\n", "8->9\n", "\n", "\n", "\n", "\n", "\n", "11\n", "</\n", "\n", "\n", "\n", "10->11\n", "\n", "\n", "\n", "\n", "\n", "12\n", "<id>\n", "\n", "\n", "\n", "10->12\n", "\n", "\n", "\n", "\n", "\n", "14\n", "> (62)\n", "\n", "\n", "\n", "10->14\n", "\n", "\n", "\n", "\n", "\n", "13\n", "html\n", "\n", "\n", "\n", "12->13\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "0\n", "<start>\n", "\n", "\n", "\n", "1\n", "<xml-tree>\n", "\n", "\n", "\n", "0->1\n", "\n", "\n", "\n", "\n", "\n", "2\n", "<xml-open-tag>\n", "\n", "\n", "\n", "1->2\n", "\n", "\n", "\n", "\n", "\n", "7\n", "<xml-tree>\n", "\n", "\n", "\n", "1->7\n", "\n", "\n", "\n", "\n", "\n", "14\n", "<xml-close-tag>\n", "\n", "\n", "\n", "1->14\n", "\n", "\n", "\n", "\n", "\n", "3\n", "< (60)\n", "\n", "\n", "\n", "2->3\n", "\n", "\n", "\n", "\n", "\n", "4\n", "<id>\n", "\n", "\n", "\n", "2->4\n", "\n", "\n", "\n", "\n", "\n", "6\n", "> (62)\n", "\n", "\n", "\n", "2->6\n", "\n", "\n", "\n", "\n", "\n", "5\n", "html\n", "\n", "\n", "\n", "4->5\n", "\n", "\n", "\n", "\n", "\n", "8\n", "<xml-tree>\n", "\n", "\n", "\n", "7->8\n", "\n", "\n", "\n", "\n", "\n", "11\n", "<xml-tree>\n", "\n", "\n", "\n", "7->11\n", "\n", "\n", "\n", "\n", "\n", "9\n", "<text>\n", "\n", "\n", "\n", "8->9\n", "\n", "\n", "\n", "\n", "\n", "10\n", "T (84)\n", "\n", "\n", "\n", "9->10\n", "\n", "\n", "\n", "\n", "\n", "12\n", "<text>\n", "\n", "\n", "\n", "11->12\n", "\n", "\n", "\n", "\n", "\n", "13\n", "ext\n", "\n", "\n", "\n", "12->13\n", "\n", "\n", "\n", "\n", "\n", "15\n", "</\n", "\n", "\n", "\n", "14->15\n", "\n", "\n", "\n", "\n", "\n", "16\n", "<id>\n", "\n", "\n", "\n", "14->16\n", "\n", "\n", "\n", "\n", "\n", "18\n", "> (62)\n", "\n", "\n", "\n", "14->18\n", "\n", "\n", "\n", "\n", "\n", "17\n", "html\n", "\n", "\n", "\n", "16->17\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "0\n", "<start>\n", "\n", "\n", "\n", "1\n", "<xml-tree>\n", "\n", "\n", "\n", "0->1\n", "\n", "\n", "\n", "\n", "\n", "2\n", "<xml-open-tag>\n", "\n", "\n", "\n", "1->2\n", "\n", "\n", "\n", "\n", "\n", "7\n", "<xml-tree>\n", "\n", "\n", "\n", "1->7\n", "\n", "\n", "\n", "\n", "\n", "14\n", "<xml-close-tag>\n", "\n", "\n", "\n", "1->14\n", "\n", "\n", "\n", "\n", "\n", "3\n", "< (60)\n", "\n", "\n", "\n", "2->3\n", "\n", "\n", "\n", "\n", "\n", "4\n", "<id>\n", "\n", "\n", "\n", "2->4\n", "\n", "\n", "\n", "\n", "\n", "6\n", "> (62)\n", "\n", "\n", "\n", "2->6\n", "\n", "\n", "\n", "\n", "\n", "5\n", "html\n", "\n", "\n", "\n", "4->5\n", "\n", "\n", "\n", "\n", "\n", "8\n", "<xml-tree>\n", "\n", "\n", "\n", "7->8\n", "\n", "\n", "\n", "\n", "\n", "11\n", "<xml-tree>\n", "\n", "\n", "\n", "7->11\n", "\n", "\n", "\n", "\n", "\n", "9\n", "<text>\n", "\n", "\n", "\n", "8->9\n", "\n", "\n", "\n", "\n", "\n", "10\n", "Te\n", "\n", "\n", "\n", "9->10\n", "\n", "\n", "\n", "\n", "\n", "12\n", "<text>\n", "\n", "\n", "\n", "11->12\n", "\n", "\n", "\n", "\n", "\n", "13\n", "xt\n", "\n", "\n", "\n", "12->13\n", "\n", "\n", "\n", "\n", "\n", "15\n", "</\n", "\n", "\n", "\n", "14->15\n", "\n", "\n", "\n", "\n", "\n", "16\n", "<id>\n", "\n", "\n", "\n", "14->16\n", "\n", "\n", "\n", "\n", "\n", "18\n", "> (62)\n", "\n", "\n", "\n", "14->18\n", "\n", "\n", "\n", "\n", "\n", "17\n", "html\n", "\n", "\n", "\n", "16->17\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "0\n", "<start>\n", "\n", "\n", "\n", "1\n", "<xml-tree>\n", "\n", "\n", "\n", "0->1\n", "\n", "\n", "\n", "\n", "\n", "2\n", "<xml-open-tag>\n", "\n", "\n", "\n", "1->2\n", "\n", "\n", "\n", "\n", "\n", "7\n", "<xml-tree>\n", "\n", "\n", "\n", "1->7\n", "\n", "\n", "\n", "\n", "\n", "18\n", "<xml-close-tag>\n", "\n", "\n", "\n", "1->18\n", "\n", "\n", "\n", "\n", "\n", "3\n", "< (60)\n", "\n", "\n", "\n", "2->3\n", "\n", "\n", "\n", "\n", "\n", "4\n", "<id>\n", "\n", "\n", "\n", "2->4\n", "\n", "\n", "\n", "\n", "\n", "6\n", "> (62)\n", "\n", "\n", "\n", "2->6\n", "\n", "\n", "\n", "\n", "\n", "5\n", "html\n", "\n", "\n", "\n", "4->5\n", "\n", "\n", "\n", "\n", "\n", "8\n", "<xml-tree>\n", "\n", "\n", "\n", "7->8\n", "\n", "\n", "\n", "\n", "\n", "15\n", "<xml-tree>\n", "\n", "\n", "\n", "7->15\n", "\n", "\n", "\n", "\n", "\n", "9\n", "<xml-tree>\n", "\n", "\n", "\n", "8->9\n", "\n", "\n", "\n", "\n", "\n", "12\n", "<xml-tree>\n", "\n", "\n", "\n", "8->12\n", "\n", "\n", "\n", "\n", "\n", "10\n", "<text>\n", "\n", "\n", "\n", "9->10\n", "\n", "\n", "\n", "\n", "\n", "11\n", "T (84)\n", "\n", "\n", "\n", "10->11\n", "\n", "\n", "\n", "\n", "\n", "13\n", "<text>\n", "\n", "\n", "\n", "12->13\n", "\n", "\n", "\n", "\n", "\n", "14\n", "e (101)\n", "\n", "\n", "\n", "13->14\n", "\n", "\n", "\n", "\n", "\n", "16\n", "<text>\n", "\n", "\n", "\n", "15->16\n", "\n", "\n", "\n", "\n", "\n", "17\n", "xt\n", "\n", "\n", "\n", "16->17\n", "\n", "\n", "\n", "\n", "\n", "19\n", "</\n", "\n", "\n", "\n", "18->19\n", "\n", "\n", "\n", "\n", "\n", "20\n", "<id>\n", "\n", "\n", "\n", "18->20\n", "\n", "\n", "\n", "\n", "\n", "22\n", "> (62)\n", "\n", "\n", "\n", "18->22\n", "\n", "\n", "\n", "\n", "\n", "21\n", "html\n", "\n", "\n", "\n", "20->21\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "0\n", "<start>\n", "\n", "\n", "\n", "1\n", "<xml-tree>\n", "\n", "\n", "\n", "0->1\n", "\n", "\n", "\n", "\n", "\n", "2\n", "<xml-open-tag>\n", "\n", "\n", "\n", "1->2\n", "\n", "\n", "\n", "\n", "\n", "7\n", "<xml-tree>\n", "\n", "\n", "\n", "1->7\n", "\n", "\n", "\n", "\n", "\n", "14\n", "<xml-close-tag>\n", "\n", "\n", "\n", "1->14\n", "\n", "\n", "\n", "\n", "\n", "3\n", "< (60)\n", "\n", "\n", "\n", "2->3\n", "\n", "\n", "\n", "\n", "\n", "4\n", "<id>\n", "\n", "\n", "\n", "2->4\n", "\n", "\n", "\n", "\n", "\n", "6\n", "> (62)\n", "\n", "\n", "\n", "2->6\n", "\n", "\n", "\n", "\n", "\n", "5\n", "html\n", "\n", "\n", "\n", "4->5\n", "\n", "\n", "\n", "\n", "\n", "8\n", "<xml-tree>\n", "\n", "\n", "\n", "7->8\n", "\n", "\n", "\n", "\n", "\n", "11\n", "<xml-tree>\n", "\n", "\n", "\n", "7->11\n", "\n", "\n", "\n", "\n", "\n", "9\n", "<text>\n", "\n", "\n", "\n", "8->9\n", "\n", "\n", "\n", "\n", "\n", "10\n", "Tex\n", "\n", "\n", "\n", "9->10\n", "\n", "\n", "\n", "\n", "\n", "12\n", "<text>\n", "\n", "\n", "\n", "11->12\n", "\n", "\n", "\n", "\n", "\n", "13\n", "t (116)\n", "\n", "\n", "\n", "12->13\n", "\n", "\n", "\n", "\n", "\n", "15\n", "</\n", "\n", "\n", "\n", "14->15\n", "\n", "\n", "\n", "\n", "\n", "16\n", "<id>\n", "\n", "\n", "\n", "14->16\n", "\n", "\n", "\n", "\n", "\n", "18\n", "> (62)\n", "\n", "\n", "\n", "14->18\n", "\n", "\n", "\n", "\n", "\n", "17\n", "html\n", "\n", "\n", "\n", "16->17\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "0\n", "<start>\n", "\n", "\n", "\n", "1\n", "<xml-tree>\n", "\n", "\n", "\n", "0->1\n", "\n", "\n", "\n", "\n", "\n", "2\n", "<xml-open-tag>\n", "\n", "\n", "\n", "1->2\n", "\n", "\n", "\n", "\n", "\n", "7\n", "<xml-tree>\n", "\n", "\n", "\n", "1->7\n", "\n", "\n", "\n", "\n", "\n", "18\n", "<xml-close-tag>\n", "\n", "\n", "\n", "1->18\n", "\n", "\n", "\n", "\n", "\n", "3\n", "< (60)\n", "\n", "\n", "\n", "2->3\n", "\n", "\n", "\n", "\n", "\n", "4\n", "<id>\n", "\n", "\n", "\n", "2->4\n", "\n", "\n", "\n", "\n", "\n", "6\n", "> (62)\n", "\n", "\n", "\n", "2->6\n", "\n", "\n", "\n", "\n", "\n", "5\n", "html\n", "\n", "\n", "\n", "4->5\n", "\n", "\n", "\n", "\n", "\n", "8\n", "<xml-tree>\n", "\n", "\n", "\n", "7->8\n", "\n", "\n", "\n", "\n", "\n", "15\n", "<xml-tree>\n", "\n", "\n", "\n", "7->15\n", "\n", "\n", "\n", "\n", "\n", "9\n", "<xml-tree>\n", "\n", "\n", "\n", "8->9\n", "\n", "\n", "\n", "\n", "\n", "12\n", "<xml-tree>\n", "\n", "\n", "\n", "8->12\n", "\n", "\n", "\n", "\n", "\n", "10\n", "<text>\n", "\n", "\n", "\n", "9->10\n", "\n", "\n", "\n", "\n", "\n", "11\n", "T (84)\n", "\n", "\n", "\n", "10->11\n", "\n", "\n", "\n", "\n", "\n", "13\n", "<text>\n", "\n", "\n", "\n", "12->13\n", "\n", "\n", "\n", "\n", "\n", "14\n", "ex\n", "\n", "\n", "\n", "13->14\n", "\n", "\n", "\n", "\n", "\n", "16\n", "<text>\n", "\n", "\n", "\n", "15->16\n", "\n", "\n", "\n", "\n", "\n", "17\n", "t (116)\n", "\n", "\n", "\n", "16->17\n", "\n", "\n", "\n", "\n", "\n", "19\n", "</\n", "\n", "\n", "\n", "18->19\n", "\n", "\n", "\n", "\n", "\n", "20\n", "<id>\n", "\n", "\n", "\n", "18->20\n", "\n", "\n", "\n", "\n", "\n", "22\n", "> (62)\n", "\n", "\n", "\n", "18->22\n", "\n", "\n", "\n", "\n", "\n", "21\n", "html\n", "\n", "\n", "\n", "20->21\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "0\n", "<start>\n", "\n", "\n", "\n", "1\n", "<xml-tree>\n", "\n", "\n", "\n", "0->1\n", "\n", "\n", "\n", "\n", "\n", "2\n", "<xml-open-tag>\n", "\n", "\n", "\n", "1->2\n", "\n", "\n", "\n", "\n", "\n", "7\n", "<xml-tree>\n", "\n", "\n", "\n", "1->7\n", "\n", "\n", "\n", "\n", "\n", "18\n", "<xml-close-tag>\n", "\n", "\n", "\n", "1->18\n", "\n", "\n", "\n", "\n", "\n", "3\n", "< (60)\n", "\n", "\n", "\n", "2->3\n", "\n", "\n", "\n", "\n", "\n", "4\n", "<id>\n", "\n", "\n", "\n", "2->4\n", "\n", "\n", "\n", "\n", "\n", "6\n", "> (62)\n", "\n", "\n", "\n", "2->6\n", "\n", "\n", "\n", "\n", "\n", "5\n", "html\n", "\n", "\n", "\n", "4->5\n", "\n", "\n", "\n", "\n", "\n", "8\n", "<xml-tree>\n", "\n", "\n", "\n", "7->8\n", "\n", "\n", "\n", "\n", "\n", "15\n", "<xml-tree>\n", "\n", "\n", "\n", "7->15\n", "\n", "\n", "\n", "\n", "\n", "9\n", "<xml-tree>\n", "\n", "\n", "\n", "8->9\n", "\n", "\n", "\n", "\n", "\n", "12\n", "<xml-tree>\n", "\n", "\n", "\n", "8->12\n", "\n", "\n", "\n", "\n", "\n", "10\n", "<text>\n", "\n", "\n", "\n", "9->10\n", "\n", "\n", "\n", "\n", "\n", "11\n", "Te\n", "\n", "\n", "\n", "10->11\n", "\n", "\n", "\n", "\n", "\n", "13\n", "<text>\n", "\n", "\n", "\n", "12->13\n", "\n", "\n", "\n", "\n", "\n", "14\n", "x (120)\n", "\n", "\n", "\n", "13->14\n", "\n", "\n", "\n", "\n", "\n", "16\n", "<text>\n", "\n", "\n", "\n", "15->16\n", "\n", "\n", "\n", "\n", "\n", "17\n", "t (116)\n", "\n", "\n", "\n", "16->17\n", "\n", "\n", "\n", "\n", "\n", "19\n", "</\n", "\n", "\n", "\n", "18->19\n", "\n", "\n", "\n", "\n", "\n", "20\n", "<id>\n", "\n", "\n", "\n", "18->20\n", "\n", "\n", "\n", "\n", "\n", "22\n", "> (62)\n", "\n", "\n", "\n", "18->22\n", "\n", "\n", "\n", "\n", "\n", "21\n", "html\n", "\n", "\n", "\n", "20->21\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "0\n", "<start>\n", "\n", "\n", "\n", "1\n", "<xml-tree>\n", "\n", "\n", "\n", "0->1\n", "\n", "\n", "\n", "\n", "\n", "2\n", "<xml-open-tag>\n", "\n", "\n", "\n", "1->2\n", "\n", "\n", "\n", "\n", "\n", "7\n", "<xml-tree>\n", "\n", "\n", "\n", "1->7\n", "\n", "\n", "\n", "\n", "\n", "22\n", "<xml-close-tag>\n", "\n", "\n", "\n", "1->22\n", "\n", "\n", "\n", "\n", "\n", "3\n", "< (60)\n", "\n", "\n", "\n", "2->3\n", "\n", "\n", "\n", "\n", "\n", "4\n", "<id>\n", "\n", "\n", "\n", "2->4\n", "\n", "\n", "\n", "\n", "\n", "6\n", "> (62)\n", "\n", "\n", "\n", "2->6\n", "\n", "\n", "\n", "\n", "\n", "5\n", "html\n", "\n", "\n", "\n", "4->5\n", "\n", "\n", "\n", "\n", "\n", "8\n", "<xml-tree>\n", "\n", "\n", "\n", "7->8\n", "\n", "\n", "\n", "\n", "\n", "19\n", "<xml-tree>\n", "\n", "\n", "\n", "7->19\n", "\n", "\n", "\n", "\n", "\n", "9\n", "<xml-tree>\n", "\n", "\n", "\n", "8->9\n", "\n", "\n", "\n", "\n", "\n", "16\n", "<xml-tree>\n", "\n", "\n", "\n", "8->16\n", "\n", "\n", "\n", "\n", "\n", "10\n", "<xml-tree>\n", "\n", "\n", "\n", "9->10\n", "\n", "\n", "\n", "\n", "\n", "13\n", "<xml-tree>\n", "\n", "\n", "\n", "9->13\n", "\n", "\n", "\n", "\n", "\n", "11\n", "<text>\n", "\n", "\n", "\n", "10->11\n", "\n", "\n", "\n", "\n", "\n", "12\n", "T (84)\n", "\n", "\n", "\n", "11->12\n", "\n", "\n", "\n", "\n", "\n", "14\n", "<text>\n", "\n", "\n", "\n", "13->14\n", "\n", "\n", "\n", "\n", "\n", "15\n", "e (101)\n", "\n", "\n", "\n", "14->15\n", "\n", "\n", "\n", "\n", "\n", "17\n", "<text>\n", "\n", "\n", "\n", "16->17\n", "\n", "\n", "\n", "\n", "\n", "18\n", "x (120)\n", "\n", "\n", "\n", "17->18\n", "\n", "\n", "\n", "\n", "\n", "20\n", "<text>\n", "\n", "\n", "\n", "19->20\n", "\n", "\n", "\n", "\n", "\n", "21\n", "t (116)\n", "\n", "\n", "\n", "20->21\n", "\n", "\n", "\n", "\n", "\n", "23\n", "</\n", "\n", "\n", "\n", "22->23\n", "\n", "\n", "\n", "\n", "\n", "24\n", "<id>\n", "\n", "\n", "\n", "22->24\n", "\n", "\n", "\n", "\n", "\n", "26\n", "> (62)\n", "\n", "\n", "\n", "22->26\n", "\n", "\n", "\n", "\n", "\n", "25\n", "html\n", "\n", "\n", "\n", "24->25\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "0\n", "<start>\n", "\n", "\n", "\n", "1\n", "<xml-tree>\n", "\n", "\n", "\n", "0->1\n", "\n", "\n", "\n", "\n", "\n", "2\n", "<xml-open-tag>\n", "\n", "\n", "\n", "1->2\n", "\n", "\n", "\n", "\n", "\n", "7\n", "<xml-tree>\n", "\n", "\n", "\n", "1->7\n", "\n", "\n", "\n", "\n", "\n", "22\n", "<xml-close-tag>\n", "\n", "\n", "\n", "1->22\n", "\n", "\n", "\n", "\n", "\n", "3\n", "< (60)\n", "\n", "\n", "\n", "2->3\n", "\n", "\n", "\n", "\n", "\n", "4\n", "<id>\n", "\n", "\n", "\n", "2->4\n", "\n", "\n", "\n", "\n", "\n", "6\n", "> (62)\n", "\n", "\n", "\n", "2->6\n", "\n", "\n", "\n", "\n", "\n", "5\n", "html\n", "\n", "\n", "\n", "4->5\n", "\n", "\n", "\n", "\n", "\n", "8\n", "<xml-tree>\n", "\n", "\n", "\n", "7->8\n", "\n", "\n", "\n", "\n", "\n", "19\n", "<xml-tree>\n", "\n", "\n", "\n", "7->19\n", "\n", "\n", "\n", "\n", "\n", "9\n", "<xml-tree>\n", "\n", "\n", "\n", "8->9\n", "\n", "\n", "\n", "\n", "\n", "12\n", "<xml-tree>\n", "\n", "\n", "\n", "8->12\n", "\n", "\n", "\n", "\n", "\n", "10\n", "<text>\n", "\n", "\n", "\n", "9->10\n", "\n", "\n", "\n", "\n", "\n", "11\n", "T (84)\n", "\n", "\n", "\n", "10->11\n", "\n", "\n", "\n", "\n", "\n", "13\n", "<xml-tree>\n", "\n", "\n", "\n", "12->13\n", "\n", "\n", "\n", "\n", "\n", "16\n", "<xml-tree>\n", "\n", "\n", "\n", "12->16\n", "\n", "\n", "\n", "\n", "\n", "14\n", "<text>\n", "\n", "\n", "\n", "13->14\n", "\n", "\n", "\n", "\n", "\n", "15\n", "e (101)\n", "\n", "\n", "\n", "14->15\n", "\n", "\n", "\n", "\n", "\n", "17\n", "<text>\n", "\n", "\n", "\n", "16->17\n", "\n", "\n", "\n", "\n", "\n", "18\n", "x (120)\n", "\n", "\n", "\n", "17->18\n", "\n", "\n", "\n", "\n", "\n", "20\n", "<text>\n", "\n", "\n", "\n", "19->20\n", "\n", "\n", "\n", "\n", "\n", "21\n", "t (116)\n", "\n", "\n", "\n", "20->21\n", "\n", "\n", "\n", "\n", "\n", "23\n", "</\n", "\n", "\n", "\n", "22->23\n", "\n", "\n", "\n", "\n", "\n", "24\n", "<id>\n", "\n", "\n", "\n", "22->24\n", "\n", "\n", "\n", "\n", "\n", "26\n", "> (62)\n", "\n", "\n", "\n", "22->26\n", "\n", "\n", "\n", "\n", "\n", "25\n", "html\n", "\n", "\n", "\n", "24->25\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "0\n", "<start>\n", "\n", "\n", "\n", "1\n", "<xml-tree>\n", "\n", "\n", "\n", "0->1\n", "\n", "\n", "\n", "\n", "\n", "2\n", "<xml-open-tag>\n", "\n", "\n", "\n", "1->2\n", "\n", "\n", "\n", "\n", "\n", "7\n", "<xml-tree>\n", "\n", "\n", "\n", "1->7\n", "\n", "\n", "\n", "\n", "\n", "18\n", "<xml-close-tag>\n", "\n", "\n", "\n", "1->18\n", "\n", "\n", "\n", "\n", "\n", "3\n", "< (60)\n", "\n", "\n", "\n", "2->3\n", "\n", "\n", "\n", "\n", "\n", "4\n", "<id>\n", "\n", "\n", "\n", "2->4\n", "\n", "\n", "\n", "\n", "\n", "6\n", "> (62)\n", "\n", "\n", "\n", "2->6\n", "\n", "\n", "\n", "\n", "\n", "5\n", "html\n", "\n", "\n", "\n", "4->5\n", "\n", "\n", "\n", "\n", "\n", "8\n", "<xml-tree>\n", "\n", "\n", "\n", "7->8\n", "\n", "\n", "\n", "\n", "\n", "11\n", "<xml-tree>\n", "\n", "\n", "\n", "7->11\n", "\n", "\n", "\n", "\n", "\n", "9\n", "<text>\n", "\n", "\n", "\n", "8->9\n", "\n", "\n", "\n", "\n", "\n", "10\n", "T (84)\n", "\n", "\n", "\n", "9->10\n", "\n", "\n", "\n", "\n", "\n", "12\n", "<xml-tree>\n", "\n", "\n", "\n", "11->12\n", "\n", "\n", "\n", "\n", "\n", "15\n", "<xml-tree>\n", "\n", "\n", "\n", "11->15\n", "\n", "\n", "\n", "\n", "\n", "13\n", "<text>\n", "\n", "\n", "\n", "12->13\n", "\n", "\n", "\n", "\n", "\n", "14\n", "e (101)\n", "\n", "\n", "\n", "13->14\n", "\n", "\n", "\n", "\n", "\n", "16\n", "<text>\n", "\n", "\n", "\n", "15->16\n", "\n", "\n", "\n", "\n", "\n", "17\n", "xt\n", "\n", "\n", "\n", "16->17\n", "\n", "\n", "\n", "\n", "\n", "19\n", "</\n", "\n", "\n", "\n", "18->19\n", "\n", "\n", "\n", "\n", "\n", "20\n", "<id>\n", "\n", "\n", "\n", "18->20\n", "\n", "\n", "\n", "\n", "\n", "22\n", "> (62)\n", "\n", "\n", "\n", "18->22\n", "\n", "\n", "\n", "\n", "\n", "21\n", "html\n", "\n", "\n", "\n", "20->21\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "0\n", "<start>\n", "\n", "\n", "\n", "1\n", "<xml-tree>\n", "\n", "\n", "\n", "0->1\n", "\n", "\n", "\n", "\n", "\n", "2\n", "<xml-open-tag>\n", "\n", "\n", "\n", "1->2\n", "\n", "\n", "\n", "\n", "\n", "7\n", "<xml-tree>\n", "\n", "\n", "\n", "1->7\n", "\n", "\n", "\n", "\n", "\n", "18\n", "<xml-close-tag>\n", "\n", "\n", "\n", "1->18\n", "\n", "\n", "\n", "\n", "\n", "3\n", "< (60)\n", "\n", "\n", "\n", "2->3\n", "\n", "\n", "\n", "\n", "\n", "4\n", "<id>\n", "\n", "\n", "\n", "2->4\n", "\n", "\n", "\n", "\n", "\n", "6\n", "> (62)\n", "\n", "\n", "\n", "2->6\n", "\n", "\n", "\n", "\n", "\n", "5\n", "html\n", "\n", "\n", "\n", "4->5\n", "\n", "\n", "\n", "\n", "\n", "8\n", "<xml-tree>\n", "\n", "\n", "\n", "7->8\n", "\n", "\n", "\n", "\n", "\n", "11\n", "<xml-tree>\n", "\n", "\n", "\n", "7->11\n", "\n", "\n", "\n", "\n", "\n", "9\n", "<text>\n", "\n", "\n", "\n", "8->9\n", "\n", "\n", "\n", "\n", "\n", "10\n", "T (84)\n", "\n", "\n", "\n", "9->10\n", "\n", "\n", "\n", "\n", "\n", "12\n", "<xml-tree>\n", "\n", "\n", "\n", "11->12\n", "\n", "\n", "\n", "\n", "\n", "15\n", "<xml-tree>\n", "\n", "\n", "\n", "11->15\n", "\n", "\n", "\n", "\n", "\n", "13\n", "<text>\n", "\n", "\n", "\n", "12->13\n", "\n", "\n", "\n", "\n", "\n", "14\n", "ex\n", "\n", "\n", "\n", "13->14\n", "\n", "\n", "\n", "\n", "\n", "16\n", "<text>\n", "\n", "\n", "\n", "15->16\n", "\n", "\n", "\n", "\n", "\n", "17\n", "t (116)\n", "\n", "\n", "\n", "16->17\n", "\n", "\n", "\n", "\n", "\n", "19\n", "</\n", "\n", "\n", "\n", "18->19\n", "\n", "\n", "\n", "\n", "\n", "20\n", "<id>\n", "\n", "\n", "\n", "18->20\n", "\n", "\n", "\n", "\n", "\n", "22\n", "> (62)\n", "\n", "\n", "\n", "18->22\n", "\n", "\n", "\n", "\n", "\n", "21\n", "html\n", "\n", "\n", "\n", "20->21\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "0\n", "<start>\n", "\n", "\n", "\n", "1\n", "<xml-tree>\n", "\n", "\n", "\n", "0->1\n", "\n", "\n", "\n", "\n", "\n", "2\n", "<xml-open-tag>\n", "\n", "\n", "\n", "1->2\n", "\n", "\n", "\n", "\n", "\n", "7\n", "<xml-tree>\n", "\n", "\n", "\n", "1->7\n", "\n", "\n", "\n", "\n", "\n", "22\n", "<xml-close-tag>\n", "\n", "\n", "\n", "1->22\n", "\n", "\n", "\n", "\n", "\n", "3\n", "< (60)\n", "\n", "\n", "\n", "2->3\n", "\n", "\n", "\n", "\n", "\n", "4\n", "<id>\n", "\n", "\n", "\n", "2->4\n", "\n", "\n", "\n", "\n", "\n", "6\n", "> (62)\n", "\n", "\n", "\n", "2->6\n", "\n", "\n", "\n", "\n", "\n", "5\n", "html\n", "\n", "\n", "\n", "4->5\n", "\n", "\n", "\n", "\n", "\n", "8\n", "<xml-tree>\n", "\n", "\n", "\n", "7->8\n", "\n", "\n", "\n", "\n", "\n", "11\n", "<xml-tree>\n", "\n", "\n", "\n", "7->11\n", "\n", "\n", "\n", "\n", "\n", "9\n", "<text>\n", "\n", "\n", "\n", "8->9\n", "\n", "\n", "\n", "\n", "\n", "10\n", "T (84)\n", "\n", "\n", "\n", "9->10\n", "\n", "\n", "\n", "\n", "\n", "12\n", "<xml-tree>\n", "\n", "\n", "\n", "11->12\n", "\n", "\n", "\n", "\n", "\n", "19\n", "<xml-tree>\n", "\n", "\n", "\n", "11->19\n", "\n", "\n", "\n", "\n", "\n", "13\n", "<xml-tree>\n", "\n", "\n", "\n", "12->13\n", "\n", "\n", "\n", "\n", "\n", "16\n", "<xml-tree>\n", "\n", "\n", "\n", "12->16\n", "\n", "\n", "\n", "\n", "\n", "14\n", "<text>\n", "\n", "\n", "\n", "13->14\n", "\n", "\n", "\n", "\n", "\n", "15\n", "e (101)\n", "\n", "\n", "\n", "14->15\n", "\n", "\n", "\n", "\n", "\n", "17\n", "<text>\n", "\n", "\n", "\n", "16->17\n", "\n", "\n", "\n", "\n", "\n", "18\n", "x (120)\n", "\n", "\n", "\n", "17->18\n", "\n", "\n", "\n", "\n", "\n", "20\n", "<text>\n", "\n", "\n", "\n", "19->20\n", "\n", "\n", "\n", "\n", "\n", "21\n", "t (116)\n", "\n", "\n", "\n", "20->21\n", "\n", "\n", "\n", "\n", "\n", "23\n", "</\n", "\n", "\n", "\n", "22->23\n", "\n", "\n", "\n", "\n", "\n", "24\n", "<id>\n", "\n", "\n", "\n", "22->24\n", "\n", "\n", "\n", "\n", "\n", "26\n", "> (62)\n", "\n", "\n", "\n", "22->26\n", "\n", "\n", "\n", "\n", "\n", "25\n", "html\n", "\n", "\n", "\n", "24->25\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "0\n", "<start>\n", "\n", "\n", "\n", "1\n", "<xml-tree>\n", "\n", "\n", "\n", "0->1\n", "\n", "\n", "\n", "\n", "\n", "2\n", "<xml-open-tag>\n", "\n", "\n", "\n", "1->2\n", "\n", "\n", "\n", "\n", "\n", "7\n", "<xml-tree>\n", "\n", "\n", "\n", "1->7\n", "\n", "\n", "\n", "\n", "\n", "22\n", "<xml-close-tag>\n", "\n", "\n", "\n", "1->22\n", "\n", "\n", "\n", "\n", "\n", "3\n", "< (60)\n", "\n", "\n", "\n", "2->3\n", "\n", "\n", "\n", "\n", "\n", "4\n", "<id>\n", "\n", "\n", "\n", "2->4\n", "\n", "\n", "\n", "\n", "\n", "6\n", "> (62)\n", "\n", "\n", "\n", "2->6\n", "\n", "\n", "\n", "\n", "\n", "5\n", "html\n", "\n", "\n", "\n", "4->5\n", "\n", "\n", "\n", "\n", "\n", "8\n", "<xml-tree>\n", "\n", "\n", "\n", "7->8\n", "\n", "\n", "\n", "\n", "\n", "11\n", "<xml-tree>\n", "\n", "\n", "\n", "7->11\n", "\n", "\n", "\n", "\n", "\n", "9\n", "<text>\n", "\n", "\n", "\n", "8->9\n", "\n", "\n", "\n", "\n", "\n", "10\n", "T (84)\n", "\n", "\n", "\n", "9->10\n", "\n", "\n", "\n", "\n", "\n", "12\n", "<xml-tree>\n", "\n", "\n", "\n", "11->12\n", "\n", "\n", "\n", "\n", "\n", "15\n", "<xml-tree>\n", "\n", "\n", "\n", "11->15\n", "\n", "\n", "\n", "\n", "\n", "13\n", "<text>\n", "\n", "\n", "\n", "12->13\n", "\n", "\n", "\n", "\n", "\n", "14\n", "e (101)\n", "\n", "\n", "\n", "13->14\n", "\n", "\n", "\n", "\n", "\n", "16\n", "<xml-tree>\n", "\n", "\n", "\n", "15->16\n", "\n", "\n", "\n", "\n", "\n", "19\n", "<xml-tree>\n", "\n", "\n", "\n", "15->19\n", "\n", "\n", "\n", "\n", "\n", "17\n", "<text>\n", "\n", "\n", "\n", "16->17\n", "\n", "\n", "\n", "\n", "\n", "18\n", "x (120)\n", "\n", "\n", "\n", "17->18\n", "\n", "\n", "\n", "\n", "\n", "20\n", "<text>\n", "\n", "\n", "\n", "19->20\n", "\n", "\n", "\n", "\n", "\n", "21\n", "t (116)\n", "\n", "\n", "\n", "20->21\n", "\n", "\n", "\n", "\n", "\n", "23\n", "</\n", "\n", "\n", "\n", "22->23\n", "\n", "\n", "\n", "\n", "\n", "24\n", "<id>\n", "\n", "\n", "\n", "22->24\n", "\n", "\n", "\n", "\n", "\n", "26\n", "> (62)\n", "\n", "\n", "\n", "22->26\n", "\n", "\n", "\n", "\n", "\n", "25\n", "html\n", "\n", "\n", "\n", "24->25\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "0\n", "<start>\n", "\n", "\n", "\n", "1\n", "<xml-tree>\n", "\n", "\n", "\n", "0->1\n", "\n", "\n", "\n", "\n", "\n", "2\n", "<xml-open-tag>\n", "\n", "\n", "\n", "1->2\n", "\n", "\n", "\n", "\n", "\n", "7\n", "<xml-tree>\n", "\n", "\n", "\n", "1->7\n", "\n", "\n", "\n", "\n", "\n", "18\n", "<xml-close-tag>\n", "\n", "\n", "\n", "1->18\n", "\n", "\n", "\n", "\n", "\n", "3\n", "< (60)\n", "\n", "\n", "\n", "2->3\n", "\n", "\n", "\n", "\n", "\n", "4\n", "<id>\n", "\n", "\n", "\n", "2->4\n", "\n", "\n", "\n", "\n", "\n", "6\n", "> (62)\n", "\n", "\n", "\n", "2->6\n", "\n", "\n", "\n", "\n", "\n", "5\n", "html\n", "\n", "\n", "\n", "4->5\n", "\n", "\n", "\n", "\n", "\n", "8\n", "<xml-tree>\n", "\n", "\n", "\n", "7->8\n", "\n", "\n", "\n", "\n", "\n", "11\n", "<xml-tree>\n", "\n", "\n", "\n", "7->11\n", "\n", "\n", "\n", "\n", "\n", "9\n", "<text>\n", "\n", "\n", "\n", "8->9\n", "\n", "\n", "\n", "\n", "\n", "10\n", "Te\n", "\n", "\n", "\n", "9->10\n", "\n", "\n", "\n", "\n", "\n", "12\n", "<xml-tree>\n", "\n", "\n", "\n", "11->12\n", "\n", "\n", "\n", "\n", "\n", "15\n", "<xml-tree>\n", "\n", "\n", "\n", "11->15\n", "\n", "\n", "\n", "\n", "\n", "13\n", "<text>\n", "\n", "\n", "\n", "12->13\n", "\n", "\n", "\n", "\n", "\n", "14\n", "x (120)\n", "\n", "\n", "\n", "13->14\n", "\n", "\n", "\n", "\n", "\n", "16\n", "<text>\n", "\n", "\n", "\n", "15->16\n", "\n", "\n", "\n", "\n", "\n", "17\n", "t (116)\n", "\n", "\n", "\n", "16->17\n", "\n", "\n", "\n", "\n", "\n", "19\n", "</\n", "\n", "\n", "\n", "18->19\n", "\n", "\n", "\n", "\n", "\n", "20\n", "<id>\n", "\n", "\n", "\n", "18->20\n", "\n", "\n", "\n", "\n", "\n", "22\n", "> (62)\n", "\n", "\n", "\n", "18->22\n", "\n", "\n", "\n", "\n", "\n", "21\n", "html\n", "\n", "\n", "\n", "20->21\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "0\n", "<start>\n", "\n", "\n", "\n", "1\n", "<xml-tree>\n", "\n", "\n", "\n", "0->1\n", "\n", "\n", "\n", "\n", "\n", "2\n", "<xml-open-tag>\n", "\n", "\n", "\n", "1->2\n", "\n", "\n", "\n", "\n", "\n", "7\n", "<xml-tree>\n", "\n", "\n", "\n", "1->7\n", "\n", "\n", "\n", "\n", "\n", "22\n", "<xml-close-tag>\n", "\n", "\n", "\n", "1->22\n", "\n", "\n", "\n", "\n", "\n", "3\n", "< (60)\n", "\n", "\n", "\n", "2->3\n", "\n", "\n", "\n", "\n", "\n", "4\n", "<id>\n", "\n", "\n", "\n", "2->4\n", "\n", "\n", "\n", "\n", "\n", "6\n", "> (62)\n", "\n", "\n", "\n", "2->6\n", "\n", "\n", "\n", "\n", "\n", "5\n", "html\n", "\n", "\n", "\n", "4->5\n", "\n", "\n", "\n", "\n", "\n", "8\n", "<xml-tree>\n", "\n", "\n", "\n", "7->8\n", "\n", "\n", "\n", "\n", "\n", "15\n", "<xml-tree>\n", "\n", "\n", "\n", "7->15\n", "\n", "\n", "\n", "\n", "\n", "9\n", "<xml-tree>\n", "\n", "\n", "\n", "8->9\n", "\n", "\n", "\n", "\n", "\n", "12\n", "<xml-tree>\n", "\n", "\n", "\n", "8->12\n", "\n", "\n", "\n", "\n", "\n", "10\n", "<text>\n", "\n", "\n", "\n", "9->10\n", "\n", "\n", "\n", "\n", "\n", "11\n", "T (84)\n", "\n", "\n", "\n", "10->11\n", "\n", "\n", "\n", "\n", "\n", "13\n", "<text>\n", "\n", "\n", "\n", "12->13\n", "\n", "\n", "\n", "\n", "\n", "14\n", "e (101)\n", "\n", "\n", "\n", "13->14\n", "\n", "\n", "\n", "\n", "\n", "16\n", "<xml-tree>\n", "\n", "\n", "\n", "15->16\n", "\n", "\n", "\n", "\n", "\n", "19\n", "<xml-tree>\n", "\n", "\n", "\n", "15->19\n", "\n", "\n", "\n", "\n", "\n", "17\n", "<text>\n", "\n", "\n", "\n", "16->17\n", "\n", "\n", "\n", "\n", "\n", "18\n", "x (120)\n", "\n", "\n", "\n", "17->18\n", "\n", "\n", "\n", "\n", "\n", "20\n", "<text>\n", "\n", "\n", "\n", "19->20\n", "\n", "\n", "\n", "\n", "\n", "21\n", "t (116)\n", "\n", "\n", "\n", "20->21\n", "\n", "\n", "\n", "\n", "\n", "23\n", "</\n", "\n", "\n", "\n", "22->23\n", "\n", "\n", "\n", "\n", "\n", "24\n", "<id>\n", "\n", "\n", "\n", "22->24\n", "\n", "\n", "\n", "\n", "\n", "26\n", "> (62)\n", "\n", "\n", "\n", "22->26\n", "\n", "\n", "\n", "\n", "\n", "25\n", "html\n", "\n", "\n", "\n", "24->25\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "parser = EarleyParser(XML_GRAMMAR, tokens=XML_TOKENS)\n", "\n", "for tree in parser.parse(\"Text\"):\n", " display(display_tree(tree))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "As we can see, the input starts with an opening tag, contains some text, and ends with a closing tag. Excellent. This is a structure that we can work with." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Building the Fragment Pool\n", "We are now ready to implement our first input-structure-aware mutator. Let's initialize the mutator with the dictionary `fragments` representing the empty fragment pool. It contains a key for each symbol in the grammar (and the empty set as value)." ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.113109Z", "iopub.status.busy": "2024-01-18T17:17:23.112993Z", "iopub.status.idle": "2024-01-18T17:17:23.116067Z", "shell.execute_reply": "2024-01-18T17:17:23.115757Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [], "source": [ "class FragmentMutator(Mutator):\n", " \"\"\"Mutate inputs with input fragments from a pool\"\"\"\n", "\n", " def __init__(self, parser: EarleyParser) -> None:\n", " \"\"\"Initialize empty fragment pool and add parser\"\"\"\n", " self.parser = parser\n", " self.fragments: Dict[str, List[DerivationTree]] = \\\n", " {k: [] for k in self.parser.cgrammar}\n", " super().__init__()" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "The `FragmentMutator` adds fragments recursively. A *fragment* is a subtree in the parse tree and consists of the symbol of the current node and child nodes (i.e., descendant fragments). We can exclude fragments starting with symbols that are tokens, terminals, or not part of the grammar." ] }, { "cell_type": "code", "execution_count": 30, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.117870Z", "iopub.status.busy": "2024-01-18T17:17:23.117746Z", "iopub.status.idle": "2024-01-18T17:17:23.119573Z", "shell.execute_reply": "2024-01-18T17:17:23.119322Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "from Parser import terminals" ] }, { "cell_type": "code", "execution_count": 31, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.121662Z", "iopub.status.busy": "2024-01-18T17:17:23.121520Z", "iopub.status.idle": "2024-01-18T17:17:23.124694Z", "shell.execute_reply": "2024-01-18T17:17:23.124184Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "class FragmentMutator(FragmentMutator):\n", " def add_fragment(self, fragment: DerivationTree) -> None:\n", " \"\"\"Recursively adds fragments to the fragment pool\"\"\"\n", " (symbol, children) = fragment\n", " if not self.is_excluded(symbol):\n", " self.fragments[symbol].append(fragment)\n", " assert children is not None\n", " for subfragment in children:\n", " self.add_fragment(subfragment)\n", "\n", " def is_excluded(self, symbol: str) -> bool:\n", " \"\"\"Returns true if a fragment starting with a specific\n", " symbol and all its decendents can be excluded\"\"\"\n", " return (symbol not in self.parser.grammar() or\n", " symbol in self.parser.tokens or\n", " symbol in terminals(self.parser.grammar()))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Parsing can take a long time, particularly if there is too much ambiguity during the parsing. In order to maintain the efficiency of mutational fuzzing, we will limit the parsing time to 200ms." ] }, { "cell_type": "code", "execution_count": 32, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.126801Z", "iopub.status.busy": "2024-01-18T17:17:23.126697Z", "iopub.status.idle": "2024-01-18T17:17:23.128593Z", "shell.execute_reply": "2024-01-18T17:17:23.128200Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "from Timeout import Timeout" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "The function `add_to_fragment_pool()` parses a seed (no longer than 200ms) and adds all its fragments to the fragment pool. If the parsing of the `seed` was successful, the attribute `seed.has_structure` is set to `True`. Otherwise, it is set to `False`." ] }, { "cell_type": "code", "execution_count": 33, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.130492Z", "iopub.status.busy": "2024-01-18T17:17:23.130383Z", "iopub.status.idle": "2024-01-18T17:17:23.132944Z", "shell.execute_reply": "2024-01-18T17:17:23.132593Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [], "source": [ "class SeedWithStructure(Seed):\n", " \"\"\"Seeds augmented with structure info\"\"\"\n", "\n", " def __init__(self, data: str) -> None:\n", " super().__init__(data)\n", " self.has_structure = False\n", " self.structure: DerivationTree = (\"\", [])" ] }, { "cell_type": "code", "execution_count": 34, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.134864Z", "iopub.status.busy": "2024-01-18T17:17:23.134675Z", "iopub.status.idle": "2024-01-18T17:17:23.137488Z", "shell.execute_reply": "2024-01-18T17:17:23.137158Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "class FragmentMutator(FragmentMutator):\n", " def add_to_fragment_pool(self, seed: SeedWithStructure) -> None:\n", " \"\"\"Adds all fragments of a seed to the fragment pool\"\"\"\n", " try: # only allow quick parsing of 200ms max\n", " with Timeout(0.2):\n", " seed.structure = next(self.parser.parse(seed.data))\n", " self.add_fragment(seed.structure)\n", " seed.has_structure = True\n", " except (SyntaxError, TimeoutError):\n", " seed.has_structure = False" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "Let's see how `FragmentMutator` fills the fragment pool for a simple HTML seed input. We initialize mutator with the `EarleyParser` which itself is initialized with our `XML_GRAMMAR`." ] }, { "cell_type": "code", "execution_count": 35, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.139227Z", "iopub.status.busy": "2024-01-18T17:17:23.139104Z", "iopub.status.idle": "2024-01-18T17:17:23.141136Z", "shell.execute_reply": "2024-01-18T17:17:23.140559Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "from GrammarFuzzer import tree_to_string" ] }, { "cell_type": "code", "execution_count": 36, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.143619Z", "iopub.status.busy": "2024-01-18T17:17:23.143442Z", "iopub.status.idle": "2024-01-18T17:17:23.197471Z", "shell.execute_reply": "2024-01-18T17:17:23.196685Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "|-HelloWorld
\n", "\n", "|-HelloWorld
\n", "|-HelloWorld
\n", "|-Hello\n", "|-Hello\n", "|-Hello\n", "|-World
\n", "|-World
\n", "|-World\n", "|-
\n", "\n", "|-\n", "|-\n", "|-\n", "|-<body>\n", "<xml-openclose-tag>\n", "|-<br/>\n", "<xml-close-tag>\n", "|-\n", "|-\n", "|-\n", "|-\n", "\n", "\n", "\n", "\n", "\n" ] } ], "source": [ "valid_seed = SeedWithStructure(\n", " \"HelloWorld
\")\n", "fragment_mutator = FragmentMutator(EarleyParser(XML_GRAMMAR, tokens=XML_TOKENS))\n", "fragment_mutator.add_to_fragment_pool(valid_seed)\n", "\n", "for key in fragment_mutator.fragments:\n", " print(key)\n", " for f in fragment_mutator.fragments[key]:\n", " print(\"|-%s\" % tree_to_string(f))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "For many symbols in the grammar, we have collected a number of fragments. There are several open and closing tags and several interesting fragments starting with the `xml-tree` symbol.\n", "\n", "***Summary***. For each interesting symbol in the grammar, the `FragmentMutator` has a set of fragments. These fragments are extracted by first parsing the inputs to be mutated." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Fragment-Based Mutation\n", "\n", "We can use the fragments in the fragment pool to generate new inputs. Every seed that is being mutated is disassembled into fragments, and memoized – i.e., disassembled only the first time around." ] }, { "cell_type": "code", "execution_count": 37, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.199647Z", "iopub.status.busy": "2024-01-18T17:17:23.199534Z", "iopub.status.idle": "2024-01-18T17:17:23.202158Z", "shell.execute_reply": "2024-01-18T17:17:23.201868Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "class FragmentMutator(FragmentMutator):\n", " def __init__(self, parser: EarleyParser) -> None:\n", " \"\"\"Initialize mutators\"\"\"\n", " super().__init__(parser)\n", " self.seen_seeds: List[SeedWithStructure] = []\n", "\n", " def mutate(self, seed: SeedWithStructure) -> SeedWithStructure:\n", " \"\"\"Implement structure-aware mutation. Memoize seeds.\"\"\"\n", " if seed not in self.seen_seeds:\n", " self.seen_seeds.append(seed)\n", " self.add_to_fragment_pool(seed)\n", "\n", " return super().mutate(seed)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Our first structural mutation operator is `swap_fragments()`, which choses a random fragment in the given seed and substitutes it with a random fragment from the pool. We make sure that both fragments start with the same symbol. For instance, we may swap a closing tag in the seed HTML by another closing tag from the fragment pool.\n", "\n", "In order to choose a random fragment, the mutator counts all fragments (`n_count`) below the root fragment associated with the start-symbol." ] }, { "cell_type": "code", "execution_count": 38, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.203976Z", "iopub.status.busy": "2024-01-18T17:17:23.203761Z", "iopub.status.idle": "2024-01-18T17:17:23.205884Z", "shell.execute_reply": "2024-01-18T17:17:23.205640Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "class FragmentMutator(FragmentMutator):\n", " def count_nodes(self, fragment: DerivationTree) -> int:\n", " \"\"\"Returns the number of nodes in the fragment\"\"\"\n", " symbol, children = fragment\n", " if self.is_excluded(symbol):\n", " return 0\n", "\n", " assert children is not None\n", " return 1 + sum(map(self.count_nodes, children))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "In order to swap the chosen fragment – identified using the \"global\" variable `self.to_swap` – the seed's parse tree is traversed recursively." ] }, { "cell_type": "code", "execution_count": 39, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.207469Z", "iopub.status.busy": "2024-01-18T17:17:23.207347Z", "iopub.status.idle": "2024-01-18T17:17:23.210014Z", "shell.execute_reply": "2024-01-18T17:17:23.209666Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "class FragmentMutator(FragmentMutator):\n", " def recursive_swap(self, fragment: DerivationTree) -> DerivationTree:\n", " \"\"\"Recursively finds the fragment to swap.\"\"\"\n", " symbol, children = fragment\n", " if self.is_excluded(symbol):\n", " return symbol, children\n", "\n", " self.to_swap -= 1\n", " if self.to_swap == 0: \n", " return random.choice(list(self.fragments[symbol]))\n", "\n", " assert children is not None\n", " return symbol, list(map(self.recursive_swap, children))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Our structural mutator chooses a random number between 2 (i.e., excluding the `start` symbol) and the total number of fragments (`n_count`) and uses the recursive swapping to generate the new fragment. The new fragment is serialized as string and returned as new seed." ] }, { "cell_type": "code", "execution_count": 40, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.211711Z", "iopub.status.busy": "2024-01-18T17:17:23.211581Z", "iopub.status.idle": "2024-01-18T17:17:23.214290Z", "shell.execute_reply": "2024-01-18T17:17:23.214023Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "class FragmentMutator(FragmentMutator):\n", " def __init__(self, parser: EarleyParser) -> None: # type: ignore\n", " super().__init__(parser)\n", " self.mutators = [self.swap_fragment] # type: ignore\n", "\n", " def swap_fragment(self, seed: SeedWithStructure) -> SeedWithStructure:\n", " \"\"\"Substitutes a random fragment with another with the same symbol\"\"\"\n", " if seed.has_structure: # type: ignore\n", " n_nodes = self.count_nodes(seed.structure)\n", " self.to_swap = random.randint(2, n_nodes)\n", " new_structure = self.recursive_swap(seed.structure)\n", "\n", " new_seed = SeedWithStructure(tree_to_string(new_structure))\n", " new_seed.has_structure = True\n", " new_seed.structure = new_structure\n", " return new_seed\n", "\n", " return seed" ] }, { "cell_type": "code", "execution_count": 41, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.215912Z", "iopub.status.busy": "2024-01-18T17:17:23.215800Z", "iopub.status.idle": "2024-01-18T17:17:23.307692Z", "shell.execute_reply": "2024-01-18T17:17:23.307362Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "HelloWorld
\n" ] }, { "data": { "text/plain": [ "HelloWorld
" ] }, "execution_count": 41, "metadata": {}, "output_type": "execute_result" } ], "source": [ "valid_seed = SeedWithStructure(\n", " \"HelloWorld
\")\n", "lf_mutator = FragmentMutator(parser)\n", "print(valid_seed)\n", "lf_mutator.mutate(valid_seed)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "As we can see, one fragment has been substituted by another. \n", "\n", "We can use a similar recursive traversal to *remove* a random fragment." ] }, { "cell_type": "code", "execution_count": 42, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.309547Z", "iopub.status.busy": "2024-01-18T17:17:23.309400Z", "iopub.status.idle": "2024-01-18T17:17:23.311972Z", "shell.execute_reply": "2024-01-18T17:17:23.311607Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "class FragmentMutator(FragmentMutator):\n", " def recursive_delete(self, fragment: DerivationTree) -> DerivationTree:\n", " \"\"\"Recursively finds the fragment to delete\"\"\"\n", " symbol, children = fragment\n", " if self.is_excluded(symbol):\n", " return symbol, children\n", "\n", " self.to_delete -= 1\n", " if self.to_delete == 0:\n", " return symbol, []\n", "\n", " assert children is not None\n", " return symbol, list(map(self.recursive_delete, children))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "We should also define the corresponding structural deletion operator, as well." ] }, { "cell_type": "code", "execution_count": 43, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.313437Z", "iopub.status.busy": "2024-01-18T17:17:23.313336Z", "iopub.status.idle": "2024-01-18T17:17:23.316057Z", "shell.execute_reply": "2024-01-18T17:17:23.315725Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "class FragmentMutator(FragmentMutator):\n", " def __init__(self, parser): # type: ignore\n", " super().__init__(parser)\n", " self.mutators.append(self.delete_fragment)\n", "\n", " def delete_fragment(self, seed: SeedWithStructure) -> SeedWithStructure:\n", " \"\"\"Delete a random fragment\"\"\"\n", " if seed.has_structure:\n", " n_nodes = self.count_nodes(seed.structure)\n", " self.to_delete = random.randint(2, n_nodes)\n", " new_structure = self.recursive_delete(seed.structure)\n", "\n", " new_seed = SeedWithStructure(tree_to_string(new_structure))\n", " new_seed.has_structure = True\n", " new_seed.structure = new_structure\n", " # do not return an empty new_seed\n", " if not new_seed.data:\n", " return seed\n", " else:\n", " return new_seed\n", "\n", " return seed" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "***Summary***. We now have all ingredients for structure-aware fuzzing. Our mutator disassembles all seeds into fragments, which are then added to the fragment pool. Our mutator swaps random fragments in a given seed with fragments of the same type. And our mutator deletes random fragments in a given seed. This allows maintaining a high degree of validity for the generated inputs w.r.t. the given grammar.\n", "\n", "***Try it***. Try adding other structural mutation operators. How would an *add-operator* know the position in a given seed file, where it is okay to add a fragment starting with a certain symbol?" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Fragment-Based Fuzzing\n", "\n", "We can now define an input-structure aware fuzzer as pioneered in LangFuzz. To implement LangFuzz, we modify our [blackbox mutational fuzzer](GreyboxFuzzer.ipynb#Blackbox-Mutation-based-Fuzzer) to stack up to four structural mutations." ] }, { "cell_type": "code", "execution_count": 44, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.317660Z", "iopub.status.busy": "2024-01-18T17:17:23.317555Z", "iopub.status.idle": "2024-01-18T17:17:23.319682Z", "shell.execute_reply": "2024-01-18T17:17:23.319378Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "class LangFuzzer(AdvancedMutationFuzzer):\n", " \"\"\"Blackbox fuzzer mutating input fragments. Roughly based on `LangFuzz`.\"\"\"\n", "\n", " def create_candidate(self) -> Seed: # type: ignore\n", " \"\"\"Returns an input generated by fuzzing a seed in the population\"\"\"\n", " candidate = self.schedule.choose(self.population)\n", " trials = random.randint(1, 4)\n", " for i in range(trials):\n", " candidate = self.mutator.mutate(candidate)\n", "\n", " return candidate" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "Okay, let's take our first input-structure aware fuzzer for a spin. Being careful, we set n=300 for now." ] }, { "cell_type": "code", "execution_count": 45, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:23.321160Z", "iopub.status.busy": "2024-01-18T17:17:23.321054Z", "iopub.status.idle": "2024-01-18T17:17:39.696937Z", "shell.execute_reply": "2024-01-18T17:17:39.696652Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "text/plain": [ "'It took LangFuzzer 16.37 seconds to generate and execute 300 inputs.'" ] }, "execution_count": 45, "metadata": {}, "output_type": "execute_result" } ], "source": [ "n = 300\n", "runner = FunctionCoverageRunner(my_parser)\n", "mutator = FragmentMutator(EarleyParser(XML_GRAMMAR, tokens=XML_TOKENS))\n", "schedule = PowerSchedule()\n", "\n", "lang_fuzzer = LangFuzzer([valid_seed.data], mutator, schedule)\n", "\n", "start = time.time()\n", "lang_fuzzer.runs(runner, trials=n)\n", "end = time.time()\n", "\n", "\"It took LangFuzzer %0.2f seconds to generate and execute %d inputs.\" % (end - start, n)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "We observe that structural mutation is *sooo very slow*. This is despite our time budget of 200ms for parsing. In contrast, our blackbox fuzzer alone can generate about 10k inputs per second!" ] }, { "cell_type": "code", "execution_count": 46, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:39.698696Z", "iopub.status.busy": "2024-01-18T17:17:39.698576Z", "iopub.status.idle": "2024-01-18T17:17:39.796742Z", "shell.execute_reply": "2024-01-18T17:17:39.796460Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ "'It took a blackbox fuzzer 0.10 seconds to generate and execute 300 inputs.'" ] }, "execution_count": 46, "metadata": {}, "output_type": "execute_result" } ], "source": [ "runner = FunctionCoverageRunner(my_parser)\n", "mutator = Mutator()\n", "schedule = PowerSchedule()\n", "\n", "blackFuzzer = AdvancedMutationFuzzer([valid_seed.data], mutator, schedule)\n", "\n", "start = time.time()\n", "blackFuzzer.runs(runner, trials=n)\n", "end = time.time()\n", "\n", "\"It took a blackbox fuzzer %0.2f seconds to generate and execute %d inputs.\" % (end - start, n)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Indeed, our blackbox fuzzer is done in the blink of an eye.\n", "\n", "***Try it***. We can deal with this overhead using [deferred parsing](https://arxiv.org/abs/1811.09447). Instead of wasting time in the beginning of the fuzzing campaign when a byte-level mutator would make efficient progress, deferred parsing suggests to invest time in structural mutation only later in the fuzzing campaign when it becomes viable." ] }, { "cell_type": "code", "execution_count": 47, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:39.798435Z", "iopub.status.busy": "2024-01-18T17:17:39.798316Z", "iopub.status.idle": "2024-01-18T17:17:39.800426Z", "shell.execute_reply": "2024-01-18T17:17:39.800184Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ "'During this fuzzing campaign, the blackbox fuzzer covered 105 statements.'" ] }, "execution_count": 47, "metadata": {}, "output_type": "execute_result" } ], "source": [ "blackbox_coverage = len(runner.coverage())\n", "\"During this fuzzing campaign, the blackbox fuzzer covered %d statements.\" % blackbox_coverage" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Let's print some stats for our fuzzing campaigns. Since we'll need to print stats more often later, we should wrap this into a function. In order to measure coverage, we import the [population_coverage](Coverage.ipynb#Coverage-of-Basic-Fuzzing) function. It takes a set of inputs and a Python function, executes the inputs on that function and collects coverage information. Specifically, it returns a tuple `(all_coverage, cumulative_coverage)` where `all_coverage` is the set of statements covered by all inputs, and `cumulative_coverage` is the number of statements covered as the number of executed inputs increases. We are just interested in the latter to plot coverage over time." ] }, { "cell_type": "code", "execution_count": 48, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:39.801879Z", "iopub.status.busy": "2024-01-18T17:17:39.801776Z", "iopub.status.idle": "2024-01-18T17:17:39.803317Z", "shell.execute_reply": "2024-01-18T17:17:39.803081Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "from Coverage import population_coverage" ] }, { "cell_type": "code", "execution_count": 49, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:39.804836Z", "iopub.status.busy": "2024-01-18T17:17:39.804752Z", "iopub.status.idle": "2024-01-18T17:17:39.807517Z", "shell.execute_reply": "2024-01-18T17:17:39.807248Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "def print_stats(fuzzer, parser: Parser) -> None:\n", " coverage, _ = population_coverage(fuzzer.inputs, my_parser)\n", "\n", " has_structure = 0\n", " for seed in fuzzer.inputs:\n", " # reuse memoized information\n", " if hasattr(seed, \"has_structure\"):\n", " if seed.has_structure: \n", " has_structure += 1\n", " else:\n", " if isinstance(seed, str):\n", " seed = Seed(seed)\n", " try:\n", " with Timeout(0.2):\n", " next(parser.parse(seed.data)) # type: ignore\n", " has_structure += 1\n", " except (SyntaxError, TimeoutError):\n", " pass\n", "\n", " print(\"From the %d generated inputs, %d (%0.2f%%) can be parsed.\\n\"\n", " \"In total, %d statements are covered.\" % (\n", " len(fuzzer.inputs),\n", " has_structure,\n", " 100 * has_structure / len(fuzzer.inputs),\n", " len(coverage)))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "For LangFuzzer, let's see how many of the inputs generated by LangFuzz are valid (i.e., parsable) and how many statements were covered." ] }, { "cell_type": "code", "execution_count": 50, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:39.809329Z", "iopub.status.busy": "2024-01-18T17:17:39.809181Z", "iopub.status.idle": "2024-01-18T17:17:39.910895Z", "shell.execute_reply": "2024-01-18T17:17:39.910572Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "From the 300 generated inputs, 169 (56.33%) can be parsed.\n", "In total, 91 statements are covered.\n" ] } ], "source": [ "print_stats(lang_fuzzer, EarleyParser(XML_GRAMMAR, tokens=XML_TOKENS))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "What are the stats for the mutational fuzzer that uses only byte-level mutation (and no grammars)?" ] }, { "cell_type": "code", "execution_count": 51, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:39.912620Z", "iopub.status.busy": "2024-01-18T17:17:39.912502Z", "iopub.status.idle": "2024-01-18T17:17:45.236717Z", "shell.execute_reply": "2024-01-18T17:17:45.236418Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "From the 300 generated inputs, 31 (10.33%) can be parsed.\n", "In total, 149 statements are covered.\n" ] } ], "source": [ "print_stats(blackFuzzer, EarleyParser(XML_GRAMMAR, tokens=XML_TOKENS))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "***Summary***. Our fragment-level blackbox fuzzer (LangFuzzer) generates *more valid inputs* but achieves *less code coverage* than a fuzzer with our byte-level fuzzer. So, there is some value in generating inputs that do not stick to the provided grammar. " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Integration with Greybox Fuzzing\n", "\n", "In the following we integrate fragment-level blackbox fuzzing (LangFuzz-style) with [byte-level greybox fuzzing](GreyboxFuzzer.ipynb#Greybox-Mutation-based-Fuzzer) (AFL-style). The additional coverage-feedback might allow us to increase code coverage more quickly.\n", "\n", "A [greybox fuzzer](GreyboxFuzzer.ipynb#Greybox-Mutation-based-Fuzzer) adds to the seed population all generated inputs which increase code coverage. Inputs are generated in two stages, stacking up to four structural mutations and up to 32 byte-level mutations." ] }, { "cell_type": "code", "execution_count": 52, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:45.238482Z", "iopub.status.busy": "2024-01-18T17:17:45.238374Z", "iopub.status.idle": "2024-01-18T17:17:45.241568Z", "shell.execute_reply": "2024-01-18T17:17:45.241209Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "class GreyboxGrammarFuzzer(GreyboxFuzzer):\n", " \"\"\"Greybox fuzzer using grammars.\"\"\"\n", "\n", " def __init__(self, seeds: List[str],\n", " byte_mutator: Mutator, tree_mutator: FragmentMutator,\n", " schedule: PowerSchedule) -> None:\n", " \"\"\"Constructor.\n", " `seeds` - set of inputs to mutate.\n", " `byte_mutator` - a byte-level mutator.\n", " `tree_mutator` = a tree-level mutator.\n", " `schedule` - a power schedule.\n", " \"\"\"\n", " super().__init__(seeds, byte_mutator, schedule)\n", " self.tree_mutator = tree_mutator\n", "\n", " def create_candidate(self) -> str:\n", " \"\"\"Returns an input generated by structural mutation \n", " of a seed in the population\"\"\"\n", " seed = cast(SeedWithStructure, self.schedule.choose(self.population))\n", "\n", " # Structural mutation\n", " trials = random.randint(0, 4)\n", " for i in range(trials):\n", " seed = self.tree_mutator.mutate(seed)\n", "\n", " # Byte-level mutation\n", " candidate = seed.data\n", " if trials == 0 or not seed.has_structure or random.randint(0, 1) == 1:\n", " dumb_trials = min(len(seed.data), 1 << random.randint(1, 5))\n", " for i in range(dumb_trials):\n", " candidate = self.mutator.mutate(candidate)\n", "\n", " return candidate" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Let's run our integrated fuzzer with the [standard byte-level mutator](GreyboxFuzzer.ipynb#Mutator-and-Seed) and our [fragment-based structural mutator](#Fragment-based-Mutation) that was introduced above." ] }, { "cell_type": "code", "execution_count": 53, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:45.243398Z", "iopub.status.busy": "2024-01-18T17:17:45.243292Z", "iopub.status.idle": "2024-01-18T17:17:46.754059Z", "shell.execute_reply": "2024-01-18T17:17:46.753749Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "text/plain": [ "'It took the greybox grammar fuzzer 1.51 seconds to generate and execute 300 inputs.'" ] }, "execution_count": 53, "metadata": {}, "output_type": "execute_result" } ], "source": [ "runner = FunctionCoverageRunner(my_parser)\n", "byte_mutator = Mutator()\n", "tree_mutator = FragmentMutator(EarleyParser(XML_GRAMMAR, tokens=XML_TOKENS))\n", "schedule = PowerSchedule()\n", "\n", "gg_fuzzer = GreyboxGrammarFuzzer([valid_seed.data], byte_mutator, tree_mutator, schedule)\n", "\n", "start = time.time()\n", "gg_fuzzer.runs(runner, trials=n)\n", "end = time.time()\n", "\n", "\"It took the greybox grammar fuzzer %0.2f seconds to generate and execute %d inputs.\" % (end - start, n)" ] }, { "cell_type": "code", "execution_count": 54, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:46.755789Z", "iopub.status.busy": "2024-01-18T17:17:46.755675Z", "iopub.status.idle": "2024-01-18T17:17:47.436346Z", "shell.execute_reply": "2024-01-18T17:17:47.436049Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "From the 300 generated inputs, 2 (0.67%) can be parsed.\n", "In total, 169 statements are covered.\n" ] } ], "source": [ "print_stats(gg_fuzzer, EarleyParser(XML_GRAMMAR, tokens=XML_TOKENS))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "***Summary***. Our structural greybox fuzzer \n", "* runs faster than the fragment-based LangFuzzer,\n", "* achieves more coverage than both the fragment-based LangFuzzer and the vanilla blackbox mutational fuzzer, and\n", "* generates fewer valid inputs than even the vanilla blackbox mutational fuzzer." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" }, "toc-hr-collapsed": false }, "source": [ "## Fuzzing with Input Regions\n", "\n", "In the previous section, we have seen that most inputs that are added as seeds are *invalid* w.r.t. our given grammar. Yet, in order to apply our fragment-based mutators, we need it to parse the seed successfully. Otherwise, the entire fragment-based approach becomes useless. The question arises: *How can we derive structure from (invalid) seeds that cannot be parsed successfully?*\n", "\n", "To this end, we introduce the idea of _region-based mutation_, first explored with the [AFLSmart](https://github.com/aflsmart/aflsmart) structural greybox fuzzer \\cite{Pham2018aflsmart}. AFLSmart implements byte-level, fragment-based, and region-based mutation as well as validity-based power schedules. We define *region-based mutators*, where a *region* is a consecutive sequence of bytes in the input that can be associated with a symbol in the grammar." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "The basic idea of fuzzing with input regions is shown in the following diagram. After _parsing_ an input (into a derivation tree), we can identify _regions_ associated with specific subtrees of the derivation tree. These regions can then be deleted or swapped.\n", "\n", "![](PICS/GreyboxGrammarFuzzer-Regions.gif)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "Such regions can also be determined even if the input is incomplete or invalid, allowing for robust parsing." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Determining Symbol Regions\n", "\n", "How can we obtain regions for a given input? The function `chart_parse()` of the [Earley parser](Parser.ipynb#The-Parsing-Algorithm) produces a _parse table_ for a string. For each letter in the string, this table gives the potential symbol and a *region* of neighboring letters that might belong to the same symbol." ] }, { "cell_type": "code", "execution_count": 55, "metadata": { "code_folding": [], "execution": { "iopub.execute_input": "2024-01-18T17:17:47.438159Z", "iopub.status.busy": "2024-01-18T17:17:47.438040Z", "iopub.status.idle": "2024-01-18T17:17:47.498788Z", "shell.execute_reply": "2024-01-18T17:17:47.498510Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "None chart[0]\n", "\n", "---\n", "< chart[1]\n", "\n", "---\n", "h chart[2]\n", ":= h |(1,2)\n", ":= |(1,2)\n", "---\n", "t chart[3]\n", ":= t |(2,3)\n", ":= |(1,3)\n", "---\n", "m chart[4]\n", ":= m |(3,4)\n", ":= |(1,4)\n", "---\n", "l chart[5]\n", ":= l |(4,5)\n", ":= |(1,5)\n", "---\n", "> chart[6]\n", ":= < > |(0,6)\n", "---\n", "< chart[7]\n", "\n", "---\n", "b chart[8]\n", ":= b |(7,8)\n", ":= |(7,8)\n", "---\n", "o chart[9]\n", ":= o |(8,9)\n", ":= |(7,9)\n", "---\n", "d chart[10]\n", ":= d |(9,10)\n", ":= |(7,10)\n", "---\n", "y chart[11]\n", ":= y |(10,11)\n", ":= |(7,11)\n", "---\n", "> chart[12]\n", ":= < > |(6,12)\n", "---\n", "< chart[13]\n", "\n", "---\n", "i chart[14]\n", ":= i |(13,14)\n", ":= |(13,14)\n", "---\n", "> chart[15]\n", ":= < > |(12,15)\n", "---\n", "W chart[16]\n", ":= W |(15,16)\n", ":= |(15,16)\n", ":= |(15,16)\n", "---\n", "o chart[17]\n", ":= o |(16,17)\n", ":= |(15,17)\n", ":= |(16,17)\n", ":= |(15,17)\n", ":= |(16,17)\n", ":= |(15,17)\n", "---\n", "r chart[18]\n", ":= r |(17,18)\n", ":= |(15,18)\n", ":= |(16,18)\n", ":= |(17,18)\n", ":= |(15,18)\n", ":= |(16,18)\n", ":= |(17,18)\n", ":= |(15,18)\n", ":= |(16,18)\n", "---\n", "l chart[19]\n", ":= l |(18,19)\n", ":= |(15,19)\n", ":= |(16,19)\n", ":= |(17,19)\n", ":= |(18,19)\n", ":= |(15,19)\n", ":= |(16,19)\n", ":= |(17,19)\n", ":= |(18,19)\n", ":= |(15,19)\n", ":= |(16,19)\n", ":= |(17,19)\n", "---\n", "d chart[20]\n", ":= d |(19,20)\n", ":= |(15,20)\n", ":= |(16,20)\n", ":= |(17,20)\n", ":= |(18,20)\n", ":= |(19,20)\n", ":= |(15,20)\n", ":= |(16,20)\n", ":= |(17,20)\n", ":= |(18,20)\n", ":= |(19,20)\n", ":= |(15,20)\n", ":= |(16,20)\n", ":= |(17,20)\n", ":= |(18,20)\n", "---\n", "< chart[21]\n", "\n", "---\n", "/ chart[22]\n", "\n", "---\n", "i chart[23]\n", ":= i |(22,23)\n", ":= |(22,23)\n", "---\n", "> chart[24]\n", ":= < / > |(20,24)\n", ":= |(12,24)\n", "---\n", "< chart[25]\n", "\n", "---\n", "b chart[26]\n", ":= b |(25,26)\n", ":= |(25,26)\n", "---\n", "r chart[27]\n", ":= r |(26,27)\n", ":= |(25,27)\n", "---\n", "/ chart[28]\n", "\n", "---\n", "> chart[29]\n", ":= < / > |(24,29)\n", ":= |(24,29)\n", ":= |(12,29)\n", "---\n", "> chart[30]\n", "\n", "---\n", "/ chart[31]\n", "\n", "---\n", "b chart[32]\n", "\n", "---\n", "o chart[33]\n", "\n", "---\n", "d chart[34]\n", "\n", "---\n", "y chart[35]\n", "\n", "---\n", "> chart[36]\n", "\n", "---\n", "< chart[37]\n", "\n", "---\n", "/ chart[38]\n", "\n", "---\n", "h chart[39]\n", "\n", "---\n", "t chart[40]\n", "\n", "---\n", "m chart[41]\n", "\n", "---\n", "l chart[42]\n", "\n", "---\n", "> chart[43]\n", "\n", "---\n" ] } ], "source": [ "invalid_seed = Seed(\"World
>/body>\")\n", "parser = EarleyParser(XML_GRAMMAR, tokens=XML_TOKENS)\n", "table = parser.chart_parse(invalid_seed.data, parser.start_symbol())\n", "for column in table:\n", " print(column)\n", " print(\"---\")" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "The number of columns in this table that are associated with potential symbols correspond to the number of letters that could be parsed successfully. In other words, we can use this table to compute the longest parsable substring." ] }, { "cell_type": "code", "execution_count": 56, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:47.500680Z", "iopub.status.busy": "2024-01-18T17:17:47.500544Z", "iopub.status.idle": "2024-01-18T17:17:47.503082Z", "shell.execute_reply": "2024-01-18T17:17:47.502837Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "'World
>/body>'\n" ] }, { "data": { "text/plain": [ "'World
'" ] }, "execution_count": 56, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cols = [col for col in table if col.states]\n", "parsable = invalid_seed.data[:len(cols)-1]\n", "\n", "print(\"'%s'\" % invalid_seed)\n", "parsable" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "From this, we can compute the *degree of validity* for an input." ] }, { "cell_type": "code", "execution_count": 57, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:47.504681Z", "iopub.status.busy": "2024-01-18T17:17:47.504561Z", "iopub.status.idle": "2024-01-18T17:17:47.506763Z", "shell.execute_reply": "2024-01-18T17:17:47.506516Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "text/plain": [ "'67.4% of the string can be parsed successfully.'" ] }, "execution_count": 57, "metadata": {}, "output_type": "execute_result" } ], "source": [ "validity = 100 * len(parsable) / len(invalid_seed.data)\n", "\n", "\"%0.1f%% of the string can be parsed successfully.\" % validity" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "***Summary***. Unlike input fragments, input regions can be derived even if the parser fails to generate the entire parse tree." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" }, "tags": [] }, "source": [ "### Region-Based Mutation\n", "\n", "To fuzz invalid seeds, the region-based mutator associates symbols from the grammar with regions (i.e., indexed substrings) in the seed. The [overridden](#Building-the-Fragment-Pool) method `add_to_fragment_pool()` first tries to mine the fragments from the seed. If this fails, the region mutator uses [Earley parser](Parser.ipynb#The-Parsing-Algorithm) to derive the parse table. For each column (i.e., letter), it extracts the symbols and corresponding regions. This allows the mutator to store the set of regions with each symbol." ] }, { "cell_type": "code", "execution_count": 58, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:47.508466Z", "iopub.status.busy": "2024-01-18T17:17:47.508349Z", "iopub.status.idle": "2024-01-18T17:17:47.510318Z", "shell.execute_reply": "2024-01-18T17:17:47.510085Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "class SeedWithRegions(SeedWithStructure):\n", " \"\"\"Seeds augmented with structure info\"\"\"\n", "\n", " def __init__(self, data: str) -> None:\n", " super().__init__(data)\n", " self.has_regions = False\n", " self.regions: Dict[str, Set] = {}" ] }, { "cell_type": "code", "execution_count": 59, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:47.511965Z", "iopub.status.busy": "2024-01-18T17:17:47.511829Z", "iopub.status.idle": "2024-01-18T17:17:47.514662Z", "shell.execute_reply": "2024-01-18T17:17:47.514438Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "class RegionMutator(FragmentMutator):\n", " def add_to_fragment_pool(self, seed: SeedWithRegions) -> None: # type: ignore\n", " \"\"\"Mark fragments and regions in a seed file\"\"\"\n", " super().add_to_fragment_pool(seed)\n", " if not seed.has_structure:\n", " try:\n", " with Timeout(0.2):\n", " seed.regions = {k: set() for k in self.parser.cgrammar}\n", " for column in self.parser.chart_parse(seed.data,\n", " self.parser.start_symbol()):\n", " for state in column.states:\n", " if (not self.is_excluded(state.name) and\n", " state.e_col.index - state.s_col.index > 1 and\n", " state.finished()):\n", " seed.regions[state.name].add((state.s_col.index,\n", " state.e_col.index))\n", " seed.has_regions = True\n", " except TimeoutError:\n", " seed.has_regions = False\n", " else:\n", " seed.has_regions = False" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "This is how these regions look like for our invalid seed. A region consists of a start and end index in the seed string." ] }, { "cell_type": "code", "execution_count": 60, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:47.516354Z", "iopub.status.busy": "2024-01-18T17:17:47.516171Z", "iopub.status.idle": "2024-01-18T17:17:47.591136Z", "shell.execute_reply": "2024-01-18T17:17:47.590864Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "\n", "|-(16,20) : orld\n", "|-(12,24) : World\n", "|-(17,20) : rld\n", "|-(18,20) : ld\n", "|-(16,19) : orl\n", "|-(15,17) : Wo\n", "|-(12,29) : World
\n", "|-(17,19) : rl\n", "|-(15,20) : World\n", "|-(24,29) :
\n", "|-(15,19) : Worl\n", "|-(16,18) : or\n", "|-(15,18) : Wor\n", "\n", "|-(6,12) : \n", "|-(12,15) : \n", "|-(0,6) : \n", "\n", "|-(24,29) :
\n", "\n", "|-(20,24) :
\n", "\n", "\n", "\n", "\n", "\n" ] } ], "source": [ "invalid_seed = SeedWithRegions(\"World
>/body>\")\n", "mutator = RegionMutator(parser)\n", "mutator.add_to_fragment_pool(invalid_seed)\n", "for symbol in invalid_seed.regions: # type: ignore\n", " print(symbol)\n", " for (s, e) in invalid_seed.regions[symbol]: # type: ignore\n", " print(\"|-(%d,%d) : %s\" % (s, e, invalid_seed.data[s:e]))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Now that we know which regions in the seed belong to which symbol, we can define region-based swap and delete operators." ] }, { "cell_type": "code", "execution_count": 61, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:47.593046Z", "iopub.status.busy": "2024-01-18T17:17:47.592748Z", "iopub.status.idle": "2024-01-18T17:17:47.595842Z", "shell.execute_reply": "2024-01-18T17:17:47.595594Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "class RegionMutator(RegionMutator):\n", " def swap_fragment(self, seed: SeedWithRegions) -> SeedWithRegions: # type: ignore\n", " \"\"\"Chooses a random region and swaps it with a fragment\n", " that starts with the same symbol\"\"\"\n", " if not seed.has_structure and seed.has_regions:\n", " regions = [r for r in seed.regions\n", " if (len(seed.regions[r]) > 0 and\n", " len(self.fragments[r]) > 0)]\n", " if len(regions) == 0:\n", " return seed\n", "\n", " key = random.choice(list(regions))\n", " s, e = random.choice(list(seed.regions[key]))\n", " swap_structure = random.choice(self.fragments[key])\n", " swap_string = tree_to_string(swap_structure)\n", " new_seed = SeedWithRegions(seed.data[:s] + swap_string + seed.data[e:])\n", " new_seed.has_structure = False\n", " new_seed.has_regions = False\n", " return new_seed\n", " else:\n", " return super().swap_fragment(seed) # type: ignore" ] }, { "cell_type": "code", "execution_count": 62, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:47.597461Z", "iopub.status.busy": "2024-01-18T17:17:47.597370Z", "iopub.status.idle": "2024-01-18T17:17:47.600621Z", "shell.execute_reply": "2024-01-18T17:17:47.600353Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "class RegionMutator(RegionMutator):\n", " def delete_fragment(self, seed: SeedWithRegions) -> SeedWithRegions: # type: ignore\n", " \"\"\"Deletes a random region\"\"\"\n", " if not seed.has_structure and seed.has_regions:\n", " regions = [r for r in seed.regions\n", " if len(seed.regions[r]) > 0]\n", " if len(regions) == 0:\n", " return seed\n", "\n", " key = random.choice(list(regions))\n", " s, e = (0, 0)\n", " while (e - s < 2):\n", " s, e = random.choice(list(seed.regions[key]))\n", "\n", " new_seed = SeedWithRegions(seed.data[:s] + seed.data[e:])\n", " new_seed.has_structure = False\n", " new_seed.has_regions = False\n", " return new_seed\n", " else:\n", " return super().delete_fragment(seed) # type: ignore" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Let's try our new region-based mutator. We add a simple, valid seed to the fragment pool and attempt to mutate the invalid seed." ] }, { "cell_type": "code", "execution_count": 63, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:47.602474Z", "iopub.status.busy": "2024-01-18T17:17:47.602265Z", "iopub.status.idle": "2024-01-18T17:17:47.683963Z", "shell.execute_reply": "2024-01-18T17:17:47.683635Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "World
>/body>\n" ] }, { "data": { "text/plain": [ "WTextd
>/body>" ] }, "execution_count": 63, "metadata": {}, "output_type": "execute_result" } ], "source": [ "simple_seed = SeedWithRegions(\"Text\")\n", "mutator = RegionMutator(parser)\n", "mutator.add_to_fragment_pool(simple_seed)\n", "\n", "print(invalid_seed)\n", "mutator.mutate(invalid_seed)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "***Summary***. We can use the Earley parser to generate a parse table and assign regions in the input to symbols in the grammar. Our region mutators can substitute these regions with fragments from the fragment pool that start with the same symbol, or delete these regions entirely.\n", "\n", "***Try it***. Implement a region pool (similar to the fragment pool) and a `swap_region()` mutator.\n", "You can execute your own code by opening this chapter as Jupyter notebook." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Integration with Greybox Fuzzing\n", "\n", "Let's try our shiny new region mutator by integrating it with our [structure-aware greybox fuzzer](#Integration-with-Greybox-Fuzzing)." ] }, { "cell_type": "code", "execution_count": 64, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:17:47.685973Z", "iopub.status.busy": "2024-01-18T17:17:47.685636Z", "iopub.status.idle": "2024-01-18T17:18:00.122801Z", "shell.execute_reply": "2024-01-18T17:18:00.122450Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "text/plain": [ "'\\nIt took the structural greybox fuzzer with region mutator\\n12.43 seconds to generate and execute 300 inputs.\\n'" ] }, "execution_count": 64, "metadata": {}, "output_type": "execute_result" } ], "source": [ "runner = FunctionCoverageRunner(my_parser)\n", "byte_mutator = Mutator()\n", "tree_mutator = RegionMutator(EarleyParser(XML_GRAMMAR, tokens=XML_TOKENS))\n", "schedule = PowerSchedule()\n", "\n", "regionFuzzer = GreyboxGrammarFuzzer([valid_seed.data], byte_mutator, tree_mutator, schedule)\n", "\n", "start = time.time()\n", "regionFuzzer.runs(runner, trials = n)\n", "end = time.time()\n", "\n", "\"\"\"\n", "It took the structural greybox fuzzer with region mutator\n", "%0.2f seconds to generate and execute %d inputs.\n", "\"\"\" % (end - start, n)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "We can see that the structural greybox fuzzer with region-based mutator is slower than the [fragment-based mutator alone](#Fragment-based-Fuzzing). This is because region-based structural mutation is applicable for *all seeds*. In contrast, fragment-based mutators were applicable only for tiny number of parsable seeds. Otherwise, only (very efficient) byte-level mutators were applied.\n", "\n", "Let's also print the average degree of validity for the seeds in the population." ] }, { "cell_type": "code", "execution_count": 65, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:00.124718Z", "iopub.status.busy": "2024-01-18T17:18:00.124574Z", "iopub.status.idle": "2024-01-18T17:18:00.127277Z", "shell.execute_reply": "2024-01-18T17:18:00.126986Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "def print_more_stats(fuzzer: GreyboxGrammarFuzzer, parser: EarleyParser):\n", " print_stats(fuzzer, parser)\n", " validity = 0.0\n", " total = 0\n", " for seed in fuzzer.population:\n", " if not seed.data: continue\n", " table = parser.chart_parse(seed.data, parser.start_symbol())\n", " cols = [col for col in table if col.states]\n", " parsable = invalid_seed.data[:len(cols)-1]\n", " validity += len(parsable) / len(seed.data)\n", " total += 1\n", "\n", " print(\"On average, %0.1f%% of a seed in the population can be successfully parsed.\" % (100 * validity / total))" ] }, { "cell_type": "code", "execution_count": 66, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:00.128998Z", "iopub.status.busy": "2024-01-18T17:18:00.128891Z", "iopub.status.idle": "2024-01-18T17:18:01.612043Z", "shell.execute_reply": "2024-01-18T17:18:01.611735Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "From the 300 generated inputs, 5 (1.67%) can be parsed.\n", "In total, 168 statements are covered.\n", "On average, 11.0% of a seed in the population can be successfully parsed.\n" ] } ], "source": [ "print_more_stats(regionFuzzer, parser)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "***Summary***. Compared to fragment-based mutation, a greybox fuzzer with region-based mutation achieves *higher coverage* but generates a *smaller number of valid inputs*. The higher coverage is explained by leveraging at least *some* structure for seeds that cannot be parsed successfully.\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Focusing on Valid Seeds\n", "\n", "In the previous section, we have a problem: The low (degree of) validity. To address this problem, a _validity-based power schedule_ assigns more [energy](GreyboxFuzzer.ipynb#Power-Schedules) to seeds that have a higher degree of validity. In other words, the fuzzer _spends more time fuzzing seeds that are more valid_." ] }, { "cell_type": "code", "execution_count": 67, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:01.613782Z", "iopub.status.busy": "2024-01-18T17:18:01.613654Z", "iopub.status.idle": "2024-01-18T17:18:01.615351Z", "shell.execute_reply": "2024-01-18T17:18:01.615103Z" }, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "import math" ] }, { "cell_type": "code", "execution_count": 68, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:01.616877Z", "iopub.status.busy": "2024-01-18T17:18:01.616766Z", "iopub.status.idle": "2024-01-18T17:18:01.620007Z", "shell.execute_reply": "2024-01-18T17:18:01.619723Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "class AFLSmartSchedule(PowerSchedule):\n", " def __init__(self, parser: EarleyParser, exponent: float = 1.0):\n", " self.parser = parser\n", " self.exponent = exponent\n", "\n", " def parsable(self, seed: Seed) -> str:\n", " \"\"\"Returns the substring that is parsable\"\"\"\n", " table = self.parser.chart_parse(seed.data, self.parser.start_symbol())\n", " cols = [col for col in table if col.states]\n", " return seed.data[:len(cols)-1]\n", "\n", " def degree_of_validity(self, seed: Seed) -> float:\n", " \"\"\"Returns the proportion of a seed that is parsable\"\"\"\n", " if not hasattr(seed, 'validity'):\n", " seed.validity = (len(self.parsable(seed)) / len(seed.data) # type: ignore\n", " if len(seed.data) > 0 else 0)\n", " return seed.validity # type: ignore\n", "\n", " def assignEnergy(self, population: Sequence[Seed]):\n", " \"\"\"Assign exponential energy proportional to degree of validity\"\"\"\n", " for seed in population:\n", " seed.energy = ((self.degree_of_validity(seed) / math.log(len(seed.data))) ** self.exponent\n", " if len(seed.data) > 1 else 0)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "Let's play with the degree of validity by passing in a valid seed ..." ] }, { "cell_type": "code", "execution_count": 69, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:01.621532Z", "iopub.status.busy": "2024-01-18T17:18:01.621445Z", "iopub.status.idle": "2024-01-18T17:18:01.632033Z", "shell.execute_reply": "2024-01-18T17:18:01.631719Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Entire seed: Text\n", " Parsable: Text\n" ] }, { "data": { "text/plain": [ "'Degree of validity: 100.00%'" ] }, "execution_count": 69, "metadata": {}, "output_type": "execute_result" } ], "source": [ "smart_schedule = AFLSmartSchedule(parser)\n", "print(\"%11s: %s\" % (\"Entire seed\", simple_seed))\n", "print(\"%11s: %s\" % (\"Parsable\", smart_schedule.parsable(simple_seed)))\n", "\n", "\"Degree of validity: %0.2f%%\" % (100 * smart_schedule.degree_of_validity(simple_seed))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "... and an invalid seed." ] }, { "cell_type": "code", "execution_count": 70, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:01.633897Z", "iopub.status.busy": "2024-01-18T17:18:01.633772Z", "iopub.status.idle": "2024-01-18T17:18:01.650089Z", "shell.execute_reply": "2024-01-18T17:18:01.649800Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Entire seed: World
>/body>\n", " Parsable: World
\n" ] }, { "data": { "text/plain": [ "'Degree of validity: 67.44%'" ] }, "execution_count": 70, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print(\"%11s: %s\" % (\"Entire seed\", invalid_seed))\n", "print(\"%11s: %s\" % (\"Parsable\", smart_schedule.parsable(invalid_seed)))\n", "\n", "\"Degree of validity: %0.2f%%\" % (100 * smart_schedule.degree_of_validity(invalid_seed))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "Excellent. We can compute the degree of validity as the proportion of the string that can be parsed. \n", "\n", "Let's plug the validity-based power schedule into the structure-aware greybox fuzzer." ] }, { "cell_type": "code", "execution_count": 71, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:01.651681Z", "iopub.status.busy": "2024-01-18T17:18:01.651560Z", "iopub.status.idle": "2024-01-18T17:18:27.088964Z", "shell.execute_reply": "2024-01-18T17:18:27.088653Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "text/plain": [ "'It took AFLSmart 25.43 seconds to generate and execute 300 inputs.'" ] }, "execution_count": 71, "metadata": {}, "output_type": "execute_result" } ], "source": [ "runner = FunctionCoverageRunner(my_parser)\n", "byte_mutator = Mutator()\n", "tree_mutator = RegionMutator(EarleyParser(XML_GRAMMAR, tokens=XML_TOKENS))\n", "schedule = AFLSmartSchedule(parser)\n", "\n", "aflsmart_fuzzer = GreyboxGrammarFuzzer([valid_seed.data], byte_mutator, \n", " tree_mutator, schedule)\n", "\n", "start = time.time()\n", "aflsmart_fuzzer.runs(runner, trials=n)\n", "end = time.time()\n", "\n", "\"It took AFLSmart %0.2f seconds to generate and execute %d inputs.\" % (end - start, n)" ] }, { "cell_type": "code", "execution_count": 72, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:27.090574Z", "iopub.status.busy": "2024-01-18T17:18:27.090462Z", "iopub.status.idle": "2024-01-18T17:18:29.717158Z", "shell.execute_reply": "2024-01-18T17:18:29.716773Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "From the 300 generated inputs, 8 (2.67%) can be parsed.\n", "In total, 156 statements are covered.\n", "On average, 15.3% of a seed in the population can be successfully parsed.\n" ] } ], "source": [ "print_more_stats(aflsmart_fuzzer, parser)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "***Summary***. Indeed, by spending more time fuzzing seeds with a higher degree of validity, we also generate inputs with a higher degree of validity. More inputs are entirely valid w.r.t. the given grammar.\n", "\n", "***Read up***. Learn more about region-based fuzzing, deferred parsing, and validity-based schedules in the original AFLSmart paper: \"[Smart Greybox Fuzzing](https://arxiv.org/abs/1811.09447)\" by Pham and co-authors. Download and improve AFLSmart: [https://github.com/aflsmart/aflsmart](https://github.com/aflsmart/aflsmart)." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Mining Seeds\n", "\n", "By now, it should have become clear that the _choice of seeds_ can very much influence the success of fuzzing. One aspect is _variability_ – our seeds should cover as many different features as possible in order to increase coverage. Another aspect, however, is the _likelihood of a seed to induce errors_ – that is, if a seed was involved in causing a failure before, then a mutation of this very seed may be likely to induce failures again. This is because fixes for past failures typically are successful in letting the concrete failure no longer occur, but sometimes may fail to capture all conditions under which a failure may occur. Hence, even if the original failure is fixed, the likelihood of an error in the _surroundings_ of the original failure-inducing input is still higher. It thus pays off to use as seeds _inputs that are known to have caused failures before_.\n", "\n", "To put things in context, Holler's _LangFuzz_ fuzzer used as seeds JavaScript inputs from CVE reports. These were published as failure-inducing inputs at a time when the error already had been fixed; thus they could do no harm anymore. Yet, by using such inputs as seeds, LangFuzz would create plenty of mutations and recombinations of all their features, many of which would (and do) find errors again and again." ] }, { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": true, "run_control": { "read_only": false }, "slideshow": { "slide_type": "slide" } }, "source": [ "## Lessons Learned\n", "\n", "* A **dictionary** is useful to inject important keywords into the generated inputs.\n", "\n", "* **Fragment-based mutation** first disassembles seeds into fragments, and reassembles these fragments to generate new inputs. A *fragment* is a subtree in the seed's parse tree. However, fragment-based mutation requires that the seeds can be parsed successfully, which may not be true for seeds discovered by a coverage-based greybox fuzzer.\n", "\n", "* **Region-based mutation** marks regions in the input as belonging to a certain symbol in the grammar. For instance, it may identify a substring '
' as closing tag. These regions can then be deleted or substituted by fragments or regions belonging to the same symbol. Unlike fragment-based mutation, region-based mutation is applicable to *all* seeds - even those that can be parsed only partially. However, the degree of validity is still quite low for the generated inputs.\n", "\n", "* A **validity-based power schedule** invests more energy into seeds with a higher degree of validity. The inputs that are generated also have a higher degree of validity.\n", "\n", "* **Mining seeds** from repositories of previous failure-inducing inputs results in input fragments associated with past failures, raising the likelihood to find more failures in the vicinity." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" }, "tags": [] }, "source": [ "## Background\n", "\n", "This chapter builds on the following two works:\n", "\n", "* The _LangFuzz_ fuzzer \\cite{Holler2012} is an efficient (and effective!) grammar-based fuzzer for (mostly) JavaScript. It uses the grammar for parsing seeds and recombining their inputs with generated parts and found 2,600 bugs in JavaScript interpreters to date.\n", "\n", "* Smart greybox fuzzing ([AFLSmart](https://github.com/aflsmart/aflsmart)) brings together coverage-based fuzzing and grammar-based (structural) fuzzing, as described in \\cite{Pham2018aflsmart}. The resulting AFLSMART tool has discovered 42 zero-day vulnerabilities in widely-used, well-tested tools and libraries; so far 17 CVEs were assigned." ] }, { "attachments": {}, "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" }, "tags": [] }, "source": [ "Recent fuzzing work also brings together grammar-based fuzzing and coverage.\n", "\n", "* _Superion_ \\cite{Wang2019superion} is equivalent to our section \"Integration with Greybox Fuzzing\", as above – that is, a combination of LangFuzz and Greybox Fuzzing, but no AFL-style byte-level mutation. Superion can improve the code coverage (i.e., 16.7% and 8.8% in line and function coverage) and bug-finding capability over AFL and jsfunfuzz. According to the authors, they found 30 new bugs, among which they discovered 21 new vulnerabilities with 16 CVEs assigned and 3.2K USD bug bounty rewards received.\n", "\n", "* _Nautilus_ \\cite{Aschermann2019nautilus} also combines grammar-based fuzzing with coverage feedback. It maintains the parse tree for all seeds and generated inputs. To allow AFL-style byte-level mutations, it \"collapses\" subtrees back to byte-level representations. This has the advantage of not having to re-parse generated seeds; however, over time, Nautilus degenerates to structure-unaware greybox fuzzing because it does not re-parse collapsed subtrees to reconstitute input structure for later seeds where most of the parse tree is collapsed. Nautilus identified bugs in mruby, PHP, ChakraCore, and in Lua; reporting these bugs was awarded with a sum of 2600 USD and 6 CVEs were assigned.\n", "\n", "* [FormatFuzzer](https://uds-se.github.io/FormatFuzzer/) is a framework for high-efficiency, high-quality generation and parsing of binary inputs. It takes a binary template that describes the format of a binary input and generates an executable that produces and parses the given binary format. From a binary template for GIF, for instance, FormatFuzzer produces a GIF generator - also known as GIF fuzzer. Generators produced by FormatFuzzer are highly efficient, producing thousands of valid test inputs per second. FormatFuzzer operates in black-box settings, but can also integrate with AFL to produce valid inputs that also aim for maximum coverage." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" }, "tags": [] }, "source": [ "## Synopsis\n", "\n", "This chapter introduces advanced methods for language-based grey-box fuzzing inspired by the _LangFuzz_ and _AFLSmart_ fuzzers." ] }, { "attachments": {}, "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Fuzzing with Dictionaries\n", "\n", "Rather than mutating strings randomly, the `DictMutator` class allows inserting tokens from a dictionary, thus increasing fuzzer performance. The dictionary comes as a list of strings, out of which random elements are picked and inserted - in addition to the given mutations such as deleting or inserting individual bytes." ] }, { "cell_type": "code", "execution_count": 73, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:29.719612Z", "iopub.status.busy": "2024-01-18T17:18:29.719464Z", "iopub.status.idle": "2024-01-18T17:18:29.721212Z", "shell.execute_reply": "2024-01-18T17:18:29.720924Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [], "source": [ "dict_mutator = DictMutator([\"\", \"\", \"\", \"='a'\"])" ] }, { "cell_type": "code", "execution_count": 74, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:29.722672Z", "iopub.status.busy": "2024-01-18T17:18:29.722563Z", "iopub.status.idle": "2024-01-18T17:18:29.724530Z", "shell.execute_reply": "2024-01-18T17:18:29.724290Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "He='a'lloWorld
\n", "Hello<title></head><body>World<br/></body></html>\n", "<html><head><title>Hello>body>World
\n", "HelloSWorld
\n", "HelloWorld
body>\n", "HelloWorld
\n", "HelloWorld
\n", "Hellobody>World
\n", "HelloWeorld
\n", "|HelloWorld
\n" ] } ], "source": [ "seeds = [\"HelloWorld
\"]\n", "for i in range(10):\n", " print(dict_mutator.mutate(seeds[0]))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "This `DictMutator` can be used as an argument to `GreyboxFuzzer`:" ] }, { "cell_type": "code", "execution_count": 75, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:29.726428Z", "iopub.status.busy": "2024-01-18T17:18:29.726305Z", "iopub.status.idle": "2024-01-18T17:18:29.740763Z", "shell.execute_reply": "2024-01-18T17:18:29.740456Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "runner = FunctionCoverageRunner(my_parser)\n", "dict_fuzzer = GreyboxFuzzer(seeds, dict_mutator, PowerSchedule())" ] }, { "cell_type": "code", "execution_count": 76, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:29.742441Z", "iopub.status.busy": "2024-01-18T17:18:29.742346Z", "iopub.status.idle": "2024-01-18T17:18:29.746561Z", "shell.execute_reply": "2024-01-18T17:18:29.746313Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [], "source": [ "dict_fuzzer_outcome = dict_fuzzer.runs(runner, trials=5)" ] }, { "cell_type": "code", "execution_count": 77, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:29.748075Z", "iopub.status.busy": "2024-01-18T17:18:29.747989Z", "iopub.status.idle": "2024-01-18T17:18:29.749626Z", "shell.execute_reply": "2024-01-18T17:18:29.749405Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [], "source": [ "# ignore\n", "from ClassDiagram import display_class_hierarchy\n", "from Coverage import Location # minor dependency" ] }, { "cell_type": "code", "execution_count": 78, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:29.751025Z", "iopub.status.busy": "2024-01-18T17:18:29.750942Z", "iopub.status.idle": "2024-01-18T17:18:30.246160Z", "shell.execute_reply": "2024-01-18T17:18:30.245701Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "DictMutator\n", "\n", "\n", "DictMutator\n", "\n", "\n", "\n", "__init__()\n", "\n", "\n", "\n", "insert_from_dictionary()\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "Mutator\n", "\n", "\n", "Mutator\n", "\n", "\n", "\n", "__init__()\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "DictMutator->Mutator\n", "\n", "\n", "\n", "\n", "\n", "Legend\n", "Legend\n", "• \n", "public_method()\n", "• \n", "private_method()\n", "• \n", "overloaded_method()\n", "Hover over names to see doc\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 78, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# ignore\n", "display_class_hierarchy([DictMutator],\n", " public_methods=[\n", " Mutator.__init__,\n", " DictMutator.__init__,\n", " ],\n", " types={'DerivationTree': DerivationTree,\n", " 'Location': Location},\n", " project='fuzzingbook')" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Fuzzing with Input Fragments\n", "\n", "The `LangFuzzer` class introduces a _language-aware_ fuzzer that can recombine fragments from existing inputs – inspired by the highly effective `LangFuzz` fuzzer. At its core is a `FragmentMutator` class that that takes a [_parser_](Parser.ipynb) as argument:" ] }, { "cell_type": "code", "execution_count": 79, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:30.248387Z", "iopub.status.busy": "2024-01-18T17:18:30.248216Z", "iopub.status.idle": "2024-01-18T17:18:30.251156Z", "shell.execute_reply": "2024-01-18T17:18:30.250871Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [], "source": [ "parser = EarleyParser(XML_GRAMMAR, tokens=XML_TOKENS)\n", "mutator = FragmentMutator(parser)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "The fuzzer itself is initialized with a list of seeds, the above `FragmentMutator`, and a power schedule:" ] }, { "cell_type": "code", "execution_count": 80, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:30.252719Z", "iopub.status.busy": "2024-01-18T17:18:30.252609Z", "iopub.status.idle": "2024-01-18T17:18:30.255630Z", "shell.execute_reply": "2024-01-18T17:18:30.255357Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [], "source": [ "seeds = [\"HelloWorld
\"]\n", "schedule = PowerSchedule()\n", "lang_fuzzer = LangFuzzer(seeds, mutator, schedule)" ] }, { "cell_type": "code", "execution_count": 81, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:30.257130Z", "iopub.status.busy": "2024-01-18T17:18:30.256979Z", "iopub.status.idle": "2024-01-18T17:18:30.695479Z", "shell.execute_reply": "2024-01-18T17:18:30.695131Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "HelloWorld
\n", "HelloWorld
\n", "HelloWorld
\n", "\n", "World<br/>World
\n", "HelloWorld
\n", "HelloWorld
\n", "Hello</head><body>World<br/></body></html>\n", "<html><head><title>HelloWorld
\n", "HelloWorld

\n" ] } ], "source": [ "for i in range(10):\n", " print(lang_fuzzer.fuzz())" ] }, { "cell_type": "code", "execution_count": 82, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:30.697094Z", "iopub.status.busy": "2024-01-18T17:18:30.697005Z", "iopub.status.idle": "2024-01-18T17:18:31.091939Z", "shell.execute_reply": "2024-01-18T17:18:31.091562Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "LangFuzzer\n", "\n", "\n", "LangFuzzer\n", "\n", "\n", "\n", "create_candidate()\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "AdvancedMutationFuzzer\n", "\n", "\n", "AdvancedMutationFuzzer\n", "\n", "\n", "\n", "__init__()\n", "\n", "\n", "\n", "fuzz()\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "LangFuzzer->AdvancedMutationFuzzer\n", "\n", "\n", "\n", "\n", "\n", "Fuzzer\n", "\n", "\n", "Fuzzer\n", "\n", "\n", "\n", "__init__()\n", "\n", "\n", "\n", "fuzz()\n", "\n", "\n", "\n", "run()\n", "\n", "\n", "\n", "runs()\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "AdvancedMutationFuzzer->Fuzzer\n", "\n", "\n", "\n", "\n", "\n", "FragmentMutator\n", "\n", "\n", "FragmentMutator\n", "\n", "\n", "\n", "__init__()\n", "\n", "\n", "\n", "add_to_fragment_pool()\n", "\n", "\n", "\n", "add_fragment()\n", "\n", "\n", "\n", "count_nodes()\n", "\n", "\n", "\n", "delete_fragment()\n", "\n", "\n", "\n", "is_excluded()\n", "\n", "\n", "\n", "mutate()\n", "\n", "\n", "\n", "recursive_delete()\n", "\n", "\n", "\n", "recursive_swap()\n", "\n", "\n", "\n", "swap_fragment()\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "Mutator\n", "\n", "\n", "Mutator\n", "\n", "\n", "\n", "__init__()\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "FragmentMutator->Mutator\n", "\n", "\n", "\n", "\n", "\n", "Legend\n", "Legend\n", "• \n", "public_method()\n", "• \n", "private_method()\n", "• \n", "overloaded_method()\n", "Hover over names to see doc\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 82, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# ignore\n", "display_class_hierarchy([LangFuzzer, FragmentMutator],\n", " public_methods=[\n", " Fuzzer.__init__,\n", " Fuzzer.fuzz,\n", " Fuzzer.run,\n", " Fuzzer.runs,\n", " AdvancedMutationFuzzer.__init__,\n", " AdvancedMutationFuzzer.fuzz,\n", " GreyboxFuzzer.run,\n", " Mutator.__init__,\n", " FragmentMutator.__init__,\n", " FragmentMutator.add_to_fragment_pool,\n", " ],\n", " types={'DerivationTree': DerivationTree,\n", " 'Location': Location},\n", " project='fuzzingbook')" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Fuzzing with Input Regions\n", "\n", "The `GreyboxGrammarFuzzer` class uses two mutators:\n", "* a _tree mutator_ (a `RegionMutator` object) that can parse existing strings to identify _regions_ in that string to be swapped or deleted.\n", "* a _byte mutator_ to apply bit- and character-level mutations." ] }, { "cell_type": "code", "execution_count": 83, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:31.093865Z", "iopub.status.busy": "2024-01-18T17:18:31.093725Z", "iopub.status.idle": "2024-01-18T17:18:31.095788Z", "shell.execute_reply": "2024-01-18T17:18:31.095511Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [], "source": [ "tree_mutator = RegionMutator(parser)\n", "byte_mutator = Mutator()" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "The _schedule_ for the `GreyboxGrammarFuzzer` class can be a regular `PowerSchedule` object. However, a more sophisticated schedule is provided by `AFLSmartSchedule`, which assigns more [energy](GreyboxFuzzer.ipynb#Power-Schedules) to seeds that have a higher degree of validity." ] }, { "cell_type": "code", "execution_count": 84, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:31.097462Z", "iopub.status.busy": "2024-01-18T17:18:31.097339Z", "iopub.status.idle": "2024-01-18T17:18:31.099022Z", "shell.execute_reply": "2024-01-18T17:18:31.098774Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [], "source": [ "schedule = AFLSmartSchedule(parser)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "The `GreyboxGrammarFuzzer` constructor takes a set of seeds as well as the two mutators and the schedule:" ] }, { "cell_type": "code", "execution_count": 85, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:31.100482Z", "iopub.status.busy": "2024-01-18T17:18:31.100382Z", "iopub.status.idle": "2024-01-18T17:18:31.103576Z", "shell.execute_reply": "2024-01-18T17:18:31.103237Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [], "source": [ "aflsmart_fuzzer = GreyboxGrammarFuzzer(seeds, byte_mutator, tree_mutator, schedule)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "As it relies on code coverage, it is typically combined with a `FunctionCoverageRunner`:" ] }, { "cell_type": "code", "execution_count": 86, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:31.105048Z", "iopub.status.busy": "2024-01-18T17:18:31.104965Z", "iopub.status.idle": "2024-01-18T17:18:31.466108Z", "shell.execute_reply": "2024-01-18T17:18:31.465825Z" }, "slideshow": { "slide_type": "fragment" } }, "outputs": [], "source": [ "runner = FunctionCoverageRunner(my_parser)\n", "aflsmart_outcome = aflsmart_fuzzer.runs(runner, trials=5)" ] }, { "cell_type": "code", "execution_count": 87, "metadata": { "execution": { "iopub.execute_input": "2024-01-18T17:18:31.467829Z", "iopub.status.busy": "2024-01-18T17:18:31.467737Z", "iopub.status.idle": "2024-01-18T17:18:31.893436Z", "shell.execute_reply": "2024-01-18T17:18:31.892945Z" }, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "GreyboxGrammarFuzzer\n", "\n", "\n", "GreyboxGrammarFuzzer\n", "\n", "\n", "\n", "__init__()\n", "\n", "\n", "\n", "create_candidate()\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "GreyboxFuzzer\n", "\n", "\n", "GreyboxFuzzer\n", "\n", "\n", "\n", "run()\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "GreyboxGrammarFuzzer->GreyboxFuzzer\n", "\n", "\n", "\n", "\n", "\n", "AdvancedMutationFuzzer\n", "\n", "\n", "AdvancedMutationFuzzer\n", "\n", "\n", "\n", "__init__()\n", "\n", "\n", "\n", "fuzz()\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "GreyboxFuzzer->AdvancedMutationFuzzer\n", "\n", "\n", "\n", "\n", "\n", "Fuzzer\n", "\n", "\n", "Fuzzer\n", "\n", "\n", "\n", "__init__()\n", "\n", "\n", "\n", "fuzz()\n", "\n", "\n", "\n", "run()\n", "\n", "\n", "\n", "runs()\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "AdvancedMutationFuzzer->Fuzzer\n", "\n", "\n", "\n", "\n", "\n", "AFLSmartSchedule\n", "\n", "\n", "AFLSmartSchedule\n", "\n", "\n", "\n", "__init__()\n", "\n", "\n", "\n", "assignEnergy()\n", "\n", "\n", "\n", "degree_of_validity()\n", "\n", "\n", "\n", "parsable()\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "PowerSchedule\n", "\n", "\n", "PowerSchedule\n", "\n", "\n", "\n", "__init__()\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "AFLSmartSchedule->PowerSchedule\n", "\n", "\n", "\n", "\n", "\n", "RegionMutator\n", "\n", "\n", "RegionMutator\n", "\n", "\n", "\n", "add_to_fragment_pool()\n", "\n", "\n", "\n", "delete_fragment()\n", "\n", "\n", "\n", "swap_fragment()\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "FragmentMutator\n", "\n", "\n", "FragmentMutator\n", "\n", "\n", "\n", "__init__()\n", "\n", "\n", "\n", "add_to_fragment_pool()\n", "\n", "\n", "\n", "add_fragment()\n", "\n", "\n", "\n", "count_nodes()\n", "\n", "\n", "\n", "delete_fragment()\n", "\n", "\n", "\n", "is_excluded()\n", "\n", "\n", "\n", "mutate()\n", "\n", "\n", "\n", "recursive_delete()\n", "\n", "\n", "\n", "recursive_swap()\n", "\n", "\n", "\n", "swap_fragment()\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "RegionMutator->FragmentMutator\n", "\n", "\n", "\n", "\n", "\n", "Mutator\n", "\n", "\n", "Mutator\n", "\n", "\n", "\n", "__init__()\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "FragmentMutator->Mutator\n", "\n", "\n", "\n", "\n", "\n", "Legend\n", "Legend\n", "• \n", "public_method()\n", "• \n", "private_method()\n", "• \n", "overloaded_method()\n", "Hover over names to see doc\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 87, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# ignore\n", "display_class_hierarchy([GreyboxGrammarFuzzer, AFLSmartSchedule, RegionMutator],\n", " public_methods=[\n", " Fuzzer.__init__,\n", " Fuzzer.fuzz,\n", " Fuzzer.run,\n", " Fuzzer.runs,\n", " AdvancedMutationFuzzer.__init__,\n", " AdvancedMutationFuzzer.fuzz,\n", " GreyboxFuzzer.run,\n", " GreyboxGrammarFuzzer.__init__,\n", " GreyboxGrammarFuzzer.run,\n", " AFLSmartSchedule.__init__,\n", " PowerSchedule.__init__,\n", " Mutator.__init__,\n", " FragmentMutator.__init__,\n", " FragmentMutator.add_to_fragment_pool,\n", " RegionMutator.__init__,\n", " ],\n", " types={'DerivationTree': DerivationTree,\n", " 'Location': Location},\n", " project='fuzzingbook')" ] }, { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": false, "run_control": { "read_only": false }, "slideshow": { "slide_type": "slide" } }, "source": [ "## Next Steps\n", "\n", "This chapter closes our discussion of syntactic fuzzing techniques.\n", "\n", "* In the [next chapter](Reducer.ipynb), we discuss how to _reduce failure-inducing inputs_ after a failure, keeping only those portions of the input that are necessary for reproducing the failure.\n", "* The [next part](04_Semantical_Fuzzing.ipynb) will go from syntactical to _semantical_ fuzzing, considering code semantics for targeted test generation." ] }, { "cell_type": "markdown", "metadata": { "button": false, "new_sheet": true, "run_control": { "read_only": false }, "slideshow": { "slide_type": "slide" } }, "source": [ "## Exercises\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "skip" }, "solution2": "hidden", "solution2_first": true }, "source": [ "### Exercise 1: The Big Greybox Fuzzer Shoot-Out\n", "\n", "Use our implementations of greybox techniques and evaluate them on a benchmark. Which technique (and which sub-technique) has which impact and why? Also take into account the specific approaches of Superion \\cite{Wang2019superion} and Nautilus \\cite{Aschermann2019nautilus}, possibly even on the benchmarks used by these approaches." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "skip" }, "solution2": "hidden" }, "source": [ "**Solution.** To be added." ] } ], "metadata": { "ipub": { "bibliography": "fuzzingbook.bib", "toc": true }, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.2" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": true, "title_cell": "", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": true }, "toc-autonumbering": false, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false }, "vscode": { "interpreter": { "hash": "4185989cf89c47c310c2629adcadd634093b57a2c49dffb5ae8d0d14fa302f2b" } } }, "nbformat": 4, "nbformat_minor": 4 }