All Projects → lifting-bits → anvill

lifting-bits / anvill

Licence: AGPL-3.0 license
anvill forges beautiful LLVM bitcode out of raw machine code

Programming Languages

LLVM
166 projects
C++
36643 projects - #6 most used programming language
python
139335 projects - #7 most used programming language
CMake
9771 projects
shell
77523 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to anvill

Bytecoder
Rich Domain Model for JVM Bytecode and Framework to interpret and transpile it.
Stars: ✭ 401 (+75.88%)
Mutual labels:  llvm, decompiler
doc
Design documents related to the decompilation pipeline.
Stars: ✭ 23 (-89.91%)
Mutual labels:  llvm, decompiler
Fcd
An optimizing decompiler
Stars: ✭ 622 (+172.81%)
Mutual labels:  llvm, decompiler
Decomp
Components of a decompilation pipeline.
Stars: ✭ 343 (+50.44%)
Mutual labels:  llvm, decompiler
Rellic
Rellic produces goto-free C output from LLVM bitcode
Stars: ✭ 234 (+2.63%)
Mutual labels:  llvm, decompiler
llvm-semantics
Formal semantics of LLVM IR in K
Stars: ✭ 42 (-81.58%)
Mutual labels:  llvm
IDR
Interactive Delphi Reconstructor (Pascal version)
Stars: ✭ 40 (-82.46%)
Mutual labels:  decompiler
tools.decompiler
A decompiler for clojure, in clojure
Stars: ✭ 66 (-71.05%)
Mutual labels:  decompiler
llvm-package-windows
Provides LLVM binary packages for an (almost) complete Windows build matrix. Built and packaged by GitHub Actions.
Stars: ✭ 77 (-66.23%)
Mutual labels:  llvm
pymlir
Python interface for MLIR - the Multi-Level Intermediate Representation
Stars: ✭ 84 (-63.16%)
Mutual labels:  llvm
CFI-LB
Adaptive Callsite-sensitive Control Flow Integrity - EuroS&P'19
Stars: ✭ 13 (-94.3%)
Mutual labels:  llvm
Jazz
Jazz - modern and fast programming language.
Stars: ✭ 86 (-62.28%)
Mutual labels:  llvm
Batch-First
A JIT compiled chess engine which traverses the search tree in batches in a best-first manner, allowing for neural network batching, asynchronous GPU use, and vectorized CPU computations.
Stars: ✭ 27 (-88.16%)
Mutual labels:  llvm
react-native-decompiler
Decompile React Native Android/IOS Bundle.
Stars: ✭ 78 (-65.79%)
Mutual labels:  decompiler
surveyor
A symbolic debugger for C/C++ (via LLVM), machine code, and JVM programs
Stars: ✭ 14 (-93.86%)
Mutual labels:  llvm
open-ops
Open Optimizing Parallelizing System
Stars: ✭ 21 (-90.79%)
Mutual labels:  llvm
manyclangs
Repository hosting unofficial binary pack files for many commits of LLVM
Stars: ✭ 125 (-45.18%)
Mutual labels:  llvm
Cpp2IL
Work-in-progress tool to reverse unity's IL2CPP toolchain.
Stars: ✭ 689 (+202.19%)
Mutual labels:  decompiler
LOWLLVM
参照着OLLVM写的一个混淆库,只要机器上有装LLVM,就可以直接编译拿来用
Stars: ✭ 46 (-79.82%)
Mutual labels:  llvm
verificarlo
A tool for debugging and assessing floating point precision and reproducibility.
Stars: ✭ 51 (-77.63%)
Mutual labels:  llvm

Anvill

Anvill implements simple machine code lifting primitives using Remill. The goal of these components is to produce high quality bitcode, which can then be further decompiled to C (via Clang ASTs) using Rellic.

We define "high quality bitcode" as being similar in form to what the Clang compiler would produce if it were executed on a semantically equivalent C function.

Getting Help

If you are experiencing undocumented problems with Anvill then ask for help in the #binary-lifting channel of the Empire Hacking Slack.

Supported Platforms

Anvill is supported on Linux platforms and has been tested on Ubuntu 20.04.

Dependencies

Most of Anvill's dependencies can be provided by the cxx-common repository. Trail of Bits hosts downloadable, pre-built versions of the libraries for select operating systems, which makes it substantially easier to get up and running with Anvill. Nonetheless, the following table represents most of Anvill's dependencies.

Name Version
Git Latest
CMake 3.14+
Clang 12.0+
Remill Latest
Python 3.9
IDA Pro 7.5+
Binary Ninja Latest

Getting and Building the Code

On Linux

First, update aptitude and get install the baseline dependencies.

dpkg --add-architecture i386

sudo apt-get update
sudo apt-get upgrade

sudo apt-get install \
     git \
     python3.8 \
     python3-pip \
     wget \
     curl \
     build-essential \
     libtinfo-dev \
     lsb-release \
     zlib1g-dev \
     ccache \
     cmake \
     libc6-dev:i386 \
     'libstdc++-*-dev:i386' \
     g++-multilib

# Ubuntu 14.04, 16.04
sudo apt-get install realpath

Assuming we have Remill properly installed the following steps provide a fresh build of Anvill.

# clone anvill repository
git clone https://github.com/lifting-bits/anvill.git

# update the git submodules
git submodule update --init --recursive

# create a build dir
mkdir anvill-build && cd anvill-build

# configure
CC=clang cmake ../anvill

# build
make -j 5

# install
sudo make install

Or you can tell CMake where to find the remill installation prefix by passing -Dremill_DIR="<remill_prefix>/lib/cmake/remill" during configuration.

Anvill's python plugins provide functionality needed to generate a JSON specification that contains information about the contents of a binary. These depend on tools like IDA Pro or Binary Ninja for various analysis tasks.

Given that we have either of the above, we can try out Anvill's machine code lifter on a binary of our choice.

First, we generate a JSON specification from a binary:

From the CLI:

python3 -m anvill --bin_in my_binary --spec_out spec.json

With the IDA plugin:

  1. Open the binary inside IDA
  2. Select Run script in the File menu
  3. Open the anvill/plugins/ida/anvill.py
  4. In the disasm window, place the cursor inside a function
  5. Right click and select Generate ANVILL spec file

Finally we produce LLVM bitcode from a JSON specification

./build/anvill-decompile-json-* --spec spec.json --bc_out out.bc

Running tests

  1. Configure with the following parameter: -DANVILL_ENABLE_TESTS=true
  2. Run the test target: cmake --build build_folder --target test

Docker image

To build via Docker run, specify the architecture, base Ubuntu image and LLVM version. For example, to build Anvill linking against LLVM 14 on Ubuntu 20.04 on AMD64 do:

ARCH=amd64; UBUNTU_VERSION=20.04; LLVM=14; \
   docker build . \
   -t anvill-llvm${LLVM}-ubuntu${UBUNTU_VERSION}-${ARCH} \
   -f Dockerfile \
   --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} \
   --build-arg ARCH=${ARCH} \
   --build-arg LLVM_VERSION=${LLVM}

anvill-specify-bitcode

anvill-specify-bitcode is a tool that produces specifications for all functions contained in an LLVM bitcode module. The purpose of this tool is to enable the creation of a database of specifications for commonly used, often externally- defined functions in binaries (e.g. libc, libc++, libstdc++) in binaries lifted by McSema.

This tool also exists for enabling function declarations for binary code to be written in C or C++, and then translated down into the specification form within a decompiler toolchain.

Finally, this tool exists to enable round-trip testing of LLVM's ISEL lowering and code generation for arbitrary functions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].