@@ -22,19 +22,17 @@ class HashAlgorithmProvider extends RefType {
22
22
}
23
23
}
24
24
25
- /** The method call `ComputeHash()` declared in `System.Security.Cryptography.SHA...`. */
26
- class ComputeHashMethodCall extends MethodCall {
27
- ComputeHashMethodCall ( ) {
28
- this .getQualifier ( ) .getType ( ) instanceof SHA and
29
- this .getTarget ( ) .hasName ( "ComputeHash" )
30
- }
31
- }
32
-
33
- /** The method call `ComputeHash()` declared in `System.Security.Cryptography.SHA...`. */
34
- class HashDataMethodCall extends MethodCall {
35
- HashDataMethodCall ( ) {
36
- this .getQualifier ( ) .getType ( ) instanceof HashAlgorithmProvider and
37
- this .getTarget ( ) .hasName ( "HashData" )
25
+ /**
26
+ * The method `ComputeHash()` declared in `System.Security.Cryptography.SHA...` and
27
+ * the method `HashData()` declared in `Windows.Security.Cryptography.Core.HashAlgorithmProvider`.
28
+ */
29
+ class HashMethod extends Method {
30
+ HashMethod ( ) {
31
+ this .getDeclaringType ( ) instanceof SHA and
32
+ this .hasName ( "ComputeHash" )
33
+ or
34
+ this .getDeclaringType ( ) instanceof HashAlgorithmProvider and
35
+ this .hasName ( "HashData" )
38
36
}
39
37
}
40
38
@@ -55,11 +53,9 @@ class HashWithoutSaltConfiguration extends TaintTracking::Configuration {
55
53
override predicate isSource ( DataFlow:: Node source ) { source .asExpr ( ) instanceof PasswordVarExpr }
56
54
57
55
override predicate isSink ( DataFlow:: Node sink ) {
58
- exists ( ComputeHashMethodCall mc |
59
- sink .asExpr ( ) = mc .getArgument ( 0 ) // sha256Hash.ComputeHash(rawDatabytes)
60
- ) or
61
- exists ( HashDataMethodCall mc |
62
- sink .asExpr ( ) = mc .getArgument ( 0 ) // algProv.HashData(rawDatabytes)
56
+ exists ( MethodCall mc |
57
+ sink .asExpr ( ) = mc .getArgument ( 0 ) and
58
+ mc .getTarget ( ) instanceof HashMethod
63
59
)
64
60
}
65
61
0 commit comments