android:exported
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
OWASP カテゴリ: MASVS-PLATFORM: プラットフォームのインタラクション
概要
android:exported
属性により、コンポーネント(アクティビティ、サービス、ブロードキャスト レシーバなど)を他のアプリのコンポーネントが起動できるかどうかが決まります。
true
の場合、アクティビティはどのアプリからもアクセスでき、正確なクラス名で起動できます。
false
の場合、アクティビティは、同じアプリのコンポーネント、同じユーザー ID を持つアプリ、または特権システム コンポーネントでしか起動できません。
この属性のデフォルト値の背後にあるロジックは時間とともに変化し、コンポーネントのタイプと Android のバージョンによって異なりました。たとえば、API レベル 16(Android 4.1.1)以前は、<provider>
要素の値はデフォルトで true
に設定されています。この属性を明示的に設定しなければ、一部のデバイス間でデフォルト値が異なるというリスクがあります。
影響
デフォルト値が異なると、誤って内部のアプリケーション コンポーネントを公開してしまう可能性があります。たとえば次のような結果が考えられます。
サービス拒否攻撃。
アプリの内部機能の変更を目的とした他のアプリによる不正なアクセス。
機密データの漏洩。
脆弱なアプリケーションのコンテキストでのコード実行。
リスクの軽減
常に android:exported
属性を明示的に設定します。こうすることで解釈の余地がなくなり、コンポーネントの可視化に関する意図が明確に示されます。
あなたへのおすすめ
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2024-02-23 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2024-02-23 UTC。"],[],[],null,["# android:exported\n\n\u003cbr /\u003e\n\n**OWASP category:** [MASVS-PLATFORM: Platform Interaction](https://mas.owasp.org/MASVS/09-MASVS-PLATFORM)\n\nOverview\n--------\n\nThe `android:exported` [attribute](/guide/topics/manifest/activity-element#exported) sets whether a component (activity, service, broadcast receiver, etc.) can be launched by components of other applications:\n\n- If `true`, any app can access the activity and launch it by its exact class name.\n- If `false`, only components of the same application, applications with the same user ID, or privileged system components can launch the activity.\n\nThe logic behind the default value of this attribute changed over time and was different depending on the component types and Android versions. For example, on API level 16 (Android 4.1.1) or lower the value for `\u003cprovider\u003e` elements is set to `true` by default. Not setting this attribute explicitly carries the risk of having different default values between some devices.\n\nImpact\n------\n\nThe situation with different default values means you could accidentally expose internal application components. A few examples of the consequences could be the following:\n\nDenial of service attacks.\nOther apps inappropriately accessing internal components to modify your app's internal functionality.\nLeaking of sensitive data.\nCode execution in the context of the vulnerable application.\n\nMitigations\n-----------\n\nAlways explicitly set the `android:exported` attribute. This will leave no room for interpretation and clearly signal your intention with regard to a component's visibility.\n\nRecommended for you\n-------------------\n\n- Note: link text is displayed when JavaScript is off\n- [# Key management {:#key-management}](/topic/security/data)\n- [Run embedded DEX code directly from APK](/topic/security/dex)\n- [Tapjacking](/topic/security/risks/tapjacking)"]]