@@ -11,7 +11,7 @@ import semmle.code.java.security.AndroidIntentRedirection
1111class IntentRedirectionConfiguration extends TaintTracking:: Configuration {
1212 IntentRedirectionConfiguration ( ) { this = "IntentRedirectionConfiguration" }
1313
14- override predicate isSource ( DataFlow:: Node source ) { source instanceof RemoteFlowSource }
14+ override predicate isSource ( DataFlow:: Node source ) { source instanceof IntentRedirectionSource }
1515
1616 override predicate isSink ( DataFlow:: Node sink ) { sink instanceof IntentRedirectionSink }
1717
@@ -23,3 +23,35 @@ class IntentRedirectionConfiguration extends TaintTracking::Configuration {
2323 any ( IntentRedirectionAdditionalTaintStep c ) .step ( node1 , node2 )
2424 }
2525}
26+
27+ /** The method `getParcelableExtra` called on a tainted `Intent`. */
28+ private class IntentRedirectionSource extends DataFlow:: Node {
29+ IntentRedirectionSource ( ) {
30+ exists ( GetParcelableExtra ma | this .asExpr ( ) = ma .getQualifier ( ) ) and
31+ exists ( IntentToGetParcelableExtraConf conf | conf .hasFlowTo ( this ) )
32+ }
33+ }
34+
35+ /**
36+ * Data flow from a remote intent to the qualifier of a `getParcelableExtra` call.
37+ */
38+ private class IntentToGetParcelableExtraConf extends DataFlow2:: Configuration {
39+ IntentToGetParcelableExtraConf ( ) { this = "IntentToGetParcelableExtraConf" }
40+
41+ override predicate isSource ( DataFlow:: Node source ) { source instanceof RemoteFlowSource }
42+
43+ override predicate isSink ( DataFlow:: Node sink ) {
44+ exists ( GetParcelableExtra ma | sink .asExpr ( ) = ma .getQualifier ( ) )
45+ }
46+ }
47+
48+ /** A call to the method `Intent.getParcelableExtra`. */
49+ private class GetParcelableExtra extends MethodAccess {
50+ GetParcelableExtra ( ) {
51+ exists ( Method m |
52+ this .getMethod ( ) = m and
53+ m .getDeclaringType ( ) instanceof TypeIntent and
54+ m .hasName ( "getParcelableExtra" )
55+ )
56+ }
57+ }
0 commit comments