Giter Site home page Giter Site logo

afl-dns's Introduction

Fuzzing different dns implementations in OCaml

This is a small attempt at fuzzing different dns implementations (ocaml-dns and udns). The goal is to reveal potential bugs in each implementation, and check if their behaviour is conform or not with the actual standards.

There are two ways to fuzz both implementations :

  • a less guided fuzzing with AflPersistent, which starts with a valid DNS input and mutates this input by switching bits or bytes, by adding or erasing some fields (see http://lcamtuf.coredump.cx/afl/ for more details)
  • a more guided fuzzing with Crowbar, which uses the initial input as a seed for guided Random Number Generators which can be specified in the code itself (see https://github.com/stedolan/crowbar for more details)

Both techniques are used to test parsing functions and the server examples in each implementation.

The fuzz tests are written specifically for ocaml-dns and µDNS : the code is not suited for other implementations, although dumb fuzzing can still be done, using the send_only function defined in crowbar_test.ml.

Installation

You need afl-fuzz, afl-tmin, afl-cmin installed to use all the features of AflPersistent and Crowbar. Clone the repository and compile with the command dune build.

How to use

The Crowbar fuzzing implementation in this project is using the address 127.0.0.1 on port 53. Make sure the fuzzed server is listening to this port.

To start fuzzing, you need to have afl-fuzz and tmux installed. Then, execute scripts/afl_persistent.sh to fuzz ocaml-dns and udns with afl-persistent, or execute scripts/afl_crowbar.sh to fuzz ocaml-dns and udns with Crowbar.

/!\ There is an option to resume past fuzzing attempts if it was stopped, but you should minimize the former outputs for better performances. Most often, there are many redundant outputs, or outputs that have bits not influencing the execution path. To minimize the outputs, execute scripts/minimize.sh. Beware, because minimization takes a lot of time !

Save the logs with scripts/log.sh. It will print logs in the log folder.

Launch unit tests with _build/install/default/bin/testcases. It will output test results in _build/_tests.

Known issues

The scripts are written for computers with eight cores or more. Scripts may not work for computers with less than eight cores. Fuzzing may still be done without parallelization with the following commands :

  • create the folders forAFL/persistent_output, forAFL/persistent_output/odns_output, forAFL/persistent_output/udns_output, forAFL/crowbar_output if they don't exist
  • fuzzing ocaml-dns with AflPersistent : afl-fuzz -i forAFL/input/ -o forAFL/persistent_output/odns_output/ _build/install/default/bin/ocamldns_persistent_test
  • fuzzing µDNS with AflPersistent : afl-fuzz -i forAFL/input/ -o forAFL/persistent_output/udns_output/ _build/install/default/bin/udns_persistent_test
  • fuzzing with Crowbar (fuzzed implementation depends of the current crowbar_test.ml file) : afl-fuzz -i forAFL/input/ -o forAFL/crowbar_output/ _build/install/default/bin/crowbar_test @@

afl-dns's People

Contributors

willy-tan avatar

Stargazers

savi2w avatar Sora Morimoto avatar yomimono avatar Seb Mondet avatar Hannes Mehnert avatar

Watchers

Hannes Mehnert avatar James Cloos avatar C For C's Sake avatar  avatar

Forkers

rfarrey

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.