Skip to content

Commit d006db9

Browse files
committed
First version of the query
1 parent 5216bba commit d006db9

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* @name Android Intent redirect
3+
* @description xxx
4+
* @kind path-problem
5+
* @problem.severity error
6+
* @security-severity xx
7+
* @precision high
8+
* @id java/android/unsafe-android-webview-fetch
9+
* @tags security
10+
* external/cwe/cwe-926
11+
* external/cwe/cwe-940
12+
*/
13+
14+
import java
15+
import semmle.code.java.dataflow.DataFlow
16+
import semmle.code.java.security.AndroidIntentRedirectQuery
17+
import DataFlow::PathGraph
18+
19+
from DataFlow::PathNode source, DataFlow::PathNode sink, IntentRedirectConfiguration conf
20+
where conf.hasFlowPath(source, sink)
21+
select sink.getNode(), source, sink,
22+
"Arbitrary Android activities or services can be started from $@.", source.getNode(),
23+
"this user input"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/** Provides taint tracking configurations to be used in Android Intent Redirect queries. */
2+
3+
import java
4+
import semmle.code.java.dataflow.FlowSources
5+
import semmle.code.java.dataflow.TaintTracking
6+
7+
/**
8+
* A taint tracking configuration for user-provided Intents being used to start Android components.
9+
*/
10+
class IntentRedirectConfiguration extends TaintTracking::Configuration {
11+
IntentRedirectConfiguration() { this = "IntentRedirectConfiguration" }
12+
13+
override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
14+
15+
override predicate isSink(DataFlow::Node sink) {
16+
exists(MethodAccess ma |
17+
ma.getMethod() instanceof StartActivityMethod or
18+
ma.getMethod() instanceof StartServiceMethod or
19+
ma.getMethod() instanceof SendBroadcastMethod
20+
|
21+
ma.getArgument(0) = sink.asExpr()
22+
)
23+
}
24+
}

0 commit comments

Comments
 (0)