Browse Source

Works with pixy - graphene_final commit e3265e2 - changes in verifier manifest file can be automatically derived from the find_...sh file

dettanym 3 years ago
parent
commit
25189238b7
5 changed files with 26 additions and 8 deletions
  1. 1 1
      Makefile
  2. 15 0
      find_pixy_class_file_locations.sh
  3. 5 4
      helloworld_jni_interface.cpp
  4. 5 3
      systemMain.cpp
  5. BIN
      verifier

+ 1 - 1
Makefile

@@ -46,7 +46,7 @@ crypto.o: crypto.cpp
 
 verifier:  systemMain.o systemSealerWrapper.o SgxSealer.o ProtobufLAInitiator.o SgxProtobufLAInitiator.o SgxProtobufLAInitiator_Transforms.o ProtobufLAMessages.pb.o crypto.o
 #	echo $(system_obj)
-	${CXX} -Wl,--noinhibit-exec systemMain.o crypto.o systemSealerWrapper.o SgxSealer.o  -L${Openssl_Path}/lib -lcrypto -lssl -L./ -l$(Service_Library_Name) -l$(Crypto_Library_Name) -L/home/m2mazmud/linux-sgx-trts-modified/build/linux -lsgx_tstdc -lsgx_trts  ${LD_FLAGS} -o $@ 
+	${CXX} -Wl,--noinhibit-exec systemMain.o crypto.o systemSealerWrapper.o SgxSealer.o  -L${Openssl_Path}/lib -lcrypto -lssl -L./ -l$(Service_Library_Name) -l$(Crypto_Library_Name) -L/home/m2mazmud/linux-sgx-trts-modified/build/linux -lsgx_tstdc -lsgx_trts -L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm  ${LD_FLAGS} -o $@ 
 #-L/home/m2mazmud/linux-sgx-trts-modified/build/linux -lsgx_tstdc -lsgx_trts ${LD_FLAGS} -o $@ 
 
 #-Wl,-rpath,$(SGX_SDK)/lib64  systemMain.o  ${LD_FLAGS} -o $@

+ 15 - 0
find_pixy_class_file_locations.sh

@@ -0,0 +1,15 @@
+#!/bin/bash
+
+locations=$(strace -ff -e trace=file /home/m2mazmud/good_code/Verifier/a.out ~/pixy-master/sample_mitigator/index.php 2>&1 | perl -ne 's/^[^"]+"(([^\\"]|\\[\\"nt])*)".*/$1/ && print' | grep ".class" | cut -d. -f1 | rev | cut -d/ -f 2- | rev | sort -u )
+counter=0;
+for x in $locations; 
+do
+	y=$(find $x -maxdepth 1 -type f | grep .class); 
+	if [[ ! -z "$y" ]];
+	then 
+		let counter++;
+		key=$(echo "$x" | rev | cut -d/ -f1 | rev); 
+		echo "sgx.allowed_files.pixy_classes_"$key"_"$counter" = file:"$x; 
+	fi;
+done;
+

+ 5 - 4
helloworld_jni_interface.cpp

@@ -11,8 +11,8 @@ int main(int argc, char **argv)
     jstring         jstr;
     jobjectArray    main_args;
     JavaVMOption* options = new JavaVMOption[5];
-    options[0].optionString = "-Dpixy.home=/home/miti/thesis/php_tainting/pixy-master";
-    options[1].optionString = "-Djava.class.path=/home/miti/thesis/php_tainting/pixy-master/lib:/home/miti/thesis/php_tainting/pixy-master/build/class";
+    options[0].optionString = "-Dpixy.home=/home/m2mazmud/pixy-master";
+    options[1].optionString = "-Djava.class.path=/home/m2mazmud/pixy-master/lib:/home/m2mazmud/pixy-master/build/class";
     options[2].optionString = "-Xcheck:jni";
     options[3].optionString = "-Xms256m";
     options[4].optionString = "-Xmx1024m";
@@ -46,9 +46,9 @@ int main(int argc, char **argv)
 
     (env)->SetObjectArrayElement( main_args, 0, (env)->NewStringUTF( "-aAvLf"));
     (env)->SetObjectArrayElement( main_args, 1, (env)->NewStringUTF( "-s"));
-    (env)->SetObjectArrayElement( main_args, 2, (env)->NewStringUTF( "/home/miti/thesis/php_tainting/pixy-master/config/sinks_xss.txt"));
+    (env)->SetObjectArrayElement( main_args, 2, (env)->NewStringUTF( "/home/m2mazmud/pixy-master/config/sinks_xss.txt"));
     (env)->SetObjectArrayElement( main_args, 3, (env)->NewStringUTF( "-o"));
-    (env)->SetObjectArrayElement( main_args, 4, (env)->NewStringUTF( "/home/miti/thesis/open_source_applications/sample_cs458site_analysis"));
+    (env)->SetObjectArrayElement( main_args, 4, (env)->NewStringUTF( "/home/m2mazmud/pixy-master/sample_mitigator/results"));
     (env)->SetObjectArrayElement( main_args, 5, (env)->NewStringUTF( "-y"));
     (env)->SetObjectArrayElement( main_args, 6, (env)->NewStringUTF( "xss"));
     if(argc>=1)
@@ -56,6 +56,7 @@ int main(int argc, char **argv)
 
     (env)->CallStaticVoidMethod( cls, mid, main_args);
     if((env)->ExceptionOccurred()) {
+	(env)->ExceptionDescribe(); 
       (env)->ExceptionClear();
       printf("Exception occurred\n"); fflush(stdout);
     }

+ 5 - 3
systemMain.cpp

@@ -32,7 +32,7 @@ void foo() //sigsegv_handler(int signo)
 
 int main(int argc, char** argv)
 {
-/*
+
 //	signal(SIGSEGV, SIG_IGN);  //sigsegv_handler); 
 	
     JavaVM         *vm;
@@ -65,8 +65,9 @@ int main(int argc, char** argv)
 	printf("Failed to create Java VMn");
         return 1;
     }
+	printf("WOO HOO CREATED JVM\n");  fflush(stdout); 
 	delete options; 
-    cls = (env)->FindClass( "at/ac/tuwien/infosys/www/pixy/Checker");
+    cls = (env)->FindClass("at/ac/tuwien/infosys/www/pixy/Checker");
     if (cls == NULL) {
         printf("Failed to find Main classn");
         return 1;
@@ -95,10 +96,11 @@ int main(int argc, char** argv)
 
     (env)->CallStaticVoidMethod( cls, mid, main_args);
     if((env)->ExceptionOccurred()) {
+	(env)->ExceptionDescribe();
       (env)->ExceptionClear();
       printf("Exception occurred\n"); fflush(stdout);
     }
-*/
+
 
   printf("HELLOWORLD\n");fflush(stdout); 
 //  Py_SetProgramName("verifier");  

BIN
verifier