@@ -10,9 +10,10 @@ import semmle.code.java.frameworks.ApacheLdap
1010/** A data flow sink for unvalidated user input that is used to construct LDAP queries. */
1111abstract class LdapInjectionSink extends DataFlow:: Node { }
1212
13- /** A class that identifies sanitizers that prevent LDAP injection attacks. */
13+ /** A sanitizer that prevents LDAP injection attacks. */
1414abstract class LdapInjectionSanitizer extends DataFlow:: Node { }
1515
16+ /** Holds if the JNDI method parameter at index is susceptible to a LDAP injection attack. */
1617private predicate jndiLdapInjectionSinkMethod ( Method m , int index ) {
1718 m .getDeclaringType ( ) .getAnAncestor ( ) instanceof TypeDirContext and
1819 m .hasName ( "search" ) and
@@ -33,6 +34,7 @@ private class JndiLdapInjectionSink extends LdapInjectionSink {
3334 }
3435}
3536
37+ /** Holds if the UnboundID method parameter at `index` is susceptible to a LDAP injection attack. */
3638private predicate unboundIdLdapInjectionSinkMethod ( Method m , int index ) {
3739 exists ( Parameter param | m .getParameter ( index ) = param and not param .isVarargs ( ) |
3840 m instanceof MethodUnboundIdLDAPConnectionSearch or
@@ -55,6 +57,7 @@ private class UnboundedIdLdapInjectionSink extends LdapInjectionSink {
5557 }
5658}
5759
60+ /** Holds if the Spring method parameter at `index` is susceptible to a LDAP injection attack. */
5861private predicate springLdapInjectionSinkMethod ( Method m , int index ) {
5962 // LdapTemplate.authenticate, LdapTemplate.find* or LdapTemplate.search* method
6063 (
@@ -91,6 +94,7 @@ private class SpringLdapInjectionSink extends LdapInjectionSink {
9194 }
9295}
9396
97+ /** Holds if the Apache LDAP API method parameter at `index` is susceptible to a LDAP injection attack. */
9498private predicate apacheLdapInjectionSinkMethod ( Method m , int index ) {
9599 exists ( Parameter param | m .getParameter ( index ) = param and not param .isVarargs ( ) |
96100 m .getDeclaringType ( ) .getAnAncestor ( ) instanceof TypeApacheLdapConnection and
@@ -405,6 +409,7 @@ private predicate apacheLdapDnGetStep(DataFlow::ExprNode n1, DataFlow::ExprNode
405409 )
406410}
407411
412+ /** A set of additional taint steps to consider when taint tracking LDAP related data flows. */
408413class LdapInjectionAdditionalTaintStep extends TaintTracking:: AdditionalTaintStep {
409414 override predicate step ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
410415 ldapNameStep ( node1 , node2 ) or
0 commit comments