Skip to content
Snippets Groups Projects
Commit 404acbf5 authored by jdh8d's avatar jdh8d
Browse files

Added testcase to test Strata's initial handshake with the controller.

parents 9384d24d 78f3a46b
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
/Makefile -text
/block_copy.c -text
/chopzero.c -text
/concolic_test_handshake.c -text
/fptest.c -text
/generate_exe.sh -text
/getsyms.sh -text
......@@ -21,3 +22,4 @@
/peasoup_link -text
/print_ptr.c -text
/recover_example.c -text
/test_controller.sh -text
......@@ -2,8 +2,8 @@
CC=${TOOLCHAIN}/bin/gcc -I ${STRATA}/include/
CXX=${TOOLCHAIN}/bin/g++ -I ${STRATA}/include/
CC=gcc
CXX=g++
all: env_check chopzero hanoi hanoi_overrun hanoi_heap_overrun hanoi_stack_overrun print_ptr malloc block_copy hello hanoi_overrun_tainted hanoi_overrun_taintedenv memcpy
......@@ -25,10 +25,10 @@ hanoi: .PHONY hanoi.ncexe hanoi.stratafied hanoi.ncexe.annot
hanoi.stratafied: ${STRATA}/lib/x86_linux/libstrata_normal.a hanoi.ncexe
${STRATAFIER}/do_stratafy.sh -k hanoi.ncexe
mv new.exe hanoi.stratafied
${NICECAP_HOME}/generate_exe.sh hanoi hanoi.stratafied hanoi.ncexe hanoi.ncexe.annot
${PEASOUP_HOME}/generate_exe.sh hanoi hanoi.stratafied hanoi.ncexe hanoi.ncexe.annot
hanoi.ncexe: hanoi.o
${TOOLCHAIN}/bin/gcc -Bstatic -static -O3 -fomit-frame-pointer hanoi.o -o hanoi.ncexe
$(CC) -Bstatic -static -O3 -fomit-frame-pointer hanoi.o -o hanoi.ncexe
hanoi.ncexe.annot: hanoi.ncexe ${IDAROOT}/plugins/SMPStaticAnalyzer.plx ${SMPSA_HOME}/SMP-analyze.sh
${SMPSA_HOME}/SMP-analyze.sh hanoi.ncexe
......@@ -40,10 +40,10 @@ globalfield: .PHONY globalfield.ncexe globalfield.stratafied globalfield.ncexe.
globalfield.stratafied: ${STRATA}/lib/x86_linux/libstrata_normal.a globalfield.ncexe
${STRATA_HOME}/tools/stratafier/do_stratafy.sh globalfield.ncexe
mv new.exe globalfield.stratafied
${NICECAP_HOME}/generate_exe.sh globalfield globalfield.stratafied globalfield.ncexe globalfield.ncexe.annot
${PEASOUP_HOME}/generate_exe.sh globalfield globalfield.stratafied globalfield.ncexe globalfield.ncexe.annot
globalfield.ncexe: globalfield.o
${TOOLCHAIN}/bin/gcc -Bstatic -static -O3 -fomit-frame-pointer globalfield.o -o globalfield.ncexe
$(CC) -Bstatic -static -O3 -fomit-frame-pointer globalfield.o -o globalfield.ncexe
globalfield.ncexe.annot: globalfield.ncexe ${IDAROOT}/plugins/SMPStaticAnalyzer.plx ${SMPSA_HOME}/SMP-analyze.sh
${SMPSA_HOME}/SMP-analyze.sh globalfield.ncexe
......@@ -56,10 +56,10 @@ recover_example: .PHONY recover_example.ncexe recover_example.stratafied recove
recover_example.stratafied: ${STRATA}/lib/x86_linux/libstrata_normal.a recover_example.ncexe
${STRATA_HOME}/tools/stratafier/do_stratafy.sh recover_example.ncexe
mv new.exe recover_example.stratafied
${NICECAP_HOME}/generate_exe.sh recover_example recover_example.stratafied recover_example.ncexe recover_example.ncexe.annot
${PEASOUP_HOME}/generate_exe.sh recover_example recover_example.stratafied recover_example.ncexe recover_example.ncexe.annot
recover_example.ncexe: recover_example.o
${TOOLCHAIN}/bin/gcc -Bstatic -static -O -fomit-frame-pointer recover_example.o -o recover_example.ncexe
$(CC) -Bstatic -static -O -fomit-frame-pointer recover_example.o -o recover_example.ncexe
recover_example.ncexe.annot: recover_example.ncexe ${IDAROOT}/plugins/SMPStaticAnalyzer.plx ${SMPSA_HOME}/SMP-analyze.sh
${SMPSA_HOME}/SMP-analyze.sh recover_example.ncexe
......@@ -72,10 +72,10 @@ memcpy: .PHONY memcpy.ncexe memcpy.stratafied memcpy.ncexe.annot
memcpy.stratafied: ${STRATA}/lib/x86_linux/libstrata_normal.a memcpy.ncexe
${STRATA_HOME}/tools/stratafier/do_stratafy.sh memcpy.ncexe
mv new.exe memcpy.stratafied
${NICECAP_HOME}/generate_exe.sh memcpy memcpy.stratafied memcpy.ncexe memcpy.ncexe.annot
${PEASOUP_HOME}/generate_exe.sh memcpy memcpy.stratafied memcpy.ncexe memcpy.ncexe.annot
memcpy.ncexe: memcpy.o
${TOOLCHAIN}/bin/gcc -Bstatic -static -O3 -fomit-frame-pointer memcpy.o -o memcpy.ncexe
$(CC) -Bstatic -static -O3 -fomit-frame-pointer memcpy.o -o memcpy.ncexe
memcpy.ncexe.annot: memcpy.ncexe ${IDAROOT}/plugins/SMPStaticAnalyzer.plx ${SMPSA_HOME}/SMP-analyze.sh
${SMPSA_HOME}/SMP-analyze.sh memcpy.ncexe
......@@ -89,10 +89,10 @@ hanoi_overrun_tainted: .PHONY hanoi_overrun_tainted.ncexe hanoi_overrun_tainted
hanoi_overrun_tainted.stratafied: ${STRATA}/lib/x86_linux/libstrata_normal.a hanoi_overrun_tainted.ncexe
${STRATA_HOME}/tools/stratafier/do_stratafy.sh hanoi_overrun_tainted.ncexe
mv new.exe hanoi_overrun_tainted.stratafied
${NICECAP_HOME}/generate_exe.sh hanoi_overrun_tainted hanoi_overrun_tainted.stratafied hanoi_overrun_tainted.ncexe hanoi_overrun_tainted.ncexe.annot
${PEASOUP_HOME}/generate_exe.sh hanoi_overrun_tainted hanoi_overrun_tainted.stratafied hanoi_overrun_tainted.ncexe hanoi_overrun_tainted.ncexe.annot
hanoi_overrun_tainted.ncexe: hanoi_overrun_tainted.o
${TOOLCHAIN}/bin/gcc -Bstatic -static hanoi_overrun_tainted.o -o hanoi_overrun_tainted.ncexe
$(CC) -Bstatic -static hanoi_overrun_tainted.o -o hanoi_overrun_tainted.ncexe
hanoi_overrun_tainted.ncexe.annot: hanoi_overrun_tainted.ncexe ${IDAROOT}/plugins/SMPStaticAnalyzer.plx ${SMPSA_HOME}/SMP-analyze.sh
${SMPSA_HOME}/SMP-analyze.sh hanoi_overrun_tainted.ncexe
......@@ -105,10 +105,10 @@ hanoi_overrun_taintedenv: .PHONY hanoi_overrun_taintedenv.ncexe hanoi_overrun_t
hanoi_overrun_taintedenv.stratafied: ${STRATA}/lib/x86_linux/libstrata_normal.a hanoi_overrun_taintedenv.ncexe
${STRATA_HOME}/tools/stratafier/do_stratafy.sh hanoi_overrun_taintedenv.ncexe
mv new.exe hanoi_overrun_taintedenv.stratafied
${NICECAP_HOME}/generate_exe.sh hanoi_overrun_taintedenv hanoi_overrun_taintedenv.stratafied hanoi_overrun_taintedenv.ncexe hanoi_overrun_taintedenv.ncexe.annot
${PEASOUP_HOME}/generate_exe.sh hanoi_overrun_taintedenv hanoi_overrun_taintedenv.stratafied hanoi_overrun_taintedenv.ncexe hanoi_overrun_taintedenv.ncexe.annot
hanoi_overrun_taintedenv.ncexe: hanoi_overrun_taintedenv.o
${TOOLCHAIN}/bin/gcc -Bstatic -static hanoi_overrun_taintedenv.o -o hanoi_overrun_taintedenv.ncexe
$(CC) -Bstatic -static hanoi_overrun_taintedenv.o -o hanoi_overrun_taintedenv.ncexe
hanoi_overrun_taintedenv.ncexe.annot: hanoi_overrun_taintedenv.ncexe ${IDAROOT}/plugins/SMPStaticAnalyzer.plx ${SMPSA_HOME}/SMP-analyze.sh
${SMPSA_HOME}/SMP-analyze.sh hanoi_overrun_taintedenv.ncexe
......@@ -122,40 +122,40 @@ hanoi++: .PHONY hanoi++.ncexe hanoi++.stratafied
hanoi++.stratafied: ${STRATA}/lib/x86_linux/libstrata_normal.a hanoi++.ncexe
${STRATA_HOME}/tools/stratafier/do_stratafy.sh hanoi++.ncexe
mv new.exe hanoi++.stratafied
${NICECAP_HOME}/generate_exe.sh hanoi++ hanoi++.stratafied hanoi++.ncexe hanoi++.ncexe.annot
${PEASOUP_HOME}/generate_exe.sh hanoi++ hanoi++.stratafied hanoi++.ncexe hanoi++.ncexe.annot
hanoi++.ncexe: hanoi++.o
${TOOLCHAIN}/bin/g++ -Bstatic -static hanoi++.o -o hanoi++.ncexe
$(CC) -Bstatic -static hanoi++.o -o hanoi++.ncexe
${SMPSA_HOME}/SMP-analyze.sh hanoi++.ncexe
@if [ ! -f hanoi++.ncexe.annot ]; then echo Failed to generate annotations file; exit 1; fi
hanoi_overrun: hanoi_overrun.o ${STRATA}/lib/x86_linux/libstrata_normal.a .PHONY
./nicecap_link hanoi_overrun.o -o hanoi_overrun
./peasoup_link hanoi_overrun.o -o hanoi_overrun
${SMPSA_HOME}/SMP-analyze.sh hanoi_overrun.ncexe
hanoi_heap_overrun: hanoi_heap_overrun.o ${STRATA}/lib/x86_linux/libstrata_normal.a .PHONY
./nicecap_link hanoi_heap_overrun.o -o hanoi_heap_overrun
./peasoup_link hanoi_heap_overrun.o -o hanoi_heap_overrun
${SMPSA_HOME}/SMP-analyze.sh hanoi_heap_overrun.ncexe
hanoi_stack_overrun: hanoi_stack_overrun.o ${STRATA}/lib/x86_linux/libstrata_normal.a .PHONY
./nicecap_link hanoi_stack_overrun.o -o hanoi_stack_overrun
./peasoup_link hanoi_stack_overrun.o -o hanoi_stack_overrun
${SMPSA_HOME}/SMP-analyze.sh hanoi_stack_overrun.ncexe
print_ptr: print_ptr.o ${STRATA}/lib/x86_linux/libstrata_normal.a .PHONY
./nicecap_link print_ptr.o -o print_ptr
./peasoup_link print_ptr.o -o print_ptr
${SMPSA_HOME}/SMP-analyze.sh print_ptr.ncexe
block_copy: block_copy.o ${STRATA}/lib/x86_linux/libstrata_normal.a .PHONY
./nicecap_link block_copy.o -o block_copy
./peasoup_link block_copy.o -o block_copy
${SMPSA_HOME}/SMP-analyze.sh block_copy.ncexe
malloc: malloc.o ${STRATA}/lib/x86_linux/libstrata_normal.a .PHONY
./nicecap_link malloc.o -o malloc
./peasoup_link malloc.o -o malloc
${SMPSA_HOME}/SMP-analyze.sh malloc.ncexe
hello: hello.o ${STRATA}/lib/x86_linux/libstrata_normal.a .PHONY
./nicecap_link hello.o -o hello
./peasoup_link hello.o -o hello
${SMPSA_HOME}/SMP-analyze.sh hello.ncexe
.PHONY: env_check chopzero
......@@ -182,8 +182,8 @@ env_check:
elif [ "X${SMPSA_HOME}" = "X" ]; then \
echo SMPSA_HOME environment variable should be set.; \
exit -1;\
elif [ "X${NICECAP_HOME}" = "X" ]; then \
echo NICECAP_HOME environment variable should be set.; \
elif [ "X${PEASOUP_HOME}" = "X" ]; then \
echo PEASOUP_HOME environment variable should be set.; \
exit -1;\
elif [ "X${STRATA_HOME}" = "X" ]; then \
echo STRATA_HOME environment variable should be set.; \
......
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
main(int argc, char* argv[])
{
printf("Testing started\n");
if(!fork())
{
printf("fork started\n");
system(argv[1]);
printf("system finished\n");
sleep(2);
return 0;
}
else
{
printf("fork started in controller\n");
int msgflg = IPC_CREAT | 0666;
key_t key;
size_t buflen;
int msqid;
int len;
struct msgbuf
{
long mtype;
int args[3];
} sbuf;
key = 1234;
printf("setting up msgq\n");
if ((msqid = msgget(key, msgflg )) < 0) /* Get the message queue ID for the given key */
perror("msgget");
printf("getting from msgq\n");
len=sizeof(sbuf)-sizeof(int);
if (msgrcv(msqid, &sbuf, len, 0, 0) < 0)
{
perror("msgrcv:");
}
printf("Got message from Strata: type=%d, arg1=%x, arg2=%x, arg3=%x\n", (int)sbuf.mtype, sbuf.args[0], sbuf.args[1], sbuf.args[2]);
sleep(2);
return 0;
}
}
#!/bin/sh
# This script depends on having the following environment variables defined
# DIABLO_HOME - The path of the diablo installation
# STRATA - The path to the strata installation
# An example of these environment variables and their settings are listed in
# the sample file: $STRATA/security_startup_rc
......
#!/bin/sh
whoami=`whoami`
echo Building files...
gcc -w concolic_test_handshake.c -o test_controller.exe
gcc -w hanoi_overrun.c -o hanoi_overrun.ncexe
$STRATAFIER/do_stratafy.sh hanoi_overrun.ncexe >/dev/null 2>&1
mv new.exe hanoi_overrun.stratafied
echo Removing all ipc queues.
for i in `ipcs -q|grep $whoami |cut -d" " -f 2`;
do
ipcrm -q $i
done
STRATA_GRACE=1 STRATA_LOG=ipc ./test_controller.exe ./hanoi_overrun.stratafied
echo cleaning up
killall hanoi_overrun.stratafied
killall test_controller.exe
echo Removing all ipc queues.
for i in `ipcs -q|grep $whoami |cut -d" " -f 2`;
do
ipcrm -q $i
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment