Coder Social home page Coder Social logo

deki0r / cb-multios Goto Github PK

View Code? Open in Web Editor NEW

This project forked from trailofbits/cb-multios

0.0 1.0 0.0 108.25 MB

DARPA Challenges Binaries for Linux, Windows, and OS X

License: MIT License

CMake 0.01% Shell 0.01% C 85.37% C++ 2.10% Assembly 0.01% Objective-C 0.10% Python 12.39% Makefile 0.01% Logos 0.01% Ruby 0.01% GDB 0.01%

cb-multios's Introduction

DARPA Challenge Binaries on Linux and OS X

Build Status Slack Status

The DARPA Challenge Binaries (CBs) are custom-made programs specifically designed to contain vulnerabilities that represent a wide variety of crashing software flaws. They are more than simple test cases, they approximate real software with enough complexity to stress both manual and automated vulnerability discovery. The CBs come with extensive functionality tests, triggers for introduced bugs, patches, and performance monitoring tools, enabling benchmarking of patching tools and bug mitigation strategies.

The CBs were originally developed for DECREE -- a custom Linux-derived operating system that has no signals, no shared memory, no threads, no standard libc runtime, and only seven system calls -- making them incompatible with most existing analysis tools. In this repository, we have modified the CBs to work on Linux and OS X by replacing the build system and re-implementing CGC system calls via standard libc functionality and native operating system semantics. Scripts have been provided that help modify the CBs to support other operating systems.

The CBs are the best available benchmark to evaluate program analysis tools. Using them, it is possible to make comparisons such as:

  • How good are tools from the Cyber Grand Challenge vs. existing program analysis and bug finding tools?
  • When a new tool is released, how does it stack up against the current best?
  • Do static analysis tools that work with source code find more bugs than dynamic analysis tools that work with binaries?
  • Are tools written for Mac OS X better than tools written for Linux, and are they better than tools written for Windows?

Components

original-challenges

This directory contains all of the unmodified source code for the challenge binaries. Challenges that are not building or are not yet supported are in the multibin directory.

include

This directory contains libcgc, which implements the syscalls to work on non-DECREE systems. libcgc currently works on OS X and Linux.

tools

This folder contains Python scripts that help with modifying, building, and testing the original challenges.

cb_patcher.py

This script will copy all challenges out of original-challenges, modify them as necessary, and place them in processed-challenges. These modifications include:

  • Deleting libcgc.h if it appears anywhere in the challenge source
  • Deleting any C++ definitions that are required for the cgc runtime
  • A set of find/replace definitions in manual_patches.yaml

makefiles.py

This will parse the build_directive.txt in each challenge folder and generate a CMakeLists.txt with the same variables and CFLAGS. This also adds the -nostdinc flag to all challenges, so that they have no access to the system libraries, and can only include their own libraries and libcgc.h.

cb_tester.py

This is a helper script to test all challenges using cb-test. Results are summarized and can be output to an excel spreadsheet. More details in the testing section below.

Building

To build all challenges, run:

$ ./build.sh

To build individual challenges, list them as arguments to build.sh, for example:

$ ./build.sh CADET_00001 CROMU_00001

These commands will build both the patched and unpatched binaries in the bin folder of the respective challenge (processed-challenges/[challenge]/bin/).

Testing

The cb_tester.py utility is a wrapper around cb-test that can be used to test challenges and summarize results. The cb-test tool is a testing utility created for the DARPA Cyber Grand Challenge to verify CBs are fully functional.

cb-test has been modified to use socat as the challenge server instead of cb-server. Further changes include:

  • Always running the challenges on localhost
  • Skipping any checks that verify the file is a valid DECREE binary
  • Lessening sleeps and timeouts to allow tests to run at a reasonable rate

Options

-a / --all: Run tests against all challenges
-c / --chals [CHALS ...]: Run tests against individual challenges
--povs: Only test POVs for every challenge
--polls: Only test POLLs for every challenge
-o / --output OUTPUT: Output a summary of the results to an excel spreadsheet

Example Usage

The following will run tests against all challenges in processed-challenges and save the results to out.xlsx:

$ ./cb_tester.py -a -o out.xlsx

To run tests against only two challenges, do this:

$ ./cb_tester.py -c CADET_00001 CROMU_00001

To test all POVs and save the results, run:

$ ./cb_tester.py -a --povs -o out.xlsx

Types of Tests

All tests are a series of input strings and expected output for a challenge. There are two types of tests that are used:

POV (Proof of Vulnerability): These tests are intended to exploit any vulnerabilities that exist in a challenge. They are expected to pass with the patched versions of the challenges, and in many cases cause the unpatched version to crash.

POLL: These tests are used to check that a challenge is functioning correctly, and are expected to pass with both the unpatched and patched versions of challenges.

Current Status

Porting the Challenge Binaries is a work in progress, and the current status of the porting effort is tracked in the following spreadsheet:

https://docs.google.com/spreadsheets/d/1Z2pinCkOqe1exzpvFgwSG2wH3Z09LP9VJk0bm_5jPe4/edit?usp=sharing

Notes

Windows support is coming soon!

The challenge binaries were written for a platform without a standard libc. Each binary re-implemented just the necessary libc features. Therefore, standard symbols were redefined. By using the -nostdinc flag during compilation, we were able to disable the use of standard library headers, and avoid rewriting a lot of challenge binary code.

We use the CMake build system to enable portability across different compilers and operating systems. CMake works across a large matrix of compiler and operating system versions, while providing a consistent interface to check for dependencies and build software projects.

We are working to make this repository easier to use for the evaluation of program analysis tools. If you have questions about the challenge binaries, please join our Slack and we'll be happy to answer them.

Authors

Porting work was completed by Kareem El-Faramawi and Loren Maggiore, with help from Artem Dinaburg, Peter Goodman, Ryan Stortz, and Jay Little. Challenges were originally created by NARF Industries, Kaprica Security, Chris Eagle, Lunge Technology, Cromulence, West Point Military Academy, Thought Networks, and Air Force Research Labs while under contract for the DARPA Cyber Grand Challenge.

cb-multios's People

Contributors

krx avatar withzombies avatar dguido avatar pgoodman avatar artemdinaburg avatar computerality avatar

Watchers

deki0r avatar

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.