ربودن با قصد ضمنی
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
دسته OWASP: MASVS-PLATFORM: پلتفرم تعامل
نمای کلی
آسیبپذیری intent hijacking زمانی رخ میدهد که یک برنامه کاربردی یک نام کلاس جزء یا بسته کاملاً واجد شرایط را هنگام فراخوانی یک intent مشخص نمیکند. این به یک برنامه مخرب اجازه می دهد تا به جای برنامه مورد نظر، یک فیلتر قصد را برای رهگیری هدف ثبت کند.
بسته به محتوای هدف، مهاجمان میتوانند اطلاعات حساس را بخوانند یا تغییر دهند یا با اشیاء قابل تغییر تعامل کنند، مانند PendingIntent یا Binderهای قابل تغییر .
ربودن یک هدف ضمنی همچنین می تواند به مهاجم اجازه دهد تا اقدامات دلخواه مانند راه اندازی اجزای کنترل شده توسط مهاجم را انجام دهد.
تاثیر
اگر یک هدف ضمنی که دادههای حساس را مدیریت میکند، یک نشانه جلسه را در یک رشته URL اضافی برای باز کردن WebView ارسال کند، هر برنامهای که فیلترهای هدف مناسب را مشخص کند میتواند این نشانه را بخواند. این میتواند به هر برنامهای که به درستی پیکربندی شده روی دستگاه باشد اجازه میدهد تا هدف را رهگیری کند و دادههای حساس درون آن را بخواند، و به مهاجمان اجازه میدهد دادههایی مانند PII یا نشانههای جلسه را استخراج کنند.
کاهش
مگر اینکه برنامه به آن نیاز داشته باشد، با فراخوانی setPackage()
قصد را واضح نشان دهید. این اجازه می دهد تا هدف فقط توسط یک مؤلفه خاص تفسیر شود (اعم از درون برنامه یا سایر برنامه ها) و از رهگیری داده های ارسال شده همراه با هدف توسط برنامه های غیرقابل اعتماد جلوگیری می کند. قطعه زیر نشان می دهد که چگونه یک intent را واضح بیان کنید:
کاتلین
val intent = Intent("android.intent.action.CREATE_DOCUMENT").apply {
addCategory("android.intent.category.OPENABLE")
setPackage("com.some.packagename")
setType("*/*")
putExtra("android.intent.extra.LOCAL_ONLY", true)
putExtra("android.intent.extra.TITLE", "Some Title")
}
startActivity(intent)
جاوا
Intent intent = new Intent("android.intent.action.CREATE_DOCUMENT");
intent.addCategory("android.intent.category.OPENABLE");
intent.setPackage("com.some.packagename");
intent.setType("*/*");
intent.putExtra("android.intent.extra.LOCAL_ONLY", true);
intent.putExtra("android.intent.extra.TITLE", "Some Title");
startActivity(intent);
اگر نیاز به استفاده از مقاصد ضمنی دارید، اطلاعات حساس یا اشیاء قابل تغییری را که نمیخواهید افشا کنید حذف کنید. ممکن است زمانی لازم باشد که از مقاصد ضمنی استفاده شود که یک برنامه اطلاعات دقیقی در مورد اینکه کدام برنامه این عمل را حل می کند (مثلاً نوشتن ایمیل، گرفتن عکس و غیره) ندارد.
منابع
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# Implicit intent hijacking\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 [implicit intent](/guide/components/intents-filters#Types) hijacking vulnerability occurs when an application does\nnot specify a fully-qualified component class name or package when invoking an\nintent. This allows a malicious application to register an intent filter to\nintercept the intent instead of the intended application.\n\nDepending on the intent content, attackers could read or modify sensitive\ninformation or interact with mutable objects, such as [mutable](/reference/android/app/PendingIntent#FLAG_MUTABLE)\n[PendingIntents](/reference/android/app/PendingIntent) or [Binders](/reference/android/os/Binder).\n\nHijacking an implicit intent can also allow an attacker to perform arbitrary\nactions such as launching attacker-controlled components.\n\nImpact\n------\n\nIf an implicit intent handling sensitive data passes a session token within an\nextra URL string to open a WebView, any application specifying the proper intent\nfilters can read this token. This can allow any properly-configured application\non the device to intercept the intent and read the sensitive data within,\nallowing attackers to exfiltrate data such as PII or session tokens.\n\nMitigations\n-----------\n\nUnless the application requires it, make intents explicit by calling\n`setPackage()`. This allows the intent to be interpreted only by a specific\ncomponent (either in-app or from other applications), preventing untrusted\napplications from intercepting the data sent along with the intent. The\nfollowing snippet shows how to make an intent explicit: \n\n### Kotlin\n\n val intent = Intent(\"android.intent.action.CREATE_DOCUMENT\").apply {\n addCategory(\"android.intent.category.OPENABLE\")\n setPackage(\"com.some.packagename\")\n setType(\"*/*\")\n putExtra(\"android.intent.extra.LOCAL_ONLY\", true)\n putExtra(\"android.intent.extra.TITLE\", \"Some Title\")\n }\n startActivity(intent)\n\n### Java\n\n Intent intent = new Intent(\"android.intent.action.CREATE_DOCUMENT\");\n intent.addCategory(\"android.intent.category.OPENABLE\");\n intent.setPackage(\"com.some.packagename\");\n intent.setType(\"*/*\");\n intent.putExtra(\"android.intent.extra.LOCAL_ONLY\", true);\n intent.putExtra(\"android.intent.extra.TITLE\", \"Some Title\");\n startActivity(intent);\n\nIf you need to use implicit intents, omit any sensitive information or mutable\nobjects that you don't want to expose. Implicit intents may need to be used when\nan app does not have exact knowledge about which app will resolve the action\n(e.g. composing an email, taking a picture, etc.).\n\nResources\n---------\n\n- [Manifest intent-filter element](/guide/topics/manifest/intent-filter-element)\n- [Privileged Permission Allowlisting](https://source.android.com/devices/tech/config/perms-allowlist)\n- [Intents and Intent filters](/guide/components/intents-filters)\n- [Forcing chooser for implicit intents](/guide/components/intents-filters#ForceChooser)\n- [Common implicit intents](/guide/components/intents-common)"]]