android:ส่งออกแล้ว
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หมวดหมู่ OWASP: MASVS-PLATFORM: การโต้ตอบกับแพลตฟอร์ม
ภาพรวม
android:exported
attribute จะกำหนดว่าคอมโพเนนต์ (กิจกรรม บริการ Broadcast Receiver ฯลฯ) สามารถเปิดตัวโดยคอมโพเนนต์ของแอปพลิเคชันอื่นๆ ได้หรือไม่
- หาก
true
แอปใดก็ได้จะเข้าถึงกิจกรรมและเปิดใช้กิจกรรมนั้นตามชื่อชั้นเรียนที่แน่นอน
- หาก
false
มีเพียงคอมโพเนนต์ของแอปพลิเคชันเดียวกัน แอปพลิเคชันที่มีรหัสผู้ใช้เดียวกัน หรือคอมโพเนนต์ของระบบที่มีสิทธิ์เท่านั้นที่จะเปิดใช้งานกิจกรรมได้
ตรรกะเบื้องหลังค่าเริ่มต้นของแอตทริบิวต์นี้มีการเปลี่ยนแปลงเมื่อเวลาผ่านไป และแตกต่างกันไปตามประเภทคอมโพเนนต์และเวอร์ชัน Android เช่น ใน API ระดับ 16 (Android 4.1.1) หรือต่ำกว่า ระบบจะตั้งค่าสำหรับองค์ประกอบ <provider>
เป็น true
โดยค่าเริ่มต้น การไม่ตั้งค่าแอตทริบิวต์นี้อย่างชัดเจนอาจทำให้ค่าเริ่มต้นของอุปกรณ์บางเครื่องแตกต่างกัน
ผลกระทบ
สถานการณ์ที่มีค่าเริ่มต้นที่แตกต่างกันหมายความว่าคุณอาจเปิดเผยคอมโพเนนต์แอปพลิเคชันภายในโดยไม่ตั้งใจ ตัวอย่างผลลัพธ์ที่อาจเกิดขึ้นมีดังนี้
การโจมตีแบบปฏิเสธการให้บริการ
แอปอื่นๆ เข้าถึงคอมโพเนนต์ภายในอย่างไม่เหมาะสมเพื่อแก้ไขฟังก์ชันการทำงานภายในของแอป
การรั่วไหลของข้อมูลที่ละเอียดอ่อน
การเรียกใช้โค้ดในบริบทของแอปพลิเคชันที่มีช่องโหว่
การลดปัญหา
ตั้งค่าแอตทริบิวต์ android:exported
อย่างชัดเจนเสมอ วิธีนี้จะช่วยให้ไม่มีข้อสงสัยและแสดงเจตนาของคุณอย่างชัดเจนเกี่ยวกับระดับการมองเห็นของคอมโพเนนต์
แนะนำสำหรับคุณ
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[null,null,["อัปเดตล่าสุด 2025-07-27 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)"]]