@@ -50,13 +50,13 @@ class HashWithoutSaltConfiguration extends TaintTracking::Configuration {
5050
5151 override predicate isSink ( DataFlow:: Node sink ) {
5252 exists (
53- MethodAccess mda , MethodAccess mua // invoke `md.digest()` with only one call of `md.update(password)`, that is, without the call of `md.update(digest)`
53+ MethodAccess mua , MethodAccess mda // invoke `md.digest()` with only one call of `md.update(password)`, that is, without the call of `md.update(digest)`
5454 |
55- sink .asExpr ( ) = mda .getQualifier ( ) and
55+ sink .asExpr ( ) = mua .getArgument ( 0 ) and
56+ mua .getMethod ( ) instanceof MDUpdateMethod and // md.update(password)
5657 mda .getMethod ( ) instanceof MDDigestMethod and
5758 mda .getNumArgument ( ) = 0 and // md.digest()
58- mua .getMethod ( ) instanceof MDUpdateMethod and // md.update(password)
59- mua .getQualifier ( ) = mda .getQualifier ( ) .( VarAccess ) .getVariable ( ) .getAnAccess ( ) and
59+ mda .getQualifier ( ) = mua .getQualifier ( ) .( VarAccess ) .getVariable ( ) .getAnAccess ( ) and
6060 not exists ( MethodAccess mua2 |
6161 mua2 .getMethod ( ) instanceof MDUpdateMethod and // md.update(salt)
6262 mua2 .getQualifier ( ) = mua .getQualifier ( ) .( VarAccess ) .getVariable ( ) .getAnAccess ( ) and
@@ -66,7 +66,7 @@ class HashWithoutSaltConfiguration extends TaintTracking::Configuration {
6666 or
6767 // invoke `md.digest(password)` without another call of `md.update(salt)`
6868 exists ( MethodAccess mda |
69- sink .asExpr ( ) = mda and
69+ sink .asExpr ( ) = mda . getArgument ( 0 ) and
7070 mda .getMethod ( ) instanceof MDDigestMethod and // md.digest(password)
7171 mda .getNumArgument ( ) = 1 and
7272 not exists ( MethodAccess mua |
@@ -75,15 +75,6 @@ class HashWithoutSaltConfiguration extends TaintTracking::Configuration {
7575 )
7676 )
7777 }
78-
79- /** Holds for additional steps that flow to additional method calls of the type `java.security.MessageDigest`. */
80- override predicate isAdditionalTaintStep ( DataFlow:: Node pred , DataFlow:: Node succ ) {
81- exists ( MethodAccess ma |
82- ma .getMethod ( ) .getDeclaringType ( ) instanceof MessageDigest and
83- pred .asExpr ( ) = ma .getAnArgument ( ) and
84- ( succ .asExpr ( ) = ma or succ .asExpr ( ) = ma .getQualifier ( ) )
85- )
86- }
8778}
8879
8980from DataFlow:: PathNode source , DataFlow:: PathNode sink , HashWithoutSaltConfiguration c
0 commit comments