You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[share] Broadcast receiver registered as RECEIVER_EXPORTED without permission guard (CWE-926) #2591
SharePlugin.load() registers the EXTRA_CHOSEN_COMPONENT broadcast receiver with ContextCompat.RECEIVER_EXPORTED and no permission string or sender check:
Because the receiver is exported, any app on the device can broadcast an intent with action Intent.EXTRA_CHOSEN_COMPONENT and overwrite chosenComponent. That value is returned to JS as activityType from Share.share(), so the reported target app can be spoofed.
Impact is low. The field is informational only and nothing else consumes it. Still, static analysis (Veracode) flags it as CWE-926 (Improper Export of Android Application Components), which blocks security sign-off for apps that depend on this plugin.
Expected Behavior
The receiver should only accept the callback from the system chooser. That broadcast is delivered through a PendingIntent created by this app, so it carries the app's own identity and a non-exported receiver will still receive it. The registration should use ContextCompat.RECEIVER_NOT_EXPORTED.
Code Reproduction
Not required to observe the issue; it is visible in the plugin source at the line above. To confirm at runtime, install any second app that sends:
If there is concern about OEM or third-party share sheets that fire the broadcast directly rather than through the PendingIntent, an alternative is to keep the receiver exported but include a random nonce as an extra on the PendingIntent and ignore any broadcast that does not echo it back.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.
Activity
OS-pedrogustavobilro commentedon Sep 7, 2026
Hey @jyc66 thanks for opening the issue.
I tested using
RECEIVER_NOT_EXPORTEDbut that seems to make the receiver not receive any events on Android 14+.The nonce idea is working fine from my tests, so that's what I have at #2592.
OS-pedrogustavobilro commentedon Sep 16, 2026
Released in @capacitor/share@8.0.2
ionitron-bot commentedon Oct 1, 2026
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.