Services declared without permissions
未声明权限的服务
描述
service是一个应用程序组件,可以处理在后台执行的操作,而无需用户交互。service还可用于向其他应用程序公开功能。这对应于调用Context.bindService()以建立与服务的连接并与之交互。
不受保护的服务可以被其他应用程序调用,并可能访问敏感信息或执行特权操作。
建议
service可以向外部组件公开几种方法。可以使用checkPermission方法为每种方法定义任意权限。
还可以通过在清单的<service>标签中强制执行权限来分离服务并限制访问。
<permission android:name="co.ostorlab.custom_permission" android:label="custom_permission"
android:protectionLevel="dangerous"></permission>
<service android:name="co.ostorlab.custom_service" android:permission="co.ostorlab.custom_permission">
<intent-filter>
<action android:name="co.ostorlab.ACTION"/>
</intent-filter>
</service>
服务可以在执行该调用的实现之前通过调用checkCallingPermission方法在单个IPC调用上强制执行权限。
链接
- Security Decisions Via Untrusted Inputs (OWASP Mobile Top 10)
- Service (Android Developer Documentation)
- CWE-280: Improper Handling of Insufficient Permissions or Privileges
标准
- OWASP_MASVS_L1:
- MSTG_PLATFORM_2
- OWASP_MASVS_L2:
- MSTG_PLATFORM_2
- PCI_STANDARDS:
- REQ_2_2
- REQ_6_2
- REQ_6_3
- REQ_7_3
- REQ_11_3
- OWASP_MASVS_v2_1:
- MASVS_AUTH_1
- HIPAA_CONTROLS:
- SECURITY221
- SECURITY212
- SECURITY213
- SOC2_CONTROLS:
- CC_2_1
- CC_4_1
- CC_6_1
- CC_7_1
- CC_7_2
- CC_7_4
- CC_7_5