Giter Club home page Giter Club logo

jtro0 / project_afl Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 38.58 MB

A directed fuzzer based on AFLplusplus making use of git commits to target most frequently, or recently, updated functions.

Python 3.51% Shell 5.37% Makefile 3.10% C 58.02% Dockerfile 0.10% C++ 11.91% Rust 0.61% JavaScript 0.36% TypeScript 0.23% Rich Text Format 0.01% Java 0.04% CodeQL 0.02% HTML 8.54% Max 0.01% PHP 0.06% XSLT 0.60% Clean 0.29% Lua 6.06% CSS 1.17%
aflplusplus fuzzer fuzzing magma

project_afl's Introduction

Project System Testing Fuzzer

A directed fuzzer based on AFLplusplus making use of git commits to target most frequently, or recently, updated functions.

How to run

With Magma

Magma can be used to run this fuzzer. It has been included in this repo, but can also be cloned as usual. The build scripts need to be copied to make it work. These can be found in magma/fuzzers/pst_aflplusplus(_recent_commit).

To run with magma, simply execute the run.sh.

Bare

Follow the instructions here on how to build regular AFLplusplus. Also instrument your target binary, build your target according to their instructions.

Before running, we need to gather heuristic information and find where the functions are in the bitmap.

First, run python3 heuristics/heuristic_diff.py $TARGET -H 0. Set the environment variable TARGET to the git repo of the target. Also this script accepts -H 0 and -H 1, the former option is most frequently updated functions, the latter is most recently updated. See python3 heuristics/heuristic_diff.py for help. Save this file, somewhere like $OUT/heuristics.txt.

Next, analyse the instrumented binary with our Ghidra script. Download and install Ghida, and its dependencies from their github: Ghidra. Run our headless script as follows: sh ghidra_scripts/run_headless.sh $PROG ghidra_scripts/get_bitmap_offsets.py $OUT/heuristics.txt $OUT/output_bitmap 10 Before running this, be sure to set the set environment variables $GHIDRA_ROOT, root folder of your Ghidra installation, $PROG, the instrumented binary needed to analyse, and $OUT which is the output folder. The last variable can be set to any integer, and represents the max-depth the script takes which recursively searching. This will write to file $OUT/output_bitmap which we will need for fuzzing.

Lastly, fuzz! The following command will run AFLplusplus with our weights:

afl-fuzz -i input -o output $FUZZARGS -j $OUT/output_bitmap -- $PROG $ARGS

It is crucial to give argument -j to run with our fuzzer, otherwise it is default aflplusplus. For more information on how to run AFLplusplus, read their documentation

Results and report

Magma even comes with data collecting and self reporting scripts. These scripts are found in magma/tools/report_df. To read more on how to use these, refer to the magma documentations.

Our generated report can be found here, definetly check it out!

Troubleshoot

It is stuck at RUN /magma/fuzzers/afl_asan/instrument.sh

It is not stuck, it just takes a really long time sometimes (more than 5 hours at times). Do not worry, if you have done this once you can reuse the docker image and cache. It is only needed once.

core_pattern

It can be that the fuzzer encounters a warning message to enable core_pattern. To do so execute the following as root:

#  echo core > /proc/sys/kernel/core_pattern

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.