Debop is a multi-goal debloating technique. In its current implementation, Debop supports an objective function that encodes three goals: size reduction, attack surface reduction, and generality. It leverages a Markov Chain Monte Carlo (MCMC) sampling technique to explore the search space and search for a debloated program that maximizes the objective.
- CMake >= 3.10.2
- Clang and LLVM >= 9.0.0
- spdlog >= 1.3.1
- ROPgadget >= 5.8
Make sure you have installed all the required libraries (shown above). Please refer to https://github.com/llvm/llvm-project.git to install LLVM and Clang. Please refer to https://github.com/gabime/spdlog to install spdlog. Please refer to https://github.com/JonathanSalwan/ROPgadget to install ROPgadget.
Once you have all the requirements, do the following steps.
- In CMakeLists.txt, change to your own paths the last two
include_directories
(lines ending with "Change to your own path!"). - Run
mkdir build && cd build
. - Run
cmake ..
. - Run
make
.
- Test ROPgadget by running
ROPgadget --version
from command line. - In the
debop
directory, go toquicktest
by runningcd test/quicktest
. - Run
./run_debop
. - After running, check that you have a
debop-out
directory containing a few sample C files and alog.txt
file. Inlog.txt
file, there is a reporting summary shown at the end. If you've found all these, the running was successful.
DEBOP_BIN [OPTION] ORACLE_FILE SOURCE_FILE
DEBOP_BIN: The debop binary (build/bin/reducer).
ORACLE_FILE: The oracle script used to compile source, run tests, and compute scores. It should compute a total of six scores:
- Size of original program
- Size of reduced program
- Number of gadgets in original program
- Number of gadgets in reduced program
- Number of total tests
- Number of tests the program passes
The resulting scores should be redirected to a file named "eval_rslt.txt".
See
test/quicktest/test.sh
for an example.
SOURCE_FILE: The program source file(s).
OPTION:
-m: Number of samples.
-i: Number of sampling iterations. (Default is 100. Consider using a large value.)
-a: Alpha value (weight for attack surface reduction).
-e: Beta value (weight for generality).
-k: K value (for computing density values).
-s: No value needed. Save temp files.
-B: If you want to use MCMC at the BasicBlock level, add this option.
It is strongly recommended that you provide Debop with a source file with all the code unexercised by the oracle inputs eliminated. This would make Debop's search space significantly smaller. To produce such a file, please refer to https://github.com/qixin5/debcov.
If you have questions, please contact Qi Xin via [email protected].