Answer the question
In order to leave comments, you need to log in
How to prevent PendingIntent from being fired?
The Android Settings app (Android ~4.0 - 4.4) has a vulnerability that allows you to run illegal tasks, such as MASTER_CLEAR, send SMS, without the necessary permissions.
I want to write a small module for the XPosed Framework (a framework that can manipulate system java classes) that should prevent a PendingIntent from being launched from system rights.
Vulnerability robot principle:
seclists.org/fulldisclosure/2014/Nov/81
Code that fires a PendingIntent that can perform a malicious action:
private void addAccount(String accountType) {
Bundle addAccountOptions = new Bundle();
mPendingIntent = PendingIntent.getBroadcast(this, 0, new Intent(), 0);
addAccountOptions.putParcelable(KEY_CALLER_IDENTITY, mPendingIntent);
addAccountOptions.putBoolean(EXTRA_HAS_MULTIPLE_USERS, Utils.hasMultipleUsers(this));
AccountManager.get(this).addAccount(
accountType,
null, /* authTokenType */
null, /* requiredFeatures */
addAccountOptions,
null,
mCallback,
null /* handler */);
mAddAccountCalled = true;
}
//Вытаскиваю Context и переменную mPendingIntent
Context context = (Context) param.thisObject;
Field field = findField(param.thisObject.getClass(), "mPendingIntent");
PendingIntent mPendingIntent = (PendingIntent) field.get(context);
//отменяю её
mPendingIntent.cancel();
//.... остальной код
Answer the question
In order to leave comments, you need to log in
You need to create a new PendingIntent with the same requestCode and flag as the started PendingIntent you want to cancel. And cancel the newly created PeningIntent.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question