The application is vulnerable to Fragment Injection caused either by an unsafe implementation of PreferenceActivity or an insecure configuration of isValidFragment.
Use malicious fragments to exploit different vulnerabilities.
- Set the attribute exported to false to avoid the attempt of foreign applications to exploit the vulnerability.
- Ensure the application is running with targetSdkVersion higher than 19.
- Set a whitelist of trusted fragments and validate them through the implementation of isValidFragment.
Authenticated attacker from the Internet.
⌚ 120 minutes.
Default score using CVSS 3.1. It may change depending on the context of the src.
Default score using CVSS 4.0. It may change depending on the context of the src.
Implement a check for every fragment introduced to the application
public boolean isValidFragment(String fragmentName) {
return MyFragment.class.getName().equals(fragmentName);
}
There are unverified inputs that are used to put fragments into the application
@Override
String initialFragment = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT);
Bundle initialArguments = getIntent().getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS);
if (savedInstanceState != null) {
//Handle Exception
} else {
if (initialFragment != null && mSinglePane) {
// Add Fragment to the application
}
}
}