Giter Club home page Giter Club logo

grr's Introduction

GRR

Build Status Slack Chat

GRR is pronounced with two fists in the air

GRR is an x86 to amd64 binary translator. GRR was created to emulate and fuzz DECREE challenge binaries.

Features

  • Code cache persistence (avoids translation overheads across separate runs).
  • Optimization of the code cache, including the persisted cache.
  • Multi-processing support (allows multiple communicating, 32-bit processes to be emulated within a single 64-bit address space).
  • Built-in fuzzing engine, which includes Radamsa.
  • Support for self-modifying code (e.g. JIT compilers). Self-modified code can also be persisted.

Anti-features

  • Orchestration. GRR does not manage a fuzzing campaign. An external orchestration system can direct GRR to fuzz a program, and identify a minimal set of maximal coverage-producing inputs.

Compiling

Install System dependcies

sudo apt-get install -y git build-essential
sudo apt-get install -y clang llvm-dev libc++1 libc++-dev

Then we can build GRR. This script will create grr-build in the current working directory, and download remaining dependencies.

./grr/scripts/build.sh

Running

There are two steps to running GRR: snapshotting, and record/replaying. Snapshotting creates an initial image of the binary after execve. Record/replaying takes an input testcase and attempts to replay that testcase. The replay can be recorded or mutated as well.

Snapshotting

You can run grrshot on a CGC challenge binary, or on a statically linked 32-bit ELF version of a CGC challenge binary.

./bin/debug_linux_user/grrshot --num_exe=1 --exe_dir=/path --exe_prefix=CADET_000 --snapshot_dir=/tmp/snapshot

This will create a snapshot of /path/CADET_00001 and store the snapshot into the /tmp/snapshot directory.

Replaying

./bin/debug_linux_user/grrplay --num_exe=1 --snapshot_dir=/tmp/snapshot --persist_dir=/tmp/persist --input=/path/to/testcase 

Replay + Recording

./bin/debug_linux_user/grrplay --num_exe=1 --snapshot_dir=/tmp/snapshot --persist_dir=/tmp/persist --input=/path/to/testcase --output_dir=/tmp/out 

Replay + Recording + Mutating

./bin/debug_linux_user/grrplay --num_exe=1 --snapshot_dir=/tmp/snapshot --persist_dir=/tmp/persist --input=/path/to/testcase --output_dir=/tmp/out --input_mutator=inf_radamsa_spliced

There are many mutators. Some of the mutators are deterministic, and therefore run for a period of time that is proportional to the number of receive system calls in the input testcase. Other mutators are non-deterministic and can run forever. These mutators are prefixed with inf_.

Dependencies

Intel XED

GRR depends on the Intel XED instruction encoder/decoder. XED is licensed under the Apache License.

Radamsa

GRR depends on Radamsa, a high-quality input mutation engine. GRR embeds a version of Radamsa that can be used as a kind of library. Radamsa is licensed under the MIT license.

Other dependencies

GRR depends on gflags.

GRR depends on Frank Thilo's C++ port of the the RSA Data Security, Inc. MD5 Message-Digest Algorithm.

GRR uses Yann Collet's xxHash as part of its code cache index hash table.

History

GRR, short for Granary Record/Replay, is the third iteration of the Granary series of dynamic binary translators. GRR is pgoodman's third dynamic binary translator.

GRR was created for the DARPA Cyber Grand Challenge. It was an essential component of Trail of Bit's CRS. The version of GRR in this repository differs from the CRS version in some important ways.

Don't tread on me!

grr's People

Contributors

dguido avatar ianklatzco avatar pgoodman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grr's Issues

Basic block deduplication in the code cache

When the page hash is invalidated (e.g. because of a JIT), then all further executed code after a re-hash is triggered will be translated without consideration for whether or not code pages unrelated to the modified pages are different. Deduplication should only happen on the block level and not the trace level, and it should not be applied to blocks ending in conditional branches.

Add in the PID into the PathEntry data structure

Code coverage used to be computed differently and stored into a bitset. Since moving over to the path entry recording approach, the PID has stopped being included. Adding it back in would be useful.

Replace GRANARY_ASSERT with glog

GRR uses GRANARY_ASSERT, which is kind of a weird holdover from writing DBTs that can't depend on system libraries, and it's also very C-like. Now that we've made GRR start using cxx-common, we could easily upgrade it to use Google Log's CHECK macro.

[QUESTION] Radamsa to C

What did you use to migrate Radamsa to C?
The code looks like you used something automatic. Is that correct?

Nice work!

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.