diff --git a/apk/InfoFlows/ArgToSetField.apk b/apk/InfoFlows/ArgToSetField.apk new file mode 100644 index 00000000..bc0d665b Binary files /dev/null and b/apk/InfoFlows/ArgToSetField.apk differ diff --git a/apk/InfoFlows/GetFieldToCallMethod.apk b/apk/InfoFlows/GetFieldToCallMethod.apk new file mode 100644 index 00000000..f7054830 Binary files /dev/null and b/apk/InfoFlows/GetFieldToCallMethod.apk differ diff --git a/apk/InfoFlows/JavaProxy.apk b/apk/InfoFlows/JavaProxy.apk new file mode 100644 index 00000000..5a48232c Binary files /dev/null and b/apk/InfoFlows/JavaProxy.apk differ diff --git a/apk/InfoFlows/JavaToJava.apk b/apk/InfoFlows/JavaToJava.apk new file mode 100644 index 00000000..0d3d0dcb Binary files /dev/null and b/apk/InfoFlows/JavaToJava.apk differ diff --git a/apk/InfoFlows/JavaToNative.apk b/apk/InfoFlows/JavaToNative.apk new file mode 100644 index 00000000..69c55dd3 Binary files /dev/null and b/apk/InfoFlows/JavaToNative.apk differ diff --git a/apk/InfoFlows/NativeProxy.apk b/apk/InfoFlows/NativeProxy.apk new file mode 100644 index 00000000..ff87595b Binary files /dev/null and b/apk/InfoFlows/NativeProxy.apk differ diff --git a/apk/InfoFlows/NativeSourceToCallMethod.apk b/apk/InfoFlows/NativeSourceToCallMethod.apk new file mode 100644 index 00000000..60f6c65f Binary files /dev/null and b/apk/InfoFlows/NativeSourceToCallMethod.apk differ diff --git a/apk/InfoFlows/NativeSourceToSetField.apk b/apk/InfoFlows/NativeSourceToSetField.apk new file mode 100644 index 00000000..78f7c0cf Binary files /dev/null and b/apk/InfoFlows/NativeSourceToSetField.apk differ diff --git a/apk/InfoFlows/NativeToJava.apk b/apk/InfoFlows/NativeToJava.apk new file mode 100644 index 00000000..bbc28120 Binary files /dev/null and b/apk/InfoFlows/NativeToJava.apk differ diff --git a/apk/InfoFlows/NativeToNative.apk b/apk/InfoFlows/NativeToNative.apk new file mode 100644 index 00000000..a59180b0 Binary files /dev/null and b/apk/InfoFlows/NativeToNative.apk differ diff --git a/apk/Native/CopyRegion.apk b/apk/Native/CopyRegion.apk new file mode 100644 index 00000000..6de8cdab Binary files /dev/null and b/apk/Native/CopyRegion.apk differ diff --git a/apk/Native/SourceInNativeLibCode.apk b/apk/Native/SourceInNativeLibCode.apk new file mode 100644 index 00000000..9bfd431c Binary files /dev/null and b/apk/Native/SourceInNativeLibCode.apk differ diff --git a/eclipse-project/InfoFlows/ArgToSetField/.gitignore b/eclipse-project/InfoFlows/ArgToSetField/.gitignore new file mode 100644 index 00000000..aa724b77 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/eclipse-project/InfoFlows/ArgToSetField/.idea/.gitignore b/eclipse-project/InfoFlows/ArgToSetField/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/eclipse-project/InfoFlows/ArgToSetField/.idea/.name b/eclipse-project/InfoFlows/ArgToSetField/.idea/.name new file mode 100644 index 00000000..ce94ad74 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/.idea/.name @@ -0,0 +1 @@ +ArgtoSetField \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/.idea/compiler.xml b/eclipse-project/InfoFlows/ArgToSetField/.idea/compiler.xml new file mode 100644 index 00000000..fb7f4a8a --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/.idea/gradle.xml b/eclipse-project/InfoFlows/ArgToSetField/.idea/gradle.xml new file mode 100644 index 00000000..a2d7c213 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/.idea/misc.xml b/eclipse-project/InfoFlows/ArgToSetField/.idea/misc.xml new file mode 100644 index 00000000..43c8708d --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/.idea/misc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/.idea/vcs.xml b/eclipse-project/InfoFlows/ArgToSetField/.idea/vcs.xml new file mode 100644 index 00000000..c2365ab1 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/.gitignore b/eclipse-project/InfoFlows/ArgToSetField/app/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/build.gradle b/eclipse-project/InfoFlows/ArgToSetField/app/build.gradle new file mode 100644 index 00000000..381801d4 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/build.gradle @@ -0,0 +1,44 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 32 + + defaultConfig { + applicationId "benchmark.infoflow.argtosetfield" + minSdk 21 + targetSdk 32 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + externalNativeBuild { + cmake { + version '3.10.2' + path 'src/main/jni/CMakeLists.txt' + } + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.5.0' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/proguard-rules.pro b/eclipse-project/InfoFlows/ArgToSetField/app/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/androidTest/java/benchmark/infoflow/argtosetfield/ExampleInstrumentedTest.java b/eclipse-project/InfoFlows/ArgToSetField/app/src/androidTest/java/benchmark/infoflow/argtosetfield/ExampleInstrumentedTest.java new file mode 100644 index 00000000..f1b7fcf6 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/androidTest/java/benchmark/infoflow/argtosetfield/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package benchmark.infoflow.argtosetfield; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("benchmark.infoflow.argtosetfield", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/AndroidManifest.xml b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..99e66c56 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/java/benchmark/infoflow/argtosetfield/MainActivity.java b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/java/benchmark/infoflow/argtosetfield/MainActivity.java new file mode 100644 index 00000000..6b3cc9ed --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/java/benchmark/infoflow/argtosetfield/MainActivity.java @@ -0,0 +1,38 @@ +package benchmark.infoflow.argtosetfield; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.telephony.TelephonyManager; +import android.util.Log; + +/** + * @testcase_name ArgtoSetField + * @version 0.1 + * @author Cyber Security Research Center (CSEC), in Soongsil Univerty (SSU) + * @author_mail gigacms@gmail.com + * + * @description Information leak from java to java code. + * @dataflow source -> imei -> leak to info log + * @number_of_leaks 1 + * @challenges the analysis handle data leak for java to java through native proxy . + */ +public class MainActivity extends Activity { + + static { + System.loadLibrary("ndkmod"); + } + + public String data; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); + String imei = telephonyManager.getDeviceId(); //source + argtoSetField(imei); + Log.i("Benchmark", data); //sink + } + public native void argtoSetField(String info); +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/jni/CMakeLists.txt b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/jni/CMakeLists.txt new file mode 100644 index 00000000..42fd777d --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/jni/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.4.1) + +add_library(ndkmod SHARED + ndkmod.c) +# Include libraries needed for mytest lib +target_link_libraries(ndkmod + android + log) diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/jni/ndkmod.c b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/jni/ndkmod.c new file mode 100644 index 00000000..b8af1a07 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/jni/ndkmod.c @@ -0,0 +1,8 @@ +#include +#include + +JNIEXPORT void JNICALL Java_benchmark_infoflow_argtosetfield_MainActivity_argtoSetField(JNIEnv *env, jobject javaThis, jstring info) { + jclass thizClass = (*env)->GetObjectClass(env, javaThis); + jfieldID dataFieldID = (*env)->GetFieldID(env, thizClass, "data", "Ljava/lang/String;"); + (*env)->SetObjectField(env, javaThis, dataFieldID, info); // Native to Java data #2 : Set Field (message) +} diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/drawable/ic_launcher_background.xml b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/layout/activity_main.xml b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..17eab17b --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 00000000..c209e78e Binary files /dev/null and b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 00000000..b2dfe3d1 Binary files /dev/null and b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 00000000..4f0f1d64 Binary files /dev/null and b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 00000000..62b611da Binary files /dev/null and b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 00000000..948a3070 Binary files /dev/null and b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..1b9a6956 Binary files /dev/null and b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 00000000..28d4b77f Binary files /dev/null and b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9287f508 Binary files /dev/null and b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 00000000..aa7d6427 Binary files /dev/null and b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9126ae37 Binary files /dev/null and b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/values-night/themes.xml b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/values-night/themes.xml new file mode 100644 index 00000000..f86aa7e3 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/values/colors.xml b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..f8c6127d --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/values/strings.xml b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..29445490 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + ArgtoSetField + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/values/themes.xml b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/values/themes.xml new file mode 100644 index 00000000..80406589 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/xml/backup_rules.xml b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 00000000..fa0f996d --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/xml/data_extraction_rules.xml b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 00000000..9ee9997b --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/app/src/test/java/benchmark/infoflow/argtosetfield/ExampleUnitTest.java b/eclipse-project/InfoFlows/ArgToSetField/app/src/test/java/benchmark/infoflow/argtosetfield/ExampleUnitTest.java new file mode 100644 index 00000000..321a5304 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/app/src/test/java/benchmark/infoflow/argtosetfield/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package benchmark.infoflow.argtosetfield; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/build.gradle b/eclipse-project/InfoFlows/ArgToSetField/build.gradle new file mode 100644 index 00000000..5ae9a7b0 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/build.gradle @@ -0,0 +1,9 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id 'com.android.application' version '7.2.2' apply false + id 'com.android.library' version '7.2.2' apply false +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/gradle.properties b/eclipse-project/InfoFlows/ArgToSetField/gradle.properties new file mode 100644 index 00000000..dab7c28b --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/eclipse-project/InfoFlows/ArgToSetField/gradle/wrapper/gradle-wrapper.jar b/eclipse-project/InfoFlows/ArgToSetField/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..e708b1c0 Binary files /dev/null and b/eclipse-project/InfoFlows/ArgToSetField/gradle/wrapper/gradle-wrapper.jar differ diff --git a/eclipse-project/InfoFlows/ArgToSetField/gradle/wrapper/gradle-wrapper.properties b/eclipse-project/InfoFlows/ArgToSetField/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..d2f03f84 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Sep 12 11:07:09 KST 2022 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/eclipse-project/InfoFlows/ArgToSetField/gradlew b/eclipse-project/InfoFlows/ArgToSetField/gradlew new file mode 100644 index 00000000..4f906e0c --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/eclipse-project/InfoFlows/ArgToSetField/gradlew.bat b/eclipse-project/InfoFlows/ArgToSetField/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/eclipse-project/InfoFlows/ArgToSetField/settings.gradle b/eclipse-project/InfoFlows/ArgToSetField/settings.gradle new file mode 100644 index 00000000..ebb2ca11 --- /dev/null +++ b/eclipse-project/InfoFlows/ArgToSetField/settings.gradle @@ -0,0 +1,16 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +rootProject.name = "ArgtoSetField" +include ':app' diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/.gitignore b/eclipse-project/InfoFlows/GetFieldToCallMethod/.gitignore new file mode 100644 index 00000000..aa724b77 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/.gitignore b/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/.name b/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/.name new file mode 100644 index 00000000..ce94ad74 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/.name @@ -0,0 +1 @@ +ArgtoSetField \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/compiler.xml b/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/compiler.xml new file mode 100644 index 00000000..fb7f4a8a --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/gradle.xml b/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/gradle.xml new file mode 100644 index 00000000..a2d7c213 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/misc.xml b/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/misc.xml new file mode 100644 index 00000000..43c8708d --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/misc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/vcs.xml b/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/vcs.xml new file mode 100644 index 00000000..c2365ab1 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/.gitignore b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/build.gradle b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/build.gradle new file mode 100644 index 00000000..090ee90e --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/build.gradle @@ -0,0 +1,44 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 32 + + defaultConfig { + applicationId "benchmark.infoflow.getfieldtocallmethod" + minSdk 21 + targetSdk 32 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + externalNativeBuild { + cmake { + version '3.10.2' + path 'src/main/jni/CMakeLists.txt' + } + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.5.0' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/proguard-rules.pro b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/androidTest/java/benchmark/infoflow/getfieldtocallmethod/ExampleInstrumentedTest.java b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/androidTest/java/benchmark/infoflow/getfieldtocallmethod/ExampleInstrumentedTest.java new file mode 100644 index 00000000..4f22a5ee --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/androidTest/java/benchmark/infoflow/getfieldtocallmethod/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package benchmark.infoflow.getfieldtocallmethod; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("benchmark.infoflow.getfieldtocallmethod", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/AndroidManifest.xml b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..e75f9e86 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/java/benchmark/infoflow/getfieldtocallmethod/MainActivity.java b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/java/benchmark/infoflow/getfieldtocallmethod/MainActivity.java new file mode 100644 index 00000000..1e418163 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/java/benchmark/infoflow/getfieldtocallmethod/MainActivity.java @@ -0,0 +1,37 @@ +package benchmark.infoflow.getfieldtocallmethod; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.telephony.TelephonyManager; +import android.util.Log; + +/** + * @testcase_name ArgtoSetField + * @version 0.1 + * @author Cyber Security Research Center (CSEC), in Soongsil Univerty (SSU) + * @author_mail gigacms@gmail.com + * + * @description Information leak from java to java code. + * @dataflow source -> imei -> leak to info log + * @number_of_leaks 1 + * @challenges the analysis handle data leak for java to java through native proxy . + */ +public class MainActivity extends Activity { + + static { + System.loadLibrary("ndkmod"); + } + + public String data; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); + data = telephonyManager.getDeviceId(); //source + getFieldToCallMethod(); + } + public native void getFieldToCallMethod(); +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/jni/CMakeLists.txt b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/jni/CMakeLists.txt new file mode 100644 index 00000000..42fd777d --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/jni/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.4.1) + +add_library(ndkmod SHARED + ndkmod.c) +# Include libraries needed for mytest lib +target_link_libraries(ndkmod + android + log) diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/jni/ndkmod.c b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/jni/ndkmod.c new file mode 100644 index 00000000..a7aa3eff --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/jni/ndkmod.c @@ -0,0 +1,15 @@ +#include +#include + +JNIEXPORT void JNICALL Java_benchmark_infoflow_getfieldtocallmethod_MainActivity_getFieldToCallMethod(JNIEnv *env, jobject javaThis) { + jclass thizClass = (*env)->GetObjectClass(env, javaThis); + jfieldID dataFieldID = (*env)->GetFieldID(env, thizClass, "data", "Ljava/lang/String;"); + jstring data = (*env)->GetObjectField(env, javaThis, dataFieldID); // Java to Native data #3 : Get Field + + + jclass androidLog = (*env)->FindClass(env, "android/util/Log"); + jmethodID logDId = (*env)->GetStaticMethodID(env, androidLog, "d", "(Ljava/lang/String;Ljava/lang/String;)I"); + jstring tag = (*env)->NewStringUTF(env, "NATIVE METHOD"); + + (*env)->CallStaticIntMethod(androidLog, logDId, tag, data); // Native to Java data #1 : Call Method (message) +} diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/drawable/ic_launcher_background.xml b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/layout/activity_main.xml b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..17eab17b --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 00000000..c209e78e Binary files /dev/null and b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 00000000..b2dfe3d1 Binary files /dev/null and b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 00000000..4f0f1d64 Binary files /dev/null and b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 00000000..62b611da Binary files /dev/null and b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 00000000..948a3070 Binary files /dev/null and b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..1b9a6956 Binary files /dev/null and b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 00000000..28d4b77f Binary files /dev/null and b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9287f508 Binary files /dev/null and b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 00000000..aa7d6427 Binary files /dev/null and b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9126ae37 Binary files /dev/null and b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/values-night/themes.xml b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/values-night/themes.xml new file mode 100644 index 00000000..f86aa7e3 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/values/colors.xml b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..f8c6127d --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/values/strings.xml b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..29445490 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + ArgtoSetField + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/values/themes.xml b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/values/themes.xml new file mode 100644 index 00000000..80406589 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/xml/backup_rules.xml b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 00000000..fa0f996d --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/xml/data_extraction_rules.xml b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 00000000..9ee9997b --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/test/java/benchmark/infoflow/getfieldtocallmethod/ExampleUnitTest.java b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/test/java/benchmark/infoflow/getfieldtocallmethod/ExampleUnitTest.java new file mode 100644 index 00000000..10ae4301 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/app/src/test/java/benchmark/infoflow/getfieldtocallmethod/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package benchmark.infoflow.getfieldtocallmethod; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/build.gradle b/eclipse-project/InfoFlows/GetFieldToCallMethod/build.gradle new file mode 100644 index 00000000..5ae9a7b0 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/build.gradle @@ -0,0 +1,9 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id 'com.android.application' version '7.2.2' apply false + id 'com.android.library' version '7.2.2' apply false +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/gradle.properties b/eclipse-project/InfoFlows/GetFieldToCallMethod/gradle.properties new file mode 100644 index 00000000..dab7c28b --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/gradle/wrapper/gradle-wrapper.jar b/eclipse-project/InfoFlows/GetFieldToCallMethod/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..e708b1c0 Binary files /dev/null and b/eclipse-project/InfoFlows/GetFieldToCallMethod/gradle/wrapper/gradle-wrapper.jar differ diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/gradle/wrapper/gradle-wrapper.properties b/eclipse-project/InfoFlows/GetFieldToCallMethod/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..d2f03f84 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Sep 12 11:07:09 KST 2022 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/gradlew b/eclipse-project/InfoFlows/GetFieldToCallMethod/gradlew new file mode 100644 index 00000000..4f906e0c --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/gradlew.bat b/eclipse-project/InfoFlows/GetFieldToCallMethod/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/eclipse-project/InfoFlows/GetFieldToCallMethod/settings.gradle b/eclipse-project/InfoFlows/GetFieldToCallMethod/settings.gradle new file mode 100644 index 00000000..ebb2ca11 --- /dev/null +++ b/eclipse-project/InfoFlows/GetFieldToCallMethod/settings.gradle @@ -0,0 +1,16 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +rootProject.name = "ArgtoSetField" +include ':app' diff --git a/eclipse-project/InfoFlows/JavaProxy/.gitignore b/eclipse-project/InfoFlows/JavaProxy/.gitignore new file mode 100644 index 00000000..aa724b77 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/eclipse-project/InfoFlows/JavaProxy/.idea/.gitignore b/eclipse-project/InfoFlows/JavaProxy/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/eclipse-project/InfoFlows/JavaProxy/.idea/compiler.xml b/eclipse-project/InfoFlows/JavaProxy/.idea/compiler.xml new file mode 100644 index 00000000..fb7f4a8a --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/.idea/gradle.xml b/eclipse-project/InfoFlows/JavaProxy/.idea/gradle.xml new file mode 100644 index 00000000..a2d7c213 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/.idea/misc.xml b/eclipse-project/InfoFlows/JavaProxy/.idea/misc.xml new file mode 100644 index 00000000..43c8708d --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/.idea/misc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/.idea/vcs.xml b/eclipse-project/InfoFlows/JavaProxy/.idea/vcs.xml new file mode 100644 index 00000000..c2365ab1 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/.gitignore b/eclipse-project/InfoFlows/JavaProxy/app/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/build.gradle b/eclipse-project/InfoFlows/JavaProxy/app/build.gradle new file mode 100644 index 00000000..91c900df --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/build.gradle @@ -0,0 +1,44 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 32 + + defaultConfig { + applicationId "benchmark.infoflow.javaproxy" + minSdk 21 + targetSdk 32 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + externalNativeBuild { + cmake { + version '3.10.2' + path 'src/main/jni/CMakeLists.txt' + } + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.5.0' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/proguard-rules.pro b/eclipse-project/InfoFlows/JavaProxy/app/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/androidTest/java/benchmark/infoflow/javaproxy/ExampleInstrumentedTest.java b/eclipse-project/InfoFlows/JavaProxy/app/src/androidTest/java/benchmark/infoflow/javaproxy/ExampleInstrumentedTest.java new file mode 100644 index 00000000..edcd1c8b --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/androidTest/java/benchmark/infoflow/javaproxy/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package benchmark.infoflow.javaproxy; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("benchmark.infoflow.javaproxy", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/AndroidManifest.xml b/eclipse-project/InfoFlows/JavaProxy/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..5816ab3c --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/java/benchmark/infoflow/javaproxy/MainActivity.java b/eclipse-project/InfoFlows/JavaProxy/app/src/main/java/benchmark/infoflow/javaproxy/MainActivity.java new file mode 100644 index 00000000..0a13dc28 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/main/java/benchmark/infoflow/javaproxy/MainActivity.java @@ -0,0 +1,33 @@ +package benchmark.infoflow.javaproxy; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; + +/** + * @testcase_name JavaProxy + * @version 0.1 + * @author Cyber Security Research Center (CSEC), in Soongsil Univerty (SSU) + * @author_mail gigacms@gmail.com + * + * @description Information leak from native to java code. + * @dataflow source (native method) -> system property -> return to java -> leak to info log + * @number_of_leaks 1 + * @challenges the analysis handle source from native function, with data alias, and to return value of native method. + */ +public class MainActivity extends Activity { + + static { + System.loadLibrary("ndkmod"); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + String fingerPrint = nativeSource(); + nativeSink(fingerPrint); + } + public native String nativeSource(); + public native void nativeSink(String info); +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/jni/CMakeLists.txt b/eclipse-project/InfoFlows/JavaProxy/app/src/main/jni/CMakeLists.txt new file mode 100644 index 00000000..42fd777d --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/main/jni/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.4.1) + +add_library(ndkmod SHARED + ndkmod.c) +# Include libraries needed for mytest lib +target_link_libraries(ndkmod + android + log) diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/jni/ndkmod.c b/eclipse-project/InfoFlows/JavaProxy/app/src/main/jni/ndkmod.c new file mode 100644 index 00000000..55d6b81a --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/main/jni/ndkmod.c @@ -0,0 +1,16 @@ +#include +#include +#include + +JNIEXPORT jstring Java_benchmark_infoflow_javaproxy_MainActivity_nativeSource(JNIEnv* env, jobject javaThis) { + const char *property_name = "ro.build.fingerprint"; + char property_value[100] = { 0 }; + __system_property_get(property_name, property_value); //source + jstring fingerprint = (*env)->NewStringUTF(env, property_value); + return fingerprint; +} + +JNIEXPORT void Java_benchmark_infoflow_javaproxy_MainActivity_nativeSink(JNIEnv* env, jobject javaThis, jstring info) { + const char *buffer = (*env)->GetStringUTFChars(env, info, JNI_FALSE); + __android_log_print(ANDROID_LOG_INFO, "Benchmark_native", "%s", buffer); //sink +} diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/drawable/ic_launcher_background.xml b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/layout/activity_main.xml b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..17eab17b --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 00000000..c209e78e Binary files /dev/null and b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 00000000..b2dfe3d1 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 00000000..4f0f1d64 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 00000000..62b611da Binary files /dev/null and b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 00000000..948a3070 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..1b9a6956 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 00000000..28d4b77f Binary files /dev/null and b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9287f508 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 00000000..aa7d6427 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9126ae37 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/values-night/themes.xml b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/values-night/themes.xml new file mode 100644 index 00000000..7c77569e --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/values/colors.xml b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..f8c6127d --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/values/strings.xml b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..12a3373b --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + JavaProxy + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/values/themes.xml b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/values/themes.xml new file mode 100644 index 00000000..b53914f6 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/xml/backup_rules.xml b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 00000000..fa0f996d --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/xml/data_extraction_rules.xml b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 00000000..9ee9997b --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/app/src/test/java/benchmark/infoflow/javaproxy/ExampleUnitTest.java b/eclipse-project/InfoFlows/JavaProxy/app/src/test/java/benchmark/infoflow/javaproxy/ExampleUnitTest.java new file mode 100644 index 00000000..4ee65251 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/app/src/test/java/benchmark/infoflow/javaproxy/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package benchmark.infoflow.javaproxy; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/build.gradle b/eclipse-project/InfoFlows/JavaProxy/build.gradle new file mode 100644 index 00000000..5ae9a7b0 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/build.gradle @@ -0,0 +1,9 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id 'com.android.application' version '7.2.2' apply false + id 'com.android.library' version '7.2.2' apply false +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/gradle.properties b/eclipse-project/InfoFlows/JavaProxy/gradle.properties new file mode 100644 index 00000000..dab7c28b --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaProxy/gradle/wrapper/gradle-wrapper.jar b/eclipse-project/InfoFlows/JavaProxy/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..e708b1c0 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaProxy/gradle/wrapper/gradle-wrapper.jar differ diff --git a/eclipse-project/InfoFlows/JavaProxy/gradle/wrapper/gradle-wrapper.properties b/eclipse-project/InfoFlows/JavaProxy/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..d2f03f84 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Sep 12 11:07:09 KST 2022 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/eclipse-project/InfoFlows/JavaProxy/gradlew b/eclipse-project/InfoFlows/JavaProxy/gradlew new file mode 100644 index 00000000..4f906e0c --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/eclipse-project/InfoFlows/JavaProxy/gradlew.bat b/eclipse-project/InfoFlows/JavaProxy/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/eclipse-project/InfoFlows/JavaProxy/settings.gradle b/eclipse-project/InfoFlows/JavaProxy/settings.gradle new file mode 100644 index 00000000..e080e9d3 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaProxy/settings.gradle @@ -0,0 +1,16 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +rootProject.name = "JavaProxy" +include ':app' diff --git a/eclipse-project/InfoFlows/JavaToJava/.gitignore b/eclipse-project/InfoFlows/JavaToJava/.gitignore new file mode 100644 index 00000000..aa724b77 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/eclipse-project/InfoFlows/JavaToJava/.idea/.gitignore b/eclipse-project/InfoFlows/JavaToJava/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/eclipse-project/InfoFlows/JavaToJava/.idea/compiler.xml b/eclipse-project/InfoFlows/JavaToJava/.idea/compiler.xml new file mode 100644 index 00000000..fb7f4a8a --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/.idea/gradle.xml b/eclipse-project/InfoFlows/JavaToJava/.idea/gradle.xml new file mode 100644 index 00000000..a2d7c213 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/.idea/misc.xml b/eclipse-project/InfoFlows/JavaToJava/.idea/misc.xml new file mode 100644 index 00000000..43c8708d --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/.idea/misc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/.idea/vcs.xml b/eclipse-project/InfoFlows/JavaToJava/.idea/vcs.xml new file mode 100644 index 00000000..c2365ab1 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/.gitignore b/eclipse-project/InfoFlows/JavaToJava/app/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/build.gradle b/eclipse-project/InfoFlows/JavaToJava/app/build.gradle new file mode 100644 index 00000000..e300ca77 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/build.gradle @@ -0,0 +1,38 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 32 + + defaultConfig { + applicationId "benchmark.infoflow.javatojava" + minSdk 21 + targetSdk 32 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.5.0' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/proguard-rules.pro b/eclipse-project/InfoFlows/JavaToJava/app/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/androidTest/java/benchmark/infoflow/javatojava/ExampleInstrumentedTest.java b/eclipse-project/InfoFlows/JavaToJava/app/src/androidTest/java/benchmark/infoflow/javatojava/ExampleInstrumentedTest.java new file mode 100644 index 00000000..d091e063 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/src/androidTest/java/benchmark/infoflow/javatojava/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package benchmark.infoflow.javatojava; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("benchmark.infoflow.javatojava", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/AndroidManifest.xml b/eclipse-project/InfoFlows/JavaToJava/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..84f2578d --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/java/benchmark/infoflow/javatojava/MainActivity.java b/eclipse-project/InfoFlows/JavaToJava/app/src/main/java/benchmark/infoflow/javatojava/MainActivity.java new file mode 100644 index 00000000..3b781220 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/src/main/java/benchmark/infoflow/javatojava/MainActivity.java @@ -0,0 +1,33 @@ +package benchmark.infoflow.javatojava; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.telephony.TelephonyManager; +import android.util.Log; + +/** + * @testcase_name JavaToJava + * @version 0.1 + * @author Cyber Security Research Center (CSEC), in Soongsil Univerty (SSU) + * @author_mail gigacms@gmail.com + * + * @description Information leak from java to java code. + * @dataflow source -> imei -> leak to info log + * @number_of_leaks 1 + * @challenges the analysis handle explicit data leak in java to java. + */ +public class MainActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); + String imei = telephonyManager.getDeviceId(); //source + leaker(imei); + } + public void leaker(String info){ + Log.i("InfoFlows", info); //sink + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/drawable/ic_launcher_background.xml b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/layout/activity_main.xml b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..17eab17b --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 00000000..c209e78e Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 00000000..b2dfe3d1 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 00000000..4f0f1d64 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 00000000..62b611da Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 00000000..948a3070 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..1b9a6956 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 00000000..28d4b77f Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9287f508 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 00000000..aa7d6427 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9126ae37 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/values-night/themes.xml b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/values-night/themes.xml new file mode 100644 index 00000000..4c45ac57 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/values/colors.xml b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..f8c6127d --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/values/strings.xml b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..f25c7313 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + JavaToJava + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/values/themes.xml b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/values/themes.xml new file mode 100644 index 00000000..a1e7064e --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/xml/backup_rules.xml b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 00000000..fa0f996d --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/xml/data_extraction_rules.xml b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 00000000..9ee9997b --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/app/src/test/java/benchmark/infoflow/javatojava/ExampleUnitTest.java b/eclipse-project/InfoFlows/JavaToJava/app/src/test/java/benchmark/infoflow/javatojava/ExampleUnitTest.java new file mode 100644 index 00000000..cbb76cd9 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/app/src/test/java/benchmark/infoflow/javatojava/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package benchmark.infoflow.javatojava; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/build.gradle b/eclipse-project/InfoFlows/JavaToJava/build.gradle new file mode 100644 index 00000000..5ae9a7b0 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/build.gradle @@ -0,0 +1,9 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id 'com.android.application' version '7.2.2' apply false + id 'com.android.library' version '7.2.2' apply false +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/gradle.properties b/eclipse-project/InfoFlows/JavaToJava/gradle.properties new file mode 100644 index 00000000..dab7c28b --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToJava/gradle/wrapper/gradle-wrapper.jar b/eclipse-project/InfoFlows/JavaToJava/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..e708b1c0 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToJava/gradle/wrapper/gradle-wrapper.jar differ diff --git a/eclipse-project/InfoFlows/JavaToJava/gradle/wrapper/gradle-wrapper.properties b/eclipse-project/InfoFlows/JavaToJava/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..d2f03f84 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Sep 12 11:07:09 KST 2022 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/eclipse-project/InfoFlows/JavaToJava/gradlew b/eclipse-project/InfoFlows/JavaToJava/gradlew new file mode 100644 index 00000000..4f906e0c --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/eclipse-project/InfoFlows/JavaToJava/gradlew.bat b/eclipse-project/InfoFlows/JavaToJava/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/eclipse-project/InfoFlows/JavaToJava/settings.gradle b/eclipse-project/InfoFlows/JavaToJava/settings.gradle new file mode 100644 index 00000000..fe04e897 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToJava/settings.gradle @@ -0,0 +1,16 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +rootProject.name = "JavaToJava" +include ':app' diff --git a/eclipse-project/InfoFlows/JavaToNative/.gitignore b/eclipse-project/InfoFlows/JavaToNative/.gitignore new file mode 100644 index 00000000..aa724b77 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/eclipse-project/InfoFlows/JavaToNative/.idea/.gitignore b/eclipse-project/InfoFlows/JavaToNative/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/eclipse-project/InfoFlows/JavaToNative/.idea/compiler.xml b/eclipse-project/InfoFlows/JavaToNative/.idea/compiler.xml new file mode 100644 index 00000000..fb7f4a8a --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/.idea/gradle.xml b/eclipse-project/InfoFlows/JavaToNative/.idea/gradle.xml new file mode 100644 index 00000000..a2d7c213 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/.idea/misc.xml b/eclipse-project/InfoFlows/JavaToNative/.idea/misc.xml new file mode 100644 index 00000000..43c8708d --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/.idea/misc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/.idea/vcs.xml b/eclipse-project/InfoFlows/JavaToNative/.idea/vcs.xml new file mode 100644 index 00000000..c2365ab1 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/.gitignore b/eclipse-project/InfoFlows/JavaToNative/app/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/build.gradle b/eclipse-project/InfoFlows/JavaToNative/app/build.gradle new file mode 100644 index 00000000..a0dc82ab --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/build.gradle @@ -0,0 +1,44 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 32 + + defaultConfig { + applicationId "benchmark.infoflow.javatonative" + minSdk 21 + targetSdk 32 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + externalNativeBuild { + cmake { + version '3.10.2' + path 'src/main/jni/CMakeLists.txt' + } + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.5.0' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/proguard-rules.pro b/eclipse-project/InfoFlows/JavaToNative/app/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/androidTest/java/benchmark/infoflow/javatonative/ExampleInstrumentedTest.java b/eclipse-project/InfoFlows/JavaToNative/app/src/androidTest/java/benchmark/infoflow/javatonative/ExampleInstrumentedTest.java new file mode 100644 index 00000000..12d312e0 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/androidTest/java/benchmark/infoflow/javatonative/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package benchmark.infoflow.javatonative; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("benchmark.infoflow.javatonative", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/AndroidManifest.xml b/eclipse-project/InfoFlows/JavaToNative/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..145fc073 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/java/benchmark/infoflow/javatonative/MainActivity.java b/eclipse-project/InfoFlows/JavaToNative/app/src/main/java/benchmark/infoflow/javatonative/MainActivity.java new file mode 100644 index 00000000..539f7930 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/main/java/benchmark/infoflow/javatonative/MainActivity.java @@ -0,0 +1,35 @@ +package benchmark.infoflow.javatonative; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.telephony.TelephonyManager; +import android.util.Log; + +/** + * @testcase_name JavaToNative + * @version 0.1 + * @author Cyber Security Research Center (CSEC), in Soongsil Univerty (SSU) + * @author_mail gigacms@gmail.com + * + * @description Information leak from java to native code. + * @dataflow source -> imei -> leak to info log + * @number_of_leaks 1 + * @challenges the analysis handle data leak through java to native with JNI Function. + */ +public class MainActivity extends Activity { + + static { + System.loadLibrary("ndkmod"); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); + String imei = telephonyManager.getDeviceId(); //source + nativeSink(imei); + } + public native void nativeSink(String info); +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/jni/CMakeLists.txt b/eclipse-project/InfoFlows/JavaToNative/app/src/main/jni/CMakeLists.txt new file mode 100644 index 00000000..42fd777d --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/main/jni/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.4.1) + +add_library(ndkmod SHARED + ndkmod.c) +# Include libraries needed for mytest lib +target_link_libraries(ndkmod + android + log) diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/jni/ndkmod.c b/eclipse-project/InfoFlows/JavaToNative/app/src/main/jni/ndkmod.c new file mode 100644 index 00000000..4df3a1e5 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/main/jni/ndkmod.c @@ -0,0 +1,7 @@ +#include +#include + +JNIEXPORT void Java_benchmark_infoflow_javatonative_MainActivity_nativeSink(JNIEnv* env, jobject javaThis, jstring info) { + const char *buffer = (*env)->GetStringUTFChars(env, info, JNI_FALSE); + __android_log_print(ANDROID_LOG_INFO, "Benchmark_native", "%s", buffer); //sink +} diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/drawable/ic_launcher_background.xml b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/layout/activity_main.xml b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..17eab17b --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 00000000..c209e78e Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 00000000..b2dfe3d1 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 00000000..4f0f1d64 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 00000000..62b611da Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 00000000..948a3070 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..1b9a6956 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 00000000..28d4b77f Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9287f508 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 00000000..aa7d6427 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9126ae37 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/values-night/themes.xml b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/values-night/themes.xml new file mode 100644 index 00000000..3352f7bc --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/values/colors.xml b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..f8c6127d --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/values/strings.xml b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..ba1e5d85 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + JavaToNative + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/values/themes.xml b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/values/themes.xml new file mode 100644 index 00000000..a4a66028 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/xml/backup_rules.xml b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 00000000..fa0f996d --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/xml/data_extraction_rules.xml b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 00000000..9ee9997b --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/app/src/test/java/benchmark/infoflow/javatonative/ExampleUnitTest.java b/eclipse-project/InfoFlows/JavaToNative/app/src/test/java/benchmark/infoflow/javatonative/ExampleUnitTest.java new file mode 100644 index 00000000..5e665ae9 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/app/src/test/java/benchmark/infoflow/javatonative/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package benchmark.infoflow.javatonative; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/build.gradle b/eclipse-project/InfoFlows/JavaToNative/build.gradle new file mode 100644 index 00000000..5ae9a7b0 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/build.gradle @@ -0,0 +1,9 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id 'com.android.application' version '7.2.2' apply false + id 'com.android.library' version '7.2.2' apply false +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/gradle.properties b/eclipse-project/InfoFlows/JavaToNative/gradle.properties new file mode 100644 index 00000000..dab7c28b --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/eclipse-project/InfoFlows/JavaToNative/gradle/wrapper/gradle-wrapper.jar b/eclipse-project/InfoFlows/JavaToNative/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..e708b1c0 Binary files /dev/null and b/eclipse-project/InfoFlows/JavaToNative/gradle/wrapper/gradle-wrapper.jar differ diff --git a/eclipse-project/InfoFlows/JavaToNative/gradle/wrapper/gradle-wrapper.properties b/eclipse-project/InfoFlows/JavaToNative/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..d2f03f84 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Sep 12 11:07:09 KST 2022 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/eclipse-project/InfoFlows/JavaToNative/gradlew b/eclipse-project/InfoFlows/JavaToNative/gradlew new file mode 100644 index 00000000..4f906e0c --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/eclipse-project/InfoFlows/JavaToNative/gradlew.bat b/eclipse-project/InfoFlows/JavaToNative/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/eclipse-project/InfoFlows/JavaToNative/settings.gradle b/eclipse-project/InfoFlows/JavaToNative/settings.gradle new file mode 100644 index 00000000..6b24e737 --- /dev/null +++ b/eclipse-project/InfoFlows/JavaToNative/settings.gradle @@ -0,0 +1,16 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +rootProject.name = "JavaToNative" +include ':app' diff --git a/eclipse-project/InfoFlows/NativeProxy/.gitignore b/eclipse-project/InfoFlows/NativeProxy/.gitignore new file mode 100644 index 00000000..aa724b77 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/eclipse-project/InfoFlows/NativeProxy/.idea/.gitignore b/eclipse-project/InfoFlows/NativeProxy/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/eclipse-project/InfoFlows/NativeProxy/.idea/compiler.xml b/eclipse-project/InfoFlows/NativeProxy/.idea/compiler.xml new file mode 100644 index 00000000..fb7f4a8a --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/.idea/gradle.xml b/eclipse-project/InfoFlows/NativeProxy/.idea/gradle.xml new file mode 100644 index 00000000..a2d7c213 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/.idea/misc.xml b/eclipse-project/InfoFlows/NativeProxy/.idea/misc.xml new file mode 100644 index 00000000..43c8708d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/.idea/misc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/.idea/vcs.xml b/eclipse-project/InfoFlows/NativeProxy/.idea/vcs.xml new file mode 100644 index 00000000..c2365ab1 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/.gitignore b/eclipse-project/InfoFlows/NativeProxy/app/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/build.gradle b/eclipse-project/InfoFlows/NativeProxy/app/build.gradle new file mode 100644 index 00000000..21a4ce30 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/build.gradle @@ -0,0 +1,44 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 32 + + defaultConfig { + applicationId "benchmark.infoflow.nativeproxy" + minSdk 21 + targetSdk 32 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + externalNativeBuild { + cmake { + version '3.10.2' + path 'src/main/jni/CMakeLists.txt' + } + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.5.0' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/proguard-rules.pro b/eclipse-project/InfoFlows/NativeProxy/app/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/androidTest/java/benchmark/infoflow/nativeproxy/ExampleInstrumentedTest.java b/eclipse-project/InfoFlows/NativeProxy/app/src/androidTest/java/benchmark/infoflow/nativeproxy/ExampleInstrumentedTest.java new file mode 100644 index 00000000..b39472be --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/androidTest/java/benchmark/infoflow/nativeproxy/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package benchmark.infoflow.nativeproxy; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("benchmark.infoflow.nativeproxy", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/AndroidManifest.xml b/eclipse-project/InfoFlows/NativeProxy/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..534f80b5 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/java/benchmark/infoflow/nativeproxy/MainActivity.java b/eclipse-project/InfoFlows/NativeProxy/app/src/main/java/benchmark/infoflow/nativeproxy/MainActivity.java new file mode 100644 index 00000000..1110aa47 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/main/java/benchmark/infoflow/nativeproxy/MainActivity.java @@ -0,0 +1,36 @@ +package benchmark.infoflow.nativeproxy; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.telephony.TelephonyManager; +import android.util.Log; + +/** + * @testcase_name NativeProxy + * @version 0.1 + * @author Cyber Security Research Center (CSEC), in Soongsil Univerty (SSU) + * @author_mail gigacms@gmail.com + * + * @description Information leak from java to java code. + * @dataflow source -> imei -> leak to info log + * @number_of_leaks 1 + * @challenges the analysis handle data leak for java to java through native proxy . + */ +public class MainActivity extends Activity { + + static { + System.loadLibrary("ndkmod"); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); + String imei = telephonyManager.getDeviceId(); //source + String passedImei = nativeProxy(imei); + Log.i("Benchmark", passedImei); //sink + } + public native String nativeProxy(String info); +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/jni/CMakeLists.txt b/eclipse-project/InfoFlows/NativeProxy/app/src/main/jni/CMakeLists.txt new file mode 100644 index 00000000..42fd777d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/main/jni/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.4.1) + +add_library(ndkmod SHARED + ndkmod.c) +# Include libraries needed for mytest lib +target_link_libraries(ndkmod + android + log) diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/jni/ndkmod.c b/eclipse-project/InfoFlows/NativeProxy/app/src/main/jni/ndkmod.c new file mode 100644 index 00000000..b865c2cd --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/main/jni/ndkmod.c @@ -0,0 +1,6 @@ +#include +#include + +JNIEXPORT jstring Java_benchmark_infoflow_nativeproxy_MainActivity_nativeProxy(JNIEnv* env, jobject javaThis, jstring info) { + return info; +} diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/drawable/ic_launcher_background.xml b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/layout/activity_main.xml b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..17eab17b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 00000000..c209e78e Binary files /dev/null and b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 00000000..b2dfe3d1 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 00000000..4f0f1d64 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 00000000..62b611da Binary files /dev/null and b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 00000000..948a3070 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..1b9a6956 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 00000000..28d4b77f Binary files /dev/null and b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9287f508 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 00000000..aa7d6427 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9126ae37 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/values-night/themes.xml b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/values-night/themes.xml new file mode 100644 index 00000000..5263997d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/values/colors.xml b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..f8c6127d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/values/strings.xml b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..fd96fa51 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + NativeProxy + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/values/themes.xml b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/values/themes.xml new file mode 100644 index 00000000..4a65c7c1 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/xml/backup_rules.xml b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 00000000..fa0f996d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/xml/data_extraction_rules.xml b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 00000000..9ee9997b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/app/src/test/java/benchmark/infoflow/nativeproxy/ExampleUnitTest.java b/eclipse-project/InfoFlows/NativeProxy/app/src/test/java/benchmark/infoflow/nativeproxy/ExampleUnitTest.java new file mode 100644 index 00000000..16c98c78 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/app/src/test/java/benchmark/infoflow/nativeproxy/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package benchmark.infoflow.nativeproxy; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/build.gradle b/eclipse-project/InfoFlows/NativeProxy/build.gradle new file mode 100644 index 00000000..5ae9a7b0 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/build.gradle @@ -0,0 +1,9 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id 'com.android.application' version '7.2.2' apply false + id 'com.android.library' version '7.2.2' apply false +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/gradle.properties b/eclipse-project/InfoFlows/NativeProxy/gradle.properties new file mode 100644 index 00000000..dab7c28b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeProxy/gradle/wrapper/gradle-wrapper.jar b/eclipse-project/InfoFlows/NativeProxy/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..e708b1c0 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeProxy/gradle/wrapper/gradle-wrapper.jar differ diff --git a/eclipse-project/InfoFlows/NativeProxy/gradle/wrapper/gradle-wrapper.properties b/eclipse-project/InfoFlows/NativeProxy/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..d2f03f84 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Sep 12 11:07:09 KST 2022 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/eclipse-project/InfoFlows/NativeProxy/gradlew b/eclipse-project/InfoFlows/NativeProxy/gradlew new file mode 100644 index 00000000..4f906e0c --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/eclipse-project/InfoFlows/NativeProxy/gradlew.bat b/eclipse-project/InfoFlows/NativeProxy/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/eclipse-project/InfoFlows/NativeProxy/settings.gradle b/eclipse-project/InfoFlows/NativeProxy/settings.gradle new file mode 100644 index 00000000..e25a9fdf --- /dev/null +++ b/eclipse-project/InfoFlows/NativeProxy/settings.gradle @@ -0,0 +1,16 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +rootProject.name = "NativeProxy" +include ':app' diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/.gitignore b/eclipse-project/InfoFlows/NativeSourceToCallMethod/.gitignore new file mode 100644 index 00000000..aa724b77 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/.gitignore b/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/.name b/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/.name new file mode 100644 index 00000000..ce94ad74 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/.name @@ -0,0 +1 @@ +ArgtoSetField \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/compiler.xml b/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/compiler.xml new file mode 100644 index 00000000..fb7f4a8a --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/gradle.xml b/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/gradle.xml new file mode 100644 index 00000000..a2d7c213 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/misc.xml b/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/misc.xml new file mode 100644 index 00000000..43c8708d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/misc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/vcs.xml b/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/vcs.xml new file mode 100644 index 00000000..c2365ab1 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/.gitignore b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/build.gradle b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/build.gradle new file mode 100644 index 00000000..eed0abb2 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/build.gradle @@ -0,0 +1,44 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 32 + + defaultConfig { + applicationId "benchmark.infoflow.nativesourcetocallmethod" + minSdk 21 + targetSdk 32 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + externalNativeBuild { + cmake { + version '3.10.2' + path 'src/main/jni/CMakeLists.txt' + } + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.5.0' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/proguard-rules.pro b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/androidTest/java/benchmark/infoflow/nativesourcetocallmethod/ExampleInstrumentedTest.java b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/androidTest/java/benchmark/infoflow/nativesourcetocallmethod/ExampleInstrumentedTest.java new file mode 100644 index 00000000..e4c7d845 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/androidTest/java/benchmark/infoflow/nativesourcetocallmethod/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package benchmark.infoflow.nativesourcetocallmethod; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("benchmark.infoflow.nativesourcetocallmethod", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/AndroidManifest.xml b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..0f153195 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/java/benchmark/infoflow/nativesourcetocallmethod/MainActivity.java b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/java/benchmark/infoflow/nativesourcetocallmethod/MainActivity.java new file mode 100644 index 00000000..500717b6 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/java/benchmark/infoflow/nativesourcetocallmethod/MainActivity.java @@ -0,0 +1,38 @@ +package benchmark.infoflow.nativesourcetocallmethod; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.telephony.TelephonyManager; +import android.util.Log; + +/** + * @testcase_name ArgtoSetField + * @version 0.1 + * @author Cyber Security Research Center (CSEC), in Soongsil Univerty (SSU) + * @author_mail gigacms@gmail.com + * + * @description Information leak from java to java code. + * @dataflow source -> imei -> leak to info log + * @number_of_leaks 1 + * @challenges the analysis handle data leak for java to java through native proxy . + */ +public class MainActivity extends Activity { + + static { + System.loadLibrary("ndkmod"); + } + + public String data; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + nativeSourceToCallMethod(); + } + public void leak(String message){ + Log.i("Benchmark", data); //sink + } + public native void nativeSourceToCallMethod(); +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/jni/CMakeLists.txt b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/jni/CMakeLists.txt new file mode 100644 index 00000000..42fd777d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/jni/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.4.1) + +add_library(ndkmod SHARED + ndkmod.c) +# Include libraries needed for mytest lib +target_link_libraries(ndkmod + android + log) diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/jni/ndkmod.c b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/jni/ndkmod.c new file mode 100644 index 00000000..9175a27c --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/jni/ndkmod.c @@ -0,0 +1,13 @@ +#include +#include + +JNIEXPORT void JNICALL Java_benchmark_infoflow_nativesourcetocallmethod_MainActivity_nativeSourceToCallMethod(JNIEnv *env, jobject javaThis) { + const char *property_name = "ro.build.fingerprint"; + char property_value[100] = { 0 }; + __system_property_get(property_name, property_value); // Source in Native code + jstring fingerprint = (*env)->NewStringUTF(env, property_value); + + jclass cls = (*env)->GetObjectClass(env,javaThis); + jmethodID mid = (*env)->GetMethodID(env, cls, "leak", "(Ljava/lang/String;)V"); + (*env)->CallVoidMethod(env, javaThis, mid, fingerprint); +} diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/drawable/ic_launcher_background.xml b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/layout/activity_main.xml b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..17eab17b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 00000000..c209e78e Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 00000000..b2dfe3d1 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 00000000..4f0f1d64 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 00000000..62b611da Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 00000000..948a3070 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..1b9a6956 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 00000000..28d4b77f Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9287f508 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 00000000..aa7d6427 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9126ae37 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/values-night/themes.xml b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/values-night/themes.xml new file mode 100644 index 00000000..f86aa7e3 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/values/colors.xml b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..f8c6127d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/values/strings.xml b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..29445490 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + ArgtoSetField + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/values/themes.xml b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/values/themes.xml new file mode 100644 index 00000000..80406589 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/xml/backup_rules.xml b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 00000000..fa0f996d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/xml/data_extraction_rules.xml b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 00000000..9ee9997b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/test/java/benchmark/infoflow/nativesourcetocallmethod/ExampleUnitTest.java b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/test/java/benchmark/infoflow/nativesourcetocallmethod/ExampleUnitTest.java new file mode 100644 index 00000000..8eb66c60 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/app/src/test/java/benchmark/infoflow/nativesourcetocallmethod/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package benchmark.infoflow.nativesourcetocallmethod; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/build.gradle b/eclipse-project/InfoFlows/NativeSourceToCallMethod/build.gradle new file mode 100644 index 00000000..5ae9a7b0 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/build.gradle @@ -0,0 +1,9 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id 'com.android.application' version '7.2.2' apply false + id 'com.android.library' version '7.2.2' apply false +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/gradle.properties b/eclipse-project/InfoFlows/NativeSourceToCallMethod/gradle.properties new file mode 100644 index 00000000..dab7c28b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/gradle/wrapper/gradle-wrapper.jar b/eclipse-project/InfoFlows/NativeSourceToCallMethod/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..e708b1c0 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToCallMethod/gradle/wrapper/gradle-wrapper.jar differ diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/gradle/wrapper/gradle-wrapper.properties b/eclipse-project/InfoFlows/NativeSourceToCallMethod/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..d2f03f84 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Sep 12 11:07:09 KST 2022 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/gradlew b/eclipse-project/InfoFlows/NativeSourceToCallMethod/gradlew new file mode 100644 index 00000000..4f906e0c --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/gradlew.bat b/eclipse-project/InfoFlows/NativeSourceToCallMethod/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/eclipse-project/InfoFlows/NativeSourceToCallMethod/settings.gradle b/eclipse-project/InfoFlows/NativeSourceToCallMethod/settings.gradle new file mode 100644 index 00000000..ebb2ca11 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToCallMethod/settings.gradle @@ -0,0 +1,16 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +rootProject.name = "ArgtoSetField" +include ':app' diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/.gitignore b/eclipse-project/InfoFlows/NativeSourceToSetField/.gitignore new file mode 100644 index 00000000..aa724b77 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/.gitignore b/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/.name b/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/.name new file mode 100644 index 00000000..ce94ad74 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/.name @@ -0,0 +1 @@ +ArgtoSetField \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/compiler.xml b/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/compiler.xml new file mode 100644 index 00000000..fb7f4a8a --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/gradle.xml b/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/gradle.xml new file mode 100644 index 00000000..a2d7c213 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/misc.xml b/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/misc.xml new file mode 100644 index 00000000..43c8708d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/misc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/vcs.xml b/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/vcs.xml new file mode 100644 index 00000000..c2365ab1 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/.gitignore b/eclipse-project/InfoFlows/NativeSourceToSetField/app/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/build.gradle b/eclipse-project/InfoFlows/NativeSourceToSetField/app/build.gradle new file mode 100644 index 00000000..3fd2344f --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/build.gradle @@ -0,0 +1,44 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 32 + + defaultConfig { + applicationId "benchmark.infoflow.nativesourcetosetfield" + minSdk 21 + targetSdk 32 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + externalNativeBuild { + cmake { + version '3.10.2' + path 'src/main/jni/CMakeLists.txt' + } + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.5.0' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/proguard-rules.pro b/eclipse-project/InfoFlows/NativeSourceToSetField/app/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/androidTest/java/benchmark/infoflow/nativesourcetosetfield/ExampleInstrumentedTest.java b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/androidTest/java/benchmark/infoflow/nativesourcetosetfield/ExampleInstrumentedTest.java new file mode 100644 index 00000000..2380183a --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/androidTest/java/benchmark/infoflow/nativesourcetosetfield/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package benchmark.infoflow.nativesourcetosetfield; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("benchmark.infoflow.nativesourcetosetfield", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/AndroidManifest.xml b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..4d8da17b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/java/benchmark/infoflow/nativesourcetosetfield/MainActivity.java b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/java/benchmark/infoflow/nativesourcetosetfield/MainActivity.java new file mode 100644 index 00000000..7be6243a --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/java/benchmark/infoflow/nativesourcetosetfield/MainActivity.java @@ -0,0 +1,36 @@ +package benchmark.infoflow.nativesourcetosetfield; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.telephony.TelephonyManager; +import android.util.Log; + +/** + * @testcase_name ArgtoSetField + * @version 0.1 + * @author Cyber Security Research Center (CSEC), in Soongsil Univerty (SSU) + * @author_mail gigacms@gmail.com + * + * @description Information leak from java to java code. + * @dataflow source -> imei -> leak to info log + * @number_of_leaks 1 + * @challenges the analysis handle data leak for java to java through native proxy . + */ +public class MainActivity extends Activity { + + static { + System.loadLibrary("ndkmod"); + } + + public String data; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + nativeSourceToSetField(); + Log.i("Benchmark", data); //sink + } + public native void nativeSourceToSetField(); +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/jni/CMakeLists.txt b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/jni/CMakeLists.txt new file mode 100644 index 00000000..42fd777d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/jni/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.4.1) + +add_library(ndkmod SHARED + ndkmod.c) +# Include libraries needed for mytest lib +target_link_libraries(ndkmod + android + log) diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/jni/ndkmod.c b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/jni/ndkmod.c new file mode 100644 index 00000000..4fbb0006 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/jni/ndkmod.c @@ -0,0 +1,13 @@ +#include +#include + +JNIEXPORT void JNICALL Java_benchmark_infoflow_nativesourcetosetfield_MainActivity_nativeSourceToSetField(JNIEnv *env, jobject javaThis) { + const char *property_name = "ro.build.fingerprint"; + char property_value[92] = { 0 }; + __system_property_get(property_name, property_value); // Source in native code + jstring property_str = (*env)->NewStringUTF(env, property_value); + + jclass thizClass = (*env)->GetObjectClass(env, javaThis); + jfieldID dataFieldID = (*env)->GetFieldID(env, thizClass, "data", "Ljava/lang/String;"); + (*env)->SetObjectField(env, javaThis, dataFieldID, property_str); // Native to Java data #2 : Set Field (message) +} diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/drawable/ic_launcher_background.xml b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/layout/activity_main.xml b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..17eab17b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 00000000..c209e78e Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 00000000..b2dfe3d1 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 00000000..4f0f1d64 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 00000000..62b611da Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 00000000..948a3070 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..1b9a6956 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 00000000..28d4b77f Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9287f508 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 00000000..aa7d6427 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9126ae37 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/values-night/themes.xml b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/values-night/themes.xml new file mode 100644 index 00000000..f86aa7e3 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/values/colors.xml b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..f8c6127d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/values/strings.xml b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..29445490 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + ArgtoSetField + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/values/themes.xml b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/values/themes.xml new file mode 100644 index 00000000..80406589 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/xml/backup_rules.xml b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 00000000..fa0f996d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/xml/data_extraction_rules.xml b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 00000000..9ee9997b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/test/java/benchmark/infoflow/nativesourcetosetfield/ExampleUnitTest.java b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/test/java/benchmark/infoflow/nativesourcetosetfield/ExampleUnitTest.java new file mode 100644 index 00000000..a6a978fa --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/app/src/test/java/benchmark/infoflow/nativesourcetosetfield/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package benchmark.infoflow.nativesourcetosetfield; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/build.gradle b/eclipse-project/InfoFlows/NativeSourceToSetField/build.gradle new file mode 100644 index 00000000..5ae9a7b0 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/build.gradle @@ -0,0 +1,9 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id 'com.android.application' version '7.2.2' apply false + id 'com.android.library' version '7.2.2' apply false +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/gradle.properties b/eclipse-project/InfoFlows/NativeSourceToSetField/gradle.properties new file mode 100644 index 00000000..dab7c28b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/gradle/wrapper/gradle-wrapper.jar b/eclipse-project/InfoFlows/NativeSourceToSetField/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..e708b1c0 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeSourceToSetField/gradle/wrapper/gradle-wrapper.jar differ diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/gradle/wrapper/gradle-wrapper.properties b/eclipse-project/InfoFlows/NativeSourceToSetField/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..d2f03f84 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Sep 12 11:07:09 KST 2022 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/gradlew b/eclipse-project/InfoFlows/NativeSourceToSetField/gradlew new file mode 100644 index 00000000..4f906e0c --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/gradlew.bat b/eclipse-project/InfoFlows/NativeSourceToSetField/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/eclipse-project/InfoFlows/NativeSourceToSetField/settings.gradle b/eclipse-project/InfoFlows/NativeSourceToSetField/settings.gradle new file mode 100644 index 00000000..ebb2ca11 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeSourceToSetField/settings.gradle @@ -0,0 +1,16 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +rootProject.name = "ArgtoSetField" +include ':app' diff --git a/eclipse-project/InfoFlows/NativeToJava/.gitignore b/eclipse-project/InfoFlows/NativeToJava/.gitignore new file mode 100644 index 00000000..aa724b77 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/eclipse-project/InfoFlows/NativeToJava/.idea/.gitignore b/eclipse-project/InfoFlows/NativeToJava/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/eclipse-project/InfoFlows/NativeToJava/.idea/compiler.xml b/eclipse-project/InfoFlows/NativeToJava/.idea/compiler.xml new file mode 100644 index 00000000..fb7f4a8a --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/.idea/gradle.xml b/eclipse-project/InfoFlows/NativeToJava/.idea/gradle.xml new file mode 100644 index 00000000..a2d7c213 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/.idea/misc.xml b/eclipse-project/InfoFlows/NativeToJava/.idea/misc.xml new file mode 100644 index 00000000..43c8708d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/.idea/misc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/.idea/vcs.xml b/eclipse-project/InfoFlows/NativeToJava/.idea/vcs.xml new file mode 100644 index 00000000..c2365ab1 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/.gitignore b/eclipse-project/InfoFlows/NativeToJava/app/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/build.gradle b/eclipse-project/InfoFlows/NativeToJava/app/build.gradle new file mode 100644 index 00000000..ccc18d2c --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/build.gradle @@ -0,0 +1,44 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 32 + + defaultConfig { + applicationId "benchmark.infoflow.nativetojava" + minSdk 21 + targetSdk 32 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + externalNativeBuild { + cmake { + version '3.10.2' + path 'src/main/jni/CMakeLists.txt' + } + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.5.0' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/proguard-rules.pro b/eclipse-project/InfoFlows/NativeToJava/app/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/androidTest/java/benchmark/infoflow/nativetojava/ExampleInstrumentedTest.java b/eclipse-project/InfoFlows/NativeToJava/app/src/androidTest/java/benchmark/infoflow/nativetojava/ExampleInstrumentedTest.java new file mode 100644 index 00000000..8cc028f1 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/androidTest/java/benchmark/infoflow/nativetojava/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package benchmark.infoflow.nativetojava; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("benchmark.infoflow.nativetojava", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/AndroidManifest.xml b/eclipse-project/InfoFlows/NativeToJava/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..29b1417e --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/java/benchmark/infoflow/nativetojava/MainActivity.java b/eclipse-project/InfoFlows/NativeToJava/app/src/main/java/benchmark/infoflow/nativetojava/MainActivity.java new file mode 100644 index 00000000..61d00cb0 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/main/java/benchmark/infoflow/nativetojava/MainActivity.java @@ -0,0 +1,32 @@ +package benchmark.infoflow.nativetojava; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; + +/** + * @testcase_name NativeToJava + * @version 0.1 + * @author Cyber Security Research Center (CSEC), in Soongsil Univerty (SSU) + * @author_mail gigacms@gmail.com + * + * @description Information leak from native to java code. + * @dataflow source (native method) -> system property -> return to java -> leak to info log + * @number_of_leaks 1 + * @challenges the analysis handle source from native function, with data alias, and to return value of native method. + */ +public class MainActivity extends Activity { + + static { + System.loadLibrary("ndkmod"); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + String fingerPrint = nativeSource(); + Log.i("Benchmark", fingerPrint); //sink + } + public native String nativeSource(); +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/jni/CMakeLists.txt b/eclipse-project/InfoFlows/NativeToJava/app/src/main/jni/CMakeLists.txt new file mode 100644 index 00000000..42fd777d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/main/jni/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.4.1) + +add_library(ndkmod SHARED + ndkmod.c) +# Include libraries needed for mytest lib +target_link_libraries(ndkmod + android + log) diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/jni/ndkmod.c b/eclipse-project/InfoFlows/NativeToJava/app/src/main/jni/ndkmod.c new file mode 100644 index 00000000..aa533ba9 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/main/jni/ndkmod.c @@ -0,0 +1,10 @@ +#include +#include + +JNIEXPORT jstring Java_benchmark_infoflow_nativetojava_MainActivity_nativeSource(JNIEnv* env, jobject javaThis) { + const char *property_name = "ro.build.fingerprint"; + char property_value[100] = { 0 }; + __system_property_get(property_name, property_value); //source + jstring fingerprint = (*env)->NewStringUTF(env, property_value); + return fingerprint; +} diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/drawable/ic_launcher_background.xml b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/layout/activity_main.xml b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..17eab17b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 00000000..c209e78e Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 00000000..b2dfe3d1 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 00000000..4f0f1d64 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 00000000..62b611da Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 00000000..948a3070 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..1b9a6956 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 00000000..28d4b77f Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9287f508 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 00000000..aa7d6427 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9126ae37 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/values-night/themes.xml b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/values-night/themes.xml new file mode 100644 index 00000000..61be4a34 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/values/colors.xml b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..f8c6127d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/values/strings.xml b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..27872515 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + NativeToJava + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/values/themes.xml b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/values/themes.xml new file mode 100644 index 00000000..757f12ff --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/xml/backup_rules.xml b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 00000000..fa0f996d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/xml/data_extraction_rules.xml b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 00000000..9ee9997b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/app/src/test/java/benchmark/infoflow/nativetojava/ExampleUnitTest.java b/eclipse-project/InfoFlows/NativeToJava/app/src/test/java/benchmark/infoflow/nativetojava/ExampleUnitTest.java new file mode 100644 index 00000000..a7a5059b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/app/src/test/java/benchmark/infoflow/nativetojava/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package benchmark.infoflow.nativetojava; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/build.gradle b/eclipse-project/InfoFlows/NativeToJava/build.gradle new file mode 100644 index 00000000..5ae9a7b0 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/build.gradle @@ -0,0 +1,9 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id 'com.android.application' version '7.2.2' apply false + id 'com.android.library' version '7.2.2' apply false +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/gradle.properties b/eclipse-project/InfoFlows/NativeToJava/gradle.properties new file mode 100644 index 00000000..dab7c28b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToJava/gradle/wrapper/gradle-wrapper.jar b/eclipse-project/InfoFlows/NativeToJava/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..e708b1c0 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToJava/gradle/wrapper/gradle-wrapper.jar differ diff --git a/eclipse-project/InfoFlows/NativeToJava/gradle/wrapper/gradle-wrapper.properties b/eclipse-project/InfoFlows/NativeToJava/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..d2f03f84 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Sep 12 11:07:09 KST 2022 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/eclipse-project/InfoFlows/NativeToJava/gradlew b/eclipse-project/InfoFlows/NativeToJava/gradlew new file mode 100644 index 00000000..4f906e0c --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/eclipse-project/InfoFlows/NativeToJava/gradlew.bat b/eclipse-project/InfoFlows/NativeToJava/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/eclipse-project/InfoFlows/NativeToJava/settings.gradle b/eclipse-project/InfoFlows/NativeToJava/settings.gradle new file mode 100644 index 00000000..752f05e2 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToJava/settings.gradle @@ -0,0 +1,16 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +rootProject.name = "NativeToJava" +include ':app' diff --git a/eclipse-project/InfoFlows/NativeToNative/.gitignore b/eclipse-project/InfoFlows/NativeToNative/.gitignore new file mode 100644 index 00000000..aa724b77 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/eclipse-project/InfoFlows/NativeToNative/.idea/.gitignore b/eclipse-project/InfoFlows/NativeToNative/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/eclipse-project/InfoFlows/NativeToNative/.idea/compiler.xml b/eclipse-project/InfoFlows/NativeToNative/.idea/compiler.xml new file mode 100644 index 00000000..fb7f4a8a --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/.idea/gradle.xml b/eclipse-project/InfoFlows/NativeToNative/.idea/gradle.xml new file mode 100644 index 00000000..a2d7c213 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/.idea/misc.xml b/eclipse-project/InfoFlows/NativeToNative/.idea/misc.xml new file mode 100644 index 00000000..43c8708d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/.idea/misc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/.idea/vcs.xml b/eclipse-project/InfoFlows/NativeToNative/.idea/vcs.xml new file mode 100644 index 00000000..c2365ab1 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/.gitignore b/eclipse-project/InfoFlows/NativeToNative/app/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/build.gradle b/eclipse-project/InfoFlows/NativeToNative/app/build.gradle new file mode 100644 index 00000000..3df3c76d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/build.gradle @@ -0,0 +1,44 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 32 + + defaultConfig { + applicationId "benchmark.infoflow.nativetonative" + minSdk 21 + targetSdk 32 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + externalNativeBuild { + cmake { + version '3.10.2' + path 'src/main/jni/CMakeLists.txt' + } + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.5.0' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/proguard-rules.pro b/eclipse-project/InfoFlows/NativeToNative/app/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/androidTest/java/benchmark/infoflow/nativetonative/ExampleInstrumentedTest.java b/eclipse-project/InfoFlows/NativeToNative/app/src/androidTest/java/benchmark/infoflow/nativetonative/ExampleInstrumentedTest.java new file mode 100644 index 00000000..530a8835 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/androidTest/java/benchmark/infoflow/nativetonative/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package benchmark.infoflow.nativetonative; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("benchmark.infoflow.nativetonative", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/AndroidManifest.xml b/eclipse-project/InfoFlows/NativeToNative/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..83074c74 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/java/benchmark/infoflow/nativetonative/MainActivity.java b/eclipse-project/InfoFlows/NativeToNative/app/src/main/java/benchmark/infoflow/nativetonative/MainActivity.java new file mode 100644 index 00000000..9688abb1 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/main/java/benchmark/infoflow/nativetonative/MainActivity.java @@ -0,0 +1,31 @@ +package benchmark.infoflow.nativetonative; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; + +/** + * @testcase_name NativeToNative + * @version 0.1 + * @author Cyber Security Research Center (CSEC), in Soongsil Univerty (SSU) + * @author_mail gigacms@gmail.com + * + * @description Information leak within native code. + * @dataflow source (native method) -> system property -> leak to native function + * @number_of_leaks 1 + * @challenges the analysis handle source from native function, with data alias, and sink to native function. + */ +public class MainActivity extends Activity { + + static { + System.loadLibrary("ndkmod"); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + nativeSourceSink(); + } + public native void nativeSourceSink(); +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/jni/CMakeLists.txt b/eclipse-project/InfoFlows/NativeToNative/app/src/main/jni/CMakeLists.txt new file mode 100644 index 00000000..42fd777d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/main/jni/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.4.1) + +add_library(ndkmod SHARED + ndkmod.c) +# Include libraries needed for mytest lib +target_link_libraries(ndkmod + android + log) diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/jni/ndkmod.c b/eclipse-project/InfoFlows/NativeToNative/app/src/main/jni/ndkmod.c new file mode 100644 index 00000000..35a4c28c --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/main/jni/ndkmod.c @@ -0,0 +1,10 @@ +#include +#include +#include + +JNIEXPORT void Java_benchmark_infoflow_nativetonative_MainActivity_nativeSourceSink(JNIEnv* env, jobject javaThis) { + const char *property_name = "ro.build.fingerprint"; + char property_value[100] = { 0 }; + __system_property_get(property_name, property_value); //source + __android_log_print(ANDROID_LOG_INFO, "Benchmark_native", "%s", property_value); //sink +} diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/drawable/ic_launcher_background.xml b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/layout/activity_main.xml b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..17eab17b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 00000000..c209e78e Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 00000000..b2dfe3d1 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 00000000..4f0f1d64 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 00000000..62b611da Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 00000000..948a3070 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..1b9a6956 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 00000000..28d4b77f Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9287f508 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 00000000..aa7d6427 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9126ae37 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/values-night/themes.xml b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/values-night/themes.xml new file mode 100644 index 00000000..330a95dc --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/values/colors.xml b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..f8c6127d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/values/strings.xml b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..da14dc5f --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + NativeToNative + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/values/themes.xml b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/values/themes.xml new file mode 100644 index 00000000..44d9758f --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/xml/backup_rules.xml b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 00000000..fa0f996d --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/xml/data_extraction_rules.xml b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 00000000..9ee9997b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/app/src/test/java/benchmark/infoflow/nativetonative/ExampleUnitTest.java b/eclipse-project/InfoFlows/NativeToNative/app/src/test/java/benchmark/infoflow/nativetonative/ExampleUnitTest.java new file mode 100644 index 00000000..06248fd4 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/app/src/test/java/benchmark/infoflow/nativetonative/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package benchmark.infoflow.nativetonative; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/build.gradle b/eclipse-project/InfoFlows/NativeToNative/build.gradle new file mode 100644 index 00000000..5ae9a7b0 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/build.gradle @@ -0,0 +1,9 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id 'com.android.application' version '7.2.2' apply false + id 'com.android.library' version '7.2.2' apply false +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/gradle.properties b/eclipse-project/InfoFlows/NativeToNative/gradle.properties new file mode 100644 index 00000000..dab7c28b --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/eclipse-project/InfoFlows/NativeToNative/gradle/wrapper/gradle-wrapper.jar b/eclipse-project/InfoFlows/NativeToNative/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..e708b1c0 Binary files /dev/null and b/eclipse-project/InfoFlows/NativeToNative/gradle/wrapper/gradle-wrapper.jar differ diff --git a/eclipse-project/InfoFlows/NativeToNative/gradle/wrapper/gradle-wrapper.properties b/eclipse-project/InfoFlows/NativeToNative/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..d2f03f84 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Sep 12 11:07:09 KST 2022 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/eclipse-project/InfoFlows/NativeToNative/gradlew b/eclipse-project/InfoFlows/NativeToNative/gradlew new file mode 100644 index 00000000..4f906e0c --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/eclipse-project/InfoFlows/NativeToNative/gradlew.bat b/eclipse-project/InfoFlows/NativeToNative/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/eclipse-project/InfoFlows/NativeToNative/settings.gradle b/eclipse-project/InfoFlows/NativeToNative/settings.gradle new file mode 100644 index 00000000..156a93b6 --- /dev/null +++ b/eclipse-project/InfoFlows/NativeToNative/settings.gradle @@ -0,0 +1,16 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +rootProject.name = "NativeToNative" +include ':app' diff --git a/eclipse-project/Native/CopyRegion/.gitignore b/eclipse-project/Native/CopyRegion/.gitignore new file mode 100644 index 00000000..aa724b77 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/eclipse-project/Native/CopyRegion/.idea/.gitignore b/eclipse-project/Native/CopyRegion/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/eclipse-project/Native/CopyRegion/.idea/compiler.xml b/eclipse-project/Native/CopyRegion/.idea/compiler.xml new file mode 100644 index 00000000..61a9130c --- /dev/null +++ b/eclipse-project/Native/CopyRegion/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/.idea/deploymentTargetDropDown.xml b/eclipse-project/Native/CopyRegion/.idea/deploymentTargetDropDown.xml new file mode 100644 index 00000000..5c1e5439 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/.idea/gradle.xml b/eclipse-project/Native/CopyRegion/.idea/gradle.xml new file mode 100644 index 00000000..066c7875 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/.idea/jarRepositories.xml b/eclipse-project/Native/CopyRegion/.idea/jarRepositories.xml new file mode 100644 index 00000000..a5f05cd8 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/.idea/misc.xml b/eclipse-project/Native/CopyRegion/.idea/misc.xml new file mode 100644 index 00000000..19aa6a55 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/.idea/vcs.xml b/eclipse-project/Native/CopyRegion/.idea/vcs.xml new file mode 100644 index 00000000..c2365ab1 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/app/.gitignore b/eclipse-project/Native/CopyRegion/app/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/app/build.gradle b/eclipse-project/Native/CopyRegion/app/build.gradle new file mode 100644 index 00000000..8b7ce5c5 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/build.gradle @@ -0,0 +1,45 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdkVersion 33 + buildToolsVersion "33.0.0" + + defaultConfig { + applicationId "ndk.mod.copyregion" + minSdkVersion 19 + targetSdkVersion 33 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + externalNativeBuild { + cmake { + version '3.10.2' + path 'src/main/jni/CMakeLists.txt' + } + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.5.0' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/app/proguard-rules.pro b/eclipse-project/Native/CopyRegion/app/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/app/src/androidTest/java/ndk/mod/copyregion/ExampleInstrumentedTest.java b/eclipse-project/Native/CopyRegion/app/src/androidTest/java/ndk/mod/copyregion/ExampleInstrumentedTest.java new file mode 100644 index 00000000..b6c16b04 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/src/androidTest/java/ndk/mod/copyregion/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package ndk.mod.copyregion; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("ndk.mod.copyregion", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/app/src/main/AndroidManifest.xml b/eclipse-project/Native/CopyRegion/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..b4e1ed16 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/src/main/AndroidManifest.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/app/src/main/java/ndk/mod/copyregion/MainActivity.java b/eclipse-project/Native/CopyRegion/app/src/main/java/ndk/mod/copyregion/MainActivity.java new file mode 100644 index 00000000..34bcb1c1 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/src/main/java/ndk/mod/copyregion/MainActivity.java @@ -0,0 +1,40 @@ +package ndk.mod.copyregion; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Context; +import android.os.Bundle; +import android.telephony.TelephonyManager; +import android.util.Log; + + +/** + * @testcase_name CopyRegion + * @version 0.1 + * @author Cyber Security Research Center (CSEC), in Soongsil Univerty (SSU) + * @author_mail gigacms@gmail.com + * + * @description Obtains the system property in native code and leaks it in native code using Linux sockets + * @dataflow source -> imei -> native method -> copy string region -> return copied string -> leak to toast + * @number_of_leaks 1 + * @challenges the analysis must handle indirect data dependency and new string of JNI Function + */ +public class MainActivity extends AppCompatActivity { + static { + System.loadLibrary("ndkmod"); + } + + // ___________________ + public native String cFuncCopyRegion(String message, int size); // data copy in C code + // ___________________ + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); + String imei = telephonyManager.getDeviceId(); //source + String copiedImei = cFuncCopyRegion(imei, imei.length()); + Log.i("ndkmod", copiedImei); //sink + } +} \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/app/src/main/jni/CMakeLists.txt b/eclipse-project/Native/CopyRegion/app/src/main/jni/CMakeLists.txt new file mode 100644 index 00000000..42fd777d --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/src/main/jni/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.4.1) + +add_library(ndkmod SHARED + ndkmod.c) +# Include libraries needed for mytest lib +target_link_libraries(ndkmod + android + log) diff --git a/eclipse-project/Native/CopyRegion/app/src/main/jni/ndkmod.c b/eclipse-project/Native/CopyRegion/app/src/main/jni/ndkmod.c new file mode 100644 index 00000000..e673c3cc --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/src/main/jni/ndkmod.c @@ -0,0 +1,10 @@ +#include + +JNIEXPORT jstring Java_ndk_mod_copyregion_MainActivity_cFuncCopyRegion(JNIEnv* env, jobject javaThis, jstring message, jint size) { + jchar buffer[100] = { 0 }; + + (*env)->GetStringRegion(env, message, 0, size, buffer); + + jstring copied_data = (*env)->NewString(env, buffer, size); + return copied_data; +} diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/eclipse-project/Native/CopyRegion/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/drawable/ic_launcher_background.xml b/eclipse-project/Native/CopyRegion/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/layout/activity_main.xml b/eclipse-project/Native/CopyRegion/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..4fc24441 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-hdpi/ic_launcher.png b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000..a571e600 Binary files /dev/null and b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 00000000..61da551c Binary files /dev/null and b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-mdpi/ic_launcher.png b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000..c41dd285 Binary files /dev/null and b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 00000000..db5080a7 Binary files /dev/null and b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000..6dba46da Binary files /dev/null and b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 00000000..da31a871 Binary files /dev/null and b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..15ac6817 Binary files /dev/null and b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 00000000..b216f2d3 Binary files /dev/null and b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000..f25a4197 Binary files /dev/null and b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 00000000..e96783cc Binary files /dev/null and b/eclipse-project/Native/CopyRegion/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/values-night/themes.xml b/eclipse-project/Native/CopyRegion/app/src/main/res/values-night/themes.xml new file mode 100644 index 00000000..2bf11fd5 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/values/colors.xml b/eclipse-project/Native/CopyRegion/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..f8c6127d --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/values/strings.xml b/eclipse-project/Native/CopyRegion/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..3b6acfaf --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + CopyRegion + \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/app/src/main/res/values/themes.xml b/eclipse-project/Native/CopyRegion/app/src/main/res/values/themes.xml new file mode 100644 index 00000000..9f90292e --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/app/src/test/java/ndk/mod/copyregion/ExampleUnitTest.java b/eclipse-project/Native/CopyRegion/app/src/test/java/ndk/mod/copyregion/ExampleUnitTest.java new file mode 100644 index 00000000..ee690198 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/app/src/test/java/ndk/mod/copyregion/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package ndk.mod.copyregion; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/build.gradle b/eclipse-project/Native/CopyRegion/build.gradle new file mode 100644 index 00000000..dfbc7c14 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/build.gradle @@ -0,0 +1,24 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + repositories { + google() + jcenter() + } + dependencies { + classpath "com.android.tools.build:gradle:4.1.2" + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/gradle.properties b/eclipse-project/Native/CopyRegion/gradle.properties new file mode 100644 index 00000000..52f5917c --- /dev/null +++ b/eclipse-project/Native/CopyRegion/gradle.properties @@ -0,0 +1,19 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true \ No newline at end of file diff --git a/eclipse-project/Native/CopyRegion/gradle/wrapper/gradle-wrapper.jar b/eclipse-project/Native/CopyRegion/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..f6b961fd Binary files /dev/null and b/eclipse-project/Native/CopyRegion/gradle/wrapper/gradle-wrapper.jar differ diff --git a/eclipse-project/Native/CopyRegion/gradle/wrapper/gradle-wrapper.properties b/eclipse-project/Native/CopyRegion/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..2bcbe96c --- /dev/null +++ b/eclipse-project/Native/CopyRegion/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Aug 31 15:29:03 KST 2022 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip diff --git a/eclipse-project/Native/CopyRegion/gradlew b/eclipse-project/Native/CopyRegion/gradlew new file mode 100644 index 00000000..cccdd3d5 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/eclipse-project/Native/CopyRegion/gradlew.bat b/eclipse-project/Native/CopyRegion/gradlew.bat new file mode 100644 index 00000000..f9553162 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/eclipse-project/Native/CopyRegion/settings.gradle b/eclipse-project/Native/CopyRegion/settings.gradle new file mode 100644 index 00000000..8605ae70 --- /dev/null +++ b/eclipse-project/Native/CopyRegion/settings.gradle @@ -0,0 +1,2 @@ +include ':app' +rootProject.name = "CopyRegion" \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeCode/.idea/.gitignore b/eclipse-project/Native/SourceInNativeCode/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/eclipse-project/Native/SourceInNativeCode/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/eclipse-project/Native/SourceInNativeCode/.idea/libraries/android_support_v4.xml b/eclipse-project/Native/SourceInNativeCode/.idea/libraries/android_support_v4.xml new file mode 100644 index 00000000..90805f27 --- /dev/null +++ b/eclipse-project/Native/SourceInNativeCode/.idea/libraries/android_support_v4.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeCode/.idea/misc.xml b/eclipse-project/Native/SourceInNativeCode/.idea/misc.xml new file mode 100644 index 00000000..639900d1 --- /dev/null +++ b/eclipse-project/Native/SourceInNativeCode/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeCode/.idea/modules.xml b/eclipse-project/Native/SourceInNativeCode/.idea/modules.xml new file mode 100644 index 00000000..36fbf54e --- /dev/null +++ b/eclipse-project/Native/SourceInNativeCode/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeCode/.idea/vcs.xml b/eclipse-project/Native/SourceInNativeCode/.idea/vcs.xml new file mode 100644 index 00000000..c2365ab1 --- /dev/null +++ b/eclipse-project/Native/SourceInNativeCode/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeCode/SourceInNativeCode.iml b/eclipse-project/Native/SourceInNativeCode/SourceInNativeCode.iml new file mode 100644 index 00000000..c90834f2 --- /dev/null +++ b/eclipse-project/Native/SourceInNativeCode/SourceInNativeCode.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeLibCode/.gitignore b/eclipse-project/Native/SourceInNativeLibCode/.gitignore new file mode 100644 index 00000000..aa724b77 --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/eclipse-project/Native/SourceInNativeLibCode/.idea/.gitignore b/eclipse-project/Native/SourceInNativeLibCode/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/eclipse-project/Native/SourceInNativeLibCode/.idea/compiler.xml b/eclipse-project/Native/SourceInNativeLibCode/.idea/compiler.xml new file mode 100644 index 00000000..61a9130c --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeLibCode/.idea/gradle.xml b/eclipse-project/Native/SourceInNativeLibCode/.idea/gradle.xml new file mode 100644 index 00000000..066c7875 --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeLibCode/.idea/jarRepositories.xml b/eclipse-project/Native/SourceInNativeLibCode/.idea/jarRepositories.xml new file mode 100644 index 00000000..a5f05cd8 --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeLibCode/.idea/misc.xml b/eclipse-project/Native/SourceInNativeLibCode/.idea/misc.xml new file mode 100644 index 00000000..19aa6a55 --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeLibCode/.idea/vcs.xml b/eclipse-project/Native/SourceInNativeLibCode/.idea/vcs.xml new file mode 100644 index 00000000..77a3cc7a --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeLibCode/app/.gitignore b/eclipse-project/Native/SourceInNativeLibCode/app/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeLibCode/app/build.gradle b/eclipse-project/Native/SourceInNativeLibCode/app/build.gradle new file mode 100644 index 00000000..99950a39 --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/app/build.gradle @@ -0,0 +1,46 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdkVersion 33 + buildToolsVersion "33.0.0" + + defaultConfig { + applicationId "ndk.mod.sourceinnativelibcode" + minSdkVersion 19 + targetSdkVersion 33 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + externalNativeBuild { + cmake { + version '3.10.2' + path 'src/main/jni/CMakeLists.txt' + } + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.5.0' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeLibCode/app/proguard-rules.pro b/eclipse-project/Native/SourceInNativeLibCode/app/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeLibCode/app/src/androidTest/java/ndk/mod/sourceinnativelibcode/ExampleInstrumentedTest.java b/eclipse-project/Native/SourceInNativeLibCode/app/src/androidTest/java/ndk/mod/sourceinnativelibcode/ExampleInstrumentedTest.java new file mode 100644 index 00000000..bc7dbd9a --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/app/src/androidTest/java/ndk/mod/sourceinnativelibcode/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package ndk.mod.sourceinnativelibcode; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("ndk.mod.sourceinnativelibcode", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeLibCode/app/src/main/AndroidManifest.xml b/eclipse-project/Native/SourceInNativeLibCode/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..f51c8614 --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeLibCode/app/src/main/java/ndk/mod/sourceinnativelibcode/MainActivity.java b/eclipse-project/Native/SourceInNativeLibCode/app/src/main/java/ndk/mod/sourceinnativelibcode/MainActivity.java new file mode 100644 index 00000000..27b26457 --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/app/src/main/java/ndk/mod/sourceinnativelibcode/MainActivity.java @@ -0,0 +1,49 @@ +package ndk.mod.sourceinnativelibcode; + +import android.app.Activity; +import android.os.Bundle; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.Button; +import android.widget.Toast; + +/** + * @testcase_name SourceInNativeLibCode + * @version 0.1 + * @author Cyber Security Research Center (CSEC), in Soongsil Univerty (SSU) + * @author_mail gigacms@gmail.com + * + * @description Obtains the system property in native code and leaks it in native code using Linux sockets + * @dataflow source -> system property get -> write -> leak in native + * @number_of_leaks 1 + * @challenges the analysis must handle native source and sink invocations and capture system-level sinks + */ +public class MainActivity extends Activity { + static { + System.loadLibrary("ndkmod"); + } + + // ___________________ + public native boolean cFuncVerifyDevice(); // Source in C code + // ___________________ + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + Button button = (Button) findViewById(R.id.button1); + button.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View arg0) { + boolean isVerified = cFuncVerifyDevice(); + + if(isVerified){ + Toast.makeText(MainActivity.this, "Success! Verified device.", Toast.LENGTH_LONG).show(); + } + else{ + Toast.makeText(MainActivity.this, "Failed! Unverified device", Toast.LENGTH_LONG).show(); + } + } + }); + } +} \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeLibCode/app/src/main/jni/CMakeLists.txt b/eclipse-project/Native/SourceInNativeLibCode/app/src/main/jni/CMakeLists.txt new file mode 100644 index 00000000..42fd777d --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/app/src/main/jni/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.4.1) + +add_library(ndkmod SHARED + ndkmod.c) +# Include libraries needed for mytest lib +target_link_libraries(ndkmod + android + log) diff --git a/eclipse-project/Native/SourceInNativeLibCode/app/src/main/jni/ndkmod.c b/eclipse-project/Native/SourceInNativeLibCode/app/src/main/jni/ndkmod.c new file mode 100644 index 00000000..b50fbeaa --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/app/src/main/jni/ndkmod.c @@ -0,0 +1,70 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +JNIEXPORT jboolean Java_ndk_mod_sourceinnativelibcode_MainActivity_cFuncVerifyDevice(JNIEnv* env, jobject javaThis) { + /* Verify device fingerprint by communication with server */ + + jboolean isVerified = JNI_FALSE; + const char *property_name = "ro.build.fingerprint"; + char property_value[92] = { 0 }; + __system_property_get(property_name, property_value); + + char* SERVER = "www.google.de"; + char* SERVER_IP = "192.168.43.148"; + + // Open the socket + int sock = socket(AF_INET, SOCK_STREAM, 0); + if (sock < 0) + return isVerified; + + // Resolve the server's host name + struct hostent *server = gethostbyname(SERVER); + if (server < 0) + return isVerified; + + // Connect to the server + struct sockaddr_in address; + memset(&address, 0, sizeof(struct sockaddr_in)); + address.sin_family = AF_INET; + address.sin_port = htons(8080); + address.sin_addr.s_addr = inet_addr(SERVER_IP); +// memcpy(&address->sin_addr.s_addr, server->h_name, server->h_length); + int connection = connect(sock, (struct sockaddr*) &address, sizeof(struct sockaddr_in)); + if (connection < 0) + return isVerified; + + // Write out the data (verify device fingerprint) + /* Verifying code in server is like below + if(strstr(property_value, "release-keys") != NULL){ + isVerified = JNI_TRUE; + } + */ + const char* msg = property_value; + __android_log_print(ANDROID_LOG_INFO, "native_log", "%s", msg); + // Write to server, but we use __android_log_print for JN-SAF pre-defined model. + // int n = write(sock, msg, strlen(msg)); + // if (n < 0) + // return isVerified; + + // // read the result (verify device fingerprint) + // char result[sizeof(char)] = { 0 }; + // read(sock, result, sizeof(char)); + + // close(sock); + + // if (*result){ + // isVerified = JNI_TRUE; + // } + // else{ + // isVerified = JNI_FALSE; + // } + + return isVerified; +} diff --git a/eclipse-project/Native/SourceInNativeLibCode/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/eclipse-project/Native/SourceInNativeLibCode/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-project/Native/SourceInNativeLibCode/app/src/main/res/drawable/ic_launcher_background.xml b/eclipse-project/Native/SourceInNativeLibCode/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse-project/Native/SourceInNativeLibCode/app/src/main/res/layout/activity_main.xml b/eclipse-project/Native/SourceInNativeLibCode/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..116e5627 --- /dev/null +++ b/eclipse-project/Native/SourceInNativeLibCode/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,25 @@ + + + + + +