@@ -50,13 +50,13 @@ class HashWithoutSaltConfiguration extends TaintTracking::Configuration {
50
50
51
51
override predicate isSink ( DataFlow:: Node sink ) {
52
52
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)`
54
54
|
55
- sink .asExpr ( ) = mda .getQualifier ( ) and
55
+ sink .asExpr ( ) = mua .getArgument ( 0 ) and
56
+ mua .getMethod ( ) instanceof MDUpdateMethod and // md.update(password)
56
57
mda .getMethod ( ) instanceof MDDigestMethod and
57
58
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
60
60
not exists ( MethodAccess mua2 |
61
61
mua2 .getMethod ( ) instanceof MDUpdateMethod and // md.update(salt)
62
62
mua2 .getQualifier ( ) = mua .getQualifier ( ) .( VarAccess ) .getVariable ( ) .getAnAccess ( ) and
@@ -66,7 +66,7 @@ class HashWithoutSaltConfiguration extends TaintTracking::Configuration {
66
66
or
67
67
// invoke `md.digest(password)` without another call of `md.update(salt)`
68
68
exists ( MethodAccess mda |
69
- sink .asExpr ( ) = mda and
69
+ sink .asExpr ( ) = mda . getArgument ( 0 ) and
70
70
mda .getMethod ( ) instanceof MDDigestMethod and // md.digest(password)
71
71
mda .getNumArgument ( ) = 1 and
72
72
not exists ( MethodAccess mua |
@@ -75,15 +75,6 @@ class HashWithoutSaltConfiguration extends TaintTracking::Configuration {
75
75
)
76
76
)
77
77
}
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
- }
87
78
}
88
79
89
80
from DataFlow:: PathNode source , DataFlow:: PathNode sink , HashWithoutSaltConfiguration c
0 commit comments