Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native_method_overloading task seems to leak data #2

Open
j31d0 opened this issue Feb 3, 2021 · 2 comments
Open

native_method_overloading task seems to leak data #2

j31d0 opened this issue Feb 3, 2021 · 2 comments

Comments

@j31d0
Copy link

j31d0 commented Feb 3, 2021

Hello. I have a question about native_method_overloading task.

* @description The value v of a source is sent to an overloaded native function f2.
* f2 is not leaking the data.
* @dataflow
* @number_of_leaks 0

These comments asserts there is no leak in this task.

private void leakImei() {
TelephonyManager tel = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
if (checkSelfPermission(Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
return;
}
String imei = tel.getDeviceId(); // source
send(new int[1], new String[1], imei, 0D);
}

And in leakImei(), it calls send method with 4 arguments (corresponds to signature native void send(int[] array, String[] array2, String data, double d)

JNIEXPORT void JNICALL
Java_org_arguslab_native_1method_1overloading_MainActivity_send___3I_3Ljava_lang_String_2Ljava_lang_String_2D(
JNIEnv *env, jobject thisObj, jintArray array, jobjectArray array2, jstring data,
jdouble d) {
LOGI("%s", getCharFromString(env, data)); // leak
return;
}

But in JNI code, it clearly leaks the data (as comment). Does it actually leaks data? or it's just my misunderstanding?

@cjc-github
Copy link

I think so too.

@cjc-github
Copy link

I recreated an apk according to this source code, but JNSAF detected a leak.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants