From ea0750422cb2e8beb34f7c62d0f3870c9e90c589 Mon Sep 17 00:00:00 2001 From: Deepak Adhikari Date: Thu, 7 Feb 2019 12:28:15 -0600 Subject: [PATCH 1/4] Add docker build file --- Dockerfile | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..22d6237 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +FROM ubuntu:16.04 +LABEL maintainer="David Manouchehri" + +RUN apt-get update && apt-get dist-upgrade -y && \ + apt-get install -y git cmake build-essential clang ca-certificates curl \ + unzip libboost-dev python-dev python-pip && apt-get clean + +# get and install the latest z3 relesae +RUN cd /tmp && \ + curl -o z3.tgz -L https://github.com/Z3Prover/z3/archive/z3-4.5.0.tar.gz && \ + tar zxf z3.tgz && cd z3-z3-4.5.0 && \ + CC=clang CXX=clang++ python scripts/mk_make.py && cd build && make \ + && make install && cd /tmp && rm -rf /tmp/z3-z3-4.5.0 + +# Install capstone +RUN cd /tmp && \ + curl -o cap.tgz -L https://github.com/aquynh/capstone/archive/3.0.4.tar.gz && \ + tar xvf cap.tgz && cd capstone-3.0.4/ && ./make.sh install && cd /tmp && \ + rm -rf /tmp/capstone-3.0.4 + + +# Install pintool +RUN cd /opt && curl -o pin.tgz -L http://software.intel.com/sites/landingpage/pintool/downloads/pin-2.14-71313-gcc.4.4.7-linux.tar.gz && tar zxf pin.tgz + +# now install Triton +# uncomment below to pull form git +# RUN cd /opt/pin-2.14-71313-gcc.4.4.7-linux/source/tools/ && git clone https://github.com/JonathanSalwan/Triton.git && \ +# cd Triton && mkdir build && cd build && cmake -G "Unix Makefiles" -DPINTOOL=on -DKERNEL4=on .. && \ +# make install && cd .. && python setup.py install +RUN cd /opt/pin-2.14-71313-gcc.4.4.7-linux/source/tools/ && \ + curl -o master.zip -L https://github.com/JonathanSalwan/Triton/archive/master.zip && unzip master.zip && cd Triton-master/ && mkdir build && cd build && \ + cmake -G "Unix Makefiles" -DPINTOOL=on -DKERNEL4=on .. && make install && cd .. + +RUN pip install --upgrade pip==9.0.1 +RUN pip install setuptools --upgrade +RUN pip install https://github.com/quarkslab/arybo/archive/master.zip +RUN pip install https://github.com/lief-project/packages/raw/lief-master-latest/pylief-0.9.0.dev.zip + +ENTRYPOINT /bin/bash + From 62cb77792c58b9ab5fd8bc9595a94b215518b5d3 Mon Sep 17 00:00:00 2001 From: Deepak Adhikari Date: Thu, 7 Feb 2019 18:25:04 -0600 Subject: [PATCH 2/4] Add llvmlite dependency install --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 22d6237..da36dff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,13 +10,13 @@ RUN cd /tmp && \ curl -o z3.tgz -L https://github.com/Z3Prover/z3/archive/z3-4.5.0.tar.gz && \ tar zxf z3.tgz && cd z3-z3-4.5.0 && \ CC=clang CXX=clang++ python scripts/mk_make.py && cd build && make \ - && make install && cd /tmp && rm -rf /tmp/z3-z3-4.5.0 + && make install && cd /tmp && rm /tmp/z3.tgz && rm -rf /tmp/z3-z3-4.5.0 # Install capstone RUN cd /tmp && \ curl -o cap.tgz -L https://github.com/aquynh/capstone/archive/3.0.4.tar.gz && \ tar xvf cap.tgz && cd capstone-3.0.4/ && ./make.sh install && cd /tmp && \ - rm -rf /tmp/capstone-3.0.4 + rm /tmp/cap.tgz && rm -rf /tmp/capstone-3.0.4 # Install pintool @@ -31,8 +31,10 @@ RUN cd /opt/pin-2.14-71313-gcc.4.4.7-linux/source/tools/ && \ curl -o master.zip -L https://github.com/JonathanSalwan/Triton/archive/master.zip && unzip master.zip && cd Triton-master/ && mkdir build && cd build && \ cmake -G "Unix Makefiles" -DPINTOOL=on -DKERNEL4=on .. && make install && cd .. +# Install Tigress_protection dependencies RUN pip install --upgrade pip==9.0.1 RUN pip install setuptools --upgrade +RUN pip install llvmlite RUN pip install https://github.com/quarkslab/arybo/archive/master.zip RUN pip install https://github.com/lief-project/packages/raw/lief-master-latest/pylief-0.9.0.dev.zip From 53eb8d514966ecc7a5fdb469eada8c1df6b3ad09 Mon Sep 17 00:00:00 2001 From: Deepak Adhikari Date: Thu, 7 Feb 2019 18:25:34 -0600 Subject: [PATCH 3/4] Add docker instructions --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 205d76f..b3d0d23 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,21 @@ $ ./solve-vm.py ./tigress-challenges/tigress-0-challenge-0 Then, symbolic expressions can be found [here](symbolic_expressions), LLVM representations can be found [here](llvm_expressions) and recompiled binaries can be found [here](deobfuscated_binaries). +Using Docker: + +
+$ git clone git@github.com:JonathanSalwan/Tigress_protection.git
+$ cd /path/to/Tigress_protection
+$ docker build -t image_tigress_protection . 
+$ docker run -v /path/to/Tigress_protection:/root/Tigress_protection -ti --name=tigress_protection --ulimit='stack=-1:-1' image_tigress_protection
+
+ +Test inside Docker container +
+# cd ~/Tigress_protection
+# ./solve-vm.py tigress-challenges/tigress-0-challenge-0
+
+ # Testing our simplified binaries As we simplified and recompiled new binaries, we must provide the same behavior of the original binaries. So, to test our binary versions we use this [script](scripts/testing_equality.py). From b71489ff304270517a9c2bdd100b222a3ded2c77 Mon Sep 17 00:00:00 2001 From: Deepak Adhikari Date: Fri, 8 Feb 2019 14:47:48 -0600 Subject: [PATCH 4/4] Change curl command to download specific version of Triton --- Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index da36dff..537c6ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,8 @@ RUN cd /tmp && \ # Install pintool -RUN cd /opt && curl -o pin.tgz -L http://software.intel.com/sites/landingpage/pintool/downloads/pin-2.14-71313-gcc.4.4.7-linux.tar.gz && tar zxf pin.tgz +RUN cd /opt && curl -o pin.tgz -L http://software.intel.com/sites/landingpage/pintool/downloads/pin-2.14-71313-gcc.4.4.7-linux.tar.gz && \ + tar zxf pin.tgz && rm pin.tgz # now install Triton # uncomment below to pull form git @@ -28,8 +29,9 @@ RUN cd /opt && curl -o pin.tgz -L http://software.intel.com/sites/landingpage/pi # cd Triton && mkdir build && cd build && cmake -G "Unix Makefiles" -DPINTOOL=on -DKERNEL4=on .. && \ # make install && cd .. && python setup.py install RUN cd /opt/pin-2.14-71313-gcc.4.4.7-linux/source/tools/ && \ - curl -o master.zip -L https://github.com/JonathanSalwan/Triton/archive/master.zip && unzip master.zip && cd Triton-master/ && mkdir build && cd build && \ - cmake -G "Unix Makefiles" -DPINTOOL=on -DKERNEL4=on .. && make install && cd .. + curl -o triton.zip -L https://github.com/JonathanSalwan/Triton/archive/2838b732d6398b33f590f4db5d045c26054486ae.zip && \ + unzip triton.zip && rm triton.zip && cd Triton-2838b732d6398b33f590f4db5d045c26054486ae/ && mkdir build && cd build && \ + cmake -G "Unix Makefiles" -DPINTOOL=on -DKERNEL4=on .. && make install && cd .. # Install Tigress_protection dependencies RUN pip install --upgrade pip==9.0.1