-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Hi, Michal. I'd like to ask one question. For an unpatched version of code corresponding to CVE-2023-45777.
Please look at the following code, you said getParcelable without the second typed parameter will return null. But getParcelable(AccountManager.KEY_INTENT,
Intent.class) will throw exception. as readValue will check the intent.class And the following 1,2,3,4 will not bypass the intent check. Am I right? I cannot understand it.
private boolean checkKeyIntentParceledCorrectly(Bundle bundle) {
Parcel p = Parcel.obtain();
p.writeBundle(bundle);
p.setDataPosition(0);
Bundle simulateBundle = p.readBundle();
p.recycle();
Intent intent = bundle.getParcelable(AccountManager.KEY_INTENT);//1. intent will return null because it has an ingenious layout.
if (intent != null && intent.getClass() != Intent.class) {
return false;
}
Intent simulateIntent = simulateBundle.getParcelable(AccountManager.KEY_INTENT,
Intent.class); //2. As you know, it will throw exception because it cannot bypass the check of readValue() function. The process will crash. How could you reach 3. and all return null?
if (intent == null) {
return (simulateIntent == null); //3. Couldn't be here.
}
if (!intent.filterEquals(simulateIntent)) {
return false;
}
if (intent.getSelector() != simulateIntent.getSelector()) {
return false;
}
int prohibitedFlags = Intent.FLAG_GRANT_READ_URI_PERMISSION
| Intent.FLAG_GRANT_WRITE_URI_PERMISSION
| Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
| Intent.FLAG_GRANT_PREFIX_URI_PERMISSION;
return (simulateIntent.getFlags() & prohibitedFlags) == 0;
}
protected boolean checkKeyIntent(int authUid, Bundle bundle) {
if (!checkKeyIntentParceledCorrectly(bundle)) {
EventLog.writeEvent(0x534e4554, "250588548", authUid, "");
return false;
}
Intent intent = bundle.getParcelable(AccountManager.KEY_INTENT, Intent.class); //4. Because the second typed parameter which is Intent.class not equal to array of SecImageClipData will has an exception.
if (intent == null) {
return true;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels