mirror of
https://github.com/github/codeql.git
synced 2025-12-21 19:26:31 +01:00
Remove checks for dynamically registered recievers
This commit is contained in:
9
java/ql/src/Security/CWE/CWE-925/AndroidManifest.xml
Normal file
9
java/ql/src/Security/CWE/CWE-925/AndroidManifest.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="test">
|
||||
<application>
|
||||
<receiver android:name=".BootReceiverXml">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -1,9 +1,3 @@
|
||||
// ...
|
||||
IntentFilter filter = new IntentFilter(Intent.ACTION_SHUTDOWN);
|
||||
BroadcastReceiver sReceiver = new ShutDownReceiver();
|
||||
context.registerReceiver(sReceiver, filter);
|
||||
// ...
|
||||
|
||||
public class ShutdownReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
// ...
|
||||
IntentFilter filter = new IntentFilter(Intent.ACTION_SHUTDOWN);
|
||||
BroadcastReceiver sReceiver = new ShutDownReceiver();
|
||||
context.registerReceiver(sReceiver, filter);
|
||||
// ...
|
||||
|
||||
public class ShutdownReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
|
||||
@@ -21,6 +21,7 @@ Otherwise, a third-party application could impersonate the system this way and c
|
||||
without checking that the received action is indeed <code>ACTION_SHUTDOWN</code>. This allows third-party applications to
|
||||
send explicit intents to this receiver to cause a denial of service.</p>
|
||||
<sample src="Bad.java" />
|
||||
<sample src="AndroidManifest.xml" />
|
||||
</example>
|
||||
|
||||
<recommendation>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import java
|
||||
import semmle.code.java.security.ImproperIntentVerificationQuery
|
||||
|
||||
from Top reg, Method orm, SystemActionName sa
|
||||
from AndroidReceiverXmlElement reg, Method orm, SystemActionName sa
|
||||
where unverifiedSystemReceiver(reg, orm, sa)
|
||||
select orm, "This reciever doesn't verify intents it receives, and is registered $@ to receive $@.",
|
||||
reg, "here", sa, "the system action " + sa.getName()
|
||||
|
||||
Reference in New Issue
Block a user