Skip to content

Commit e02be6c

Browse files
Add additional sinks
1 parent e616122 commit e02be6c

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

java/ql/lib/semmle/code/java/security/AndroidSensitiveBroadcastQuery.qll

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,26 @@ private predicate isSensitiveBroadcastSink(DataFlow::Node sendBroadcastCallArg)
111111
)
112112
}
113113

114+
/**
115+
* Holds if `arg` as an argument to a use of a `startActivity` or `startService` method that sends an intent to another application.
116+
*/
117+
private predicate isStartActivityOrServiceSink(DataFlow::Node arg) {
118+
exists(MethodAccess ma, string name | ma.getMethod().hasName(name) |
119+
arg.asExpr() = ma.getArgument(0) and
120+
ma.getMethod().getDeclaringType().getASourceSupertype*() instanceof TypeContext and
121+
// startActivity(Intent intent)
122+
// startActivity(Intent intent, Bundle options)
123+
// startActivities(Intent[] intents)
124+
// startActivities(Intent[] intents, Bundle options)
125+
// startService(Intent service)
126+
// startForegroundService(Intent service)
127+
// bindService (Intent service, int flags, Executor executor, ServiceConnection conn)
128+
// bindService (Intent service, Executor executor, ServiceConnection conn)
129+
name =
130+
["startActivity", "startActivities", "startService", "startForegroundService", "bindService"]
131+
)
132+
}
133+
114134
predicate isCleanIntent(Expr intent) {
115135
intent.getType() instanceof TypeIntent and
116136
(
@@ -146,7 +166,11 @@ class SensitiveBroadcastConfig extends TaintTracking::Configuration {
146166
source.asExpr() instanceof SensitiveInfoExpr
147167
}
148168

149-
override predicate isSink(DataFlow::Node sink) { isSensitiveBroadcastSink(sink) }
169+
override predicate isSink(DataFlow::Node sink) {
170+
isSensitiveBroadcastSink(sink)
171+
or
172+
isStartActivityOrServiceSink(sink)
173+
}
150174

151175
/**
152176
* Holds if broadcast doesn't specify receiving package name of the 3rd party app

0 commit comments

Comments
 (0)