@@ -54,12 +54,15 @@ private class WeakSensitiveDataHashingSinks extends SinkModelCsv {
5454 // CryptoKit
5555 // (SHA-256, SHA-384 and SHA-512 are all variants of the SHA-2 algorithm)
5656 ";SHA256;true;hash(data:);;;Argument[0];weak-password-hash-input-SHA256" ,
57+ ";SHA256;true;hash(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA256" ,
5758 ";SHA256;true;update(data:);;;Argument[0];weak-password-hash-input-SHA256" ,
5859 ";SHA256;true;update(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA256" ,
5960 ";SHA384;true;hash(data:);;;Argument[0];weak-password-hash-input-SHA384" ,
61+ ";SHA384;true;hash(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA384" ,
6062 ";SHA384;true;update(data:);;;Argument[0];weak-password-hash-input-SHA384" ,
6163 ";SHA384;true;update(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA384" ,
6264 ";SHA512;true;hash(data:);;;Argument[0];weak-password-hash-input-SHA512" ,
65+ ";SHA512;true;hash(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA512" ,
6366 ";SHA512;true;update(data:);;;Argument[0];weak-password-hash-input-SHA512" ,
6467 ";SHA512;true;update(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA512" ,
6568 // CryptoSwift
@@ -111,6 +114,25 @@ private class DefaultWeakPasswordHashingSink extends WeakPasswordHashingSink {
111114 override string getAlgorithm ( ) { result = algorithm }
112115}
113116
117+ /**
118+ * A sink for weak password hashing through a call with a metatype qualifier.
119+ */
120+ private class WeakPasswordHashingMetatypeSink extends WeakPasswordHashingSink {
121+ string algorithm ;
122+
123+ WeakPasswordHashingMetatypeSink ( ) {
124+ exists ( CallExpr c |
125+ c .getAnArgument ( ) .getExpr ( ) = this .asExpr ( ) and
126+ algorithm = [ "SHA256" , "SHA384" , "SHA512" ] and
127+ c .getQualifier ( ) .getType ( ) .getFullName ( ) = algorithm + [ "" , ".Type" ] and
128+ c .getStaticTarget ( ) .getName ( ) =
129+ [ "hash(data:)" , "hash(bufferPointer:)" , "update(data:)" , "update(bufferPointer:)" ]
130+ )
131+ }
132+
133+ override string getAlgorithm ( ) { result = algorithm }
134+ }
135+
114136/**
115137 * A barrier for weak password hashing, when it occurs inside of
116138 * certain cryptographic algorithms as part of their design.
0 commit comments