1
1
/** Provides classes to reason about JNDI injection vulnerabilities. */
2
2
3
3
import java
4
+ import semmle.code.java.dataflow.DataFlow
4
5
import semmle.code.java.dataflow.ExternalFlow
5
- import semmle.code.java.dataflow.FlowSources
6
- import experimental.semmle.code.java.frameworks.Jndi
6
+ import semmle.code.java.frameworks.Jndi
7
7
import semmle.code.java.frameworks.SpringLdap
8
- import DataFlow
9
8
10
9
/** A data flow sink for unvalidated user input that is used in JNDI lookup. */
11
10
abstract class JndiInjectionSink extends DataFlow:: Node { }
@@ -82,7 +81,6 @@ private class DefaultJndiInjectionSinkModel extends SinkModelCsv {
82
81
override predicate row ( string row ) {
83
82
row =
84
83
[
85
- // JDK
86
84
"javax.naming;InitialContext;true;lookup;;;Argument[0];jndi-injection" ,
87
85
"javax.naming;InitialContext;true;lookupLink;;;Argument[0];jndi-injection" ,
88
86
"javax.naming;InitialContext;true;doLookup;;;Argument[0];jndi-injection" ,
@@ -143,7 +141,7 @@ private class DefaultJndiInjectionAdditionalTaintStep extends JndiInjectionAddit
143
141
* Holds if `n1` to `n2` is a dataflow step that converts between `String` and `CompositeName` or
144
142
* `CompoundName`, i.e. `new CompositeName(tainted)` or `new CompoundName(tainted)`.
145
143
*/
146
- private predicate nameStep ( ExprNode n1 , ExprNode n2 ) {
144
+ private predicate nameStep ( DataFlow :: ExprNode n1 , DataFlow :: ExprNode n2 ) {
147
145
exists ( ConstructorCall cc |
148
146
cc .getConstructedType ( ) instanceof TypeCompositeName or
149
147
cc .getConstructedType ( ) instanceof TypeCompoundName
@@ -157,7 +155,7 @@ private predicate nameStep(ExprNode n1, ExprNode n2) {
157
155
* Holds if `n1` to `n2` is a dataflow step that converts between `String` and `JMXServiceURL`,
158
156
* i.e. `new JMXServiceURL(tainted)`.
159
157
*/
160
- private predicate jmxServiceUrlStep ( ExprNode n1 , ExprNode n2 ) {
158
+ private predicate jmxServiceUrlStep ( DataFlow :: ExprNode n1 , DataFlow :: ExprNode n2 ) {
161
159
exists ( ConstructorCall cc | cc .getConstructedType ( ) instanceof TypeJMXServiceURL |
162
160
n1 .asExpr ( ) = cc .getAnArgument ( ) and
163
161
n2 .asExpr ( ) = cc
@@ -168,7 +166,7 @@ private predicate jmxServiceUrlStep(ExprNode n1, ExprNode n2) {
168
166
* Holds if `n1` to `n2` is a dataflow step that converts between `JMXServiceURL` and
169
167
* `JMXConnector`, i.e. `JMXConnectorFactory.newJMXConnector(tainted)`.
170
168
*/
171
- private predicate jmxConnectorStep ( ExprNode n1 , ExprNode n2 ) {
169
+ private predicate jmxConnectorStep ( DataFlow :: ExprNode n1 , DataFlow :: ExprNode n2 ) {
172
170
exists ( MethodAccess ma , Method m | n1 .asExpr ( ) = ma .getArgument ( 0 ) and n2 .asExpr ( ) = ma |
173
171
ma .getMethod ( ) = m and
174
172
m .getDeclaringType ( ) instanceof TypeJMXConnectorFactory and
@@ -180,7 +178,7 @@ private predicate jmxConnectorStep(ExprNode n1, ExprNode n2) {
180
178
* Holds if `n1` to `n2` is a dataflow step that converts between `JMXServiceURL` and
181
179
* `RMIConnector`, i.e. `new RMIConnector(tainted)`.
182
180
*/
183
- private predicate rmiConnectorStep ( ExprNode n1 , ExprNode n2 ) {
181
+ private predicate rmiConnectorStep ( DataFlow :: ExprNode n1 , DataFlow :: ExprNode n2 ) {
184
182
exists ( ConstructorCall cc | cc .getConstructedType ( ) instanceof TypeRMIConnector |
185
183
n1 .asExpr ( ) = cc .getAnArgument ( ) and
186
184
n2 .asExpr ( ) = cc
0 commit comments