From 10eb9076ac6b421d23727a6a9eefcb2fbf4f4e4a Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Wed, 2 Dec 2026 19:00:50 +0000 Subject: [PATCH 01/14] unified: Copy Swift weak password hashing query and tests unchanged Copy the original Swift WeakPasswordHashing query, query help, examples, and query tests byte-for-byte into unified/ to establish an unchanged baseline for the unified Swift port. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../CWE-328/WeakPasswordHashing.qhelp | 95 +++++++ .../security/CWE-328/WeakPasswordHashing.ql | 26 ++ .../CWE-328/WeakPasswordHashingBad.swift | 8 + .../CWE-328/WeakPasswordHashingGood.swift | 11 + .../CWE-328/WeakPasswordHashing.expected | 104 +++++++ .../CWE-328/WeakPasswordHashing.qlref | 2 + .../security/CWE-328/testArgon2Swift.swift | 49 ++++ .../security/CWE-328/testCryptoKit.swift | 260 ++++++++++++++++++ .../security/CWE-328/testCryptoSwift.swift | 232 ++++++++++++++++ 9 files changed, 787 insertions(+) create mode 100644 unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.qhelp create mode 100644 unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql create mode 100644 unified/ql/src/queries/security/CWE-328/WeakPasswordHashingBad.swift create mode 100644 unified/ql/src/queries/security/CWE-328/WeakPasswordHashingGood.swift create mode 100644 unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.expected create mode 100644 unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.qlref create mode 100644 unified/ql/test/query-tests/security/CWE-328/testArgon2Swift.swift create mode 100644 unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift create mode 100644 unified/ql/test/query-tests/security/CWE-328/testCryptoSwift.swift diff --git a/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.qhelp b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.qhelp new file mode 100644 index 000000000000..0e26c11703b1 --- /dev/null +++ b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.qhelp @@ -0,0 +1,95 @@ + + + +

+ Hash functions that are not sufficiently computationally hard can leave data vulnerable. You should not use such functions for password hashing. +

+ +

+ A strong cryptographic hash function should be resistant to: +

+ + +

+ All of MD5, SHA-1, SHA-2 and SHA-3 are weak against offline brute forcing, since they are not sufficiently computationally hard. This includes SHA-224, SHA-256, SHA-384 and SHA-512, which are in the SHA-2 family. +

+ +

+ Password hashing algorithms should be slow and/or memory intensive to compute, to make brute force attacks more difficult. +

+ +
+ + +

+ For password storage, you should use a sufficiently computationally hard cryptographic hash function, such as one of the following: +

+ + + +
+ + +

+ The following examples show two versions of the same function. In both cases, a password is hashed using a cryptographic hashing algorithm. + + In the first case, the SHA-512 hashing algorithm is used. It is vulnerable to offline brute force attacks: +

+ +

+ + Here is the same function using Argon2, which is suitable for password hashing: +

+ + +
+ +
  • + OWASP: + Password Storage + Cheat Sheet + +
  • +
  • + GitHub: CryptoSwift README - Password-Based Key Derivation Function +
  • +
  • + libsodium: libsodium bindings for other languages +
  • +
  • + GitHub: Argon2Swift +
  • +
    + +
    diff --git a/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql new file mode 100644 index 000000000000..62a9cb652477 --- /dev/null +++ b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql @@ -0,0 +1,26 @@ +/** + * @name Use of an inappropriate cryptographic hashing algorithm on passwords + * @description Using inappropriate cryptographic hashing algorithms with passwords can compromise security. + * @kind path-problem + * @problem.severity warning + * @security-severity 7.5 + * @precision high + * @id swift/weak-password-hashing + * @tags security + * external/cwe/cwe-327 + * external/cwe/cwe-328 + * external/cwe/cwe-916 + */ + +import swift +import codeql.swift.security.WeakPasswordHashingQuery +import WeakPasswordHashingFlow::PathGraph + +from + WeakPasswordHashingFlow::PathNode source, WeakPasswordHashingFlow::PathNode sink, string algorithm +where + WeakPasswordHashingFlow::flowPath(source, sink) and + algorithm = sink.getNode().(WeakPasswordHashingSink).getAlgorithm() +select sink.getNode(), source, sink, + "Insecure hashing algorithm (" + algorithm + ") depends on $@.", source.getNode(), + "password (" + source.getNode().asExpr() + ")" diff --git a/unified/ql/src/queries/security/CWE-328/WeakPasswordHashingBad.swift b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashingBad.swift new file mode 100644 index 000000000000..572fe9fa3605 --- /dev/null +++ b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashingBad.swift @@ -0,0 +1,8 @@ +let passwordData = Data(passwordString.utf8) +let passwordHash = Crypto.SHA512.hash(data: passwordData) // BAD: SHA-512 is not suitable for password hashing. + +// ... + +if Crypto.SHA512.hash(data: Data(passwordString.utf8)) == passwordHash { + // ... +} diff --git a/unified/ql/src/queries/security/CWE-328/WeakPasswordHashingGood.swift b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashingGood.swift new file mode 100644 index 000000000000..ed2c8758674c --- /dev/null +++ b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashingGood.swift @@ -0,0 +1,11 @@ +import Argon2Swift + +let salt = Salt.newSalt() +let result = try! Argon2Swift.hashPasswordString(password: passwordString, salt: salt) // GOOD: Argon2 is suitable for password hashing. +let passwordHash = result.encodedString() + +// ... + +if try! Argon2Swift.verifyHashString(password: passwordString, hash: passwordHash) { + // ... +} diff --git a/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.expected b/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.expected new file mode 100644 index 000000000000..2b0eed8d0c2b --- /dev/null +++ b/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.expected @@ -0,0 +1,104 @@ +#select +| testCryptoKit.swift:84:47:84:47 | passwd | testCryptoKit.swift:84:47:84:47 | passwd | testCryptoKit.swift:84:47:84:47 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:84:47:84:47 | passwd | password (passwd) | +| testCryptoKit.swift:85:52:85:52 | passwd | testCryptoKit.swift:85:52:85:52 | passwd | testCryptoKit.swift:85:52:85:52 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:85:52:85:52 | passwd | password (passwd) | +| testCryptoKit.swift:91:36:91:36 | passwd | testCryptoKit.swift:91:36:91:36 | passwd | testCryptoKit.swift:91:36:91:36 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:91:36:91:36 | passwd | password (passwd) | +| testCryptoKit.swift:92:45:92:45 | passwd | testCryptoKit.swift:92:45:92:45 | passwd | testCryptoKit.swift:92:45:92:45 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:92:45:92:45 | passwd | password (passwd) | +| testCryptoKit.swift:98:44:98:44 | passwd | testCryptoKit.swift:98:44:98:44 | passwd | testCryptoKit.swift:98:44:98:44 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:98:44:98:44 | passwd | password (passwd) | +| testCryptoKit.swift:99:53:99:53 | passwd | testCryptoKit.swift:99:53:99:53 | passwd | testCryptoKit.swift:99:53:99:53 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:99:53:99:53 | passwd | password (passwd) | +| testCryptoKit.swift:105:37:105:37 | passwd | testCryptoKit.swift:105:37:105:37 | passwd | testCryptoKit.swift:105:37:105:37 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:105:37:105:37 | passwd | password (passwd) | +| testCryptoKit.swift:106:46:106:46 | passwd | testCryptoKit.swift:106:46:106:46 | passwd | testCryptoKit.swift:106:46:106:46 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:106:46:106:46 | passwd | password (passwd) | +| testCryptoKit.swift:112:37:112:37 | passwd | testCryptoKit.swift:112:37:112:37 | passwd | testCryptoKit.swift:112:37:112:37 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:112:37:112:37 | passwd | password (passwd) | +| testCryptoKit.swift:113:46:113:46 | passwd | testCryptoKit.swift:113:46:113:46 | passwd | testCryptoKit.swift:113:46:113:46 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:113:46:113:46 | passwd | password (passwd) | +| testCryptoKit.swift:119:37:119:37 | passwd | testCryptoKit.swift:119:37:119:37 | passwd | testCryptoKit.swift:119:37:119:37 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:119:37:119:37 | passwd | password (passwd) | +| testCryptoKit.swift:120:46:120:46 | passwd | testCryptoKit.swift:120:46:120:46 | passwd | testCryptoKit.swift:120:46:120:46 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:120:46:120:46 | passwd | password (passwd) | +| testCryptoKit.swift:129:23:129:23 | passwd | testCryptoKit.swift:129:23:129:23 | passwd | testCryptoKit.swift:129:23:129:23 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:129:23:129:23 | passwd | password (passwd) | +| testCryptoKit.swift:138:23:138:23 | passwd | testCryptoKit.swift:138:23:138:23 | passwd | testCryptoKit.swift:138:23:138:23 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:138:23:138:23 | passwd | password (passwd) | +| testCryptoKit.swift:147:23:147:23 | passwd | testCryptoKit.swift:147:23:147:23 | passwd | testCryptoKit.swift:147:23:147:23 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:147:23:147:23 | passwd | password (passwd) | +| testCryptoKit.swift:156:23:156:23 | passwd | testCryptoKit.swift:156:23:156:23 | passwd | testCryptoKit.swift:156:23:156:23 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:156:23:156:23 | passwd | password (passwd) | +| testCryptoKit.swift:165:23:165:23 | passwd | testCryptoKit.swift:165:23:165:23 | passwd | testCryptoKit.swift:165:23:165:23 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:165:23:165:23 | passwd | password (passwd) | +| testCryptoKit.swift:174:32:174:32 | passwd | testCryptoKit.swift:174:32:174:32 | passwd | testCryptoKit.swift:174:32:174:32 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:174:32:174:32 | passwd | password (passwd) | +| testCryptoKit.swift:183:32:183:32 | passwd | testCryptoKit.swift:183:32:183:32 | passwd | testCryptoKit.swift:183:32:183:32 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:183:32:183:32 | passwd | password (passwd) | +| testCryptoKit.swift:192:32:192:32 | passwd | testCryptoKit.swift:192:32:192:32 | passwd | testCryptoKit.swift:192:32:192:32 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:192:32:192:32 | passwd | password (passwd) | +| testCryptoKit.swift:201:32:201:32 | passwd | testCryptoKit.swift:201:32:201:32 | passwd | testCryptoKit.swift:201:32:201:32 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:201:32:201:32 | passwd | password (passwd) | +| testCryptoKit.swift:210:32:210:32 | passwd | testCryptoKit.swift:210:32:210:32 | passwd | testCryptoKit.swift:210:32:210:32 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:210:32:210:32 | passwd | password (passwd) | +| testCryptoKit.swift:220:49:220:49 | passwordData | testCryptoKit.swift:220:49:220:49 | passwordData | testCryptoKit.swift:220:49:220:49 | passwordData | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:220:49:220:49 | passwordData | password (passwordData) | +| testCryptoKit.swift:224:33:224:57 | call to Data.init(_:) | testCryptoKit.swift:224:38:224:38 | passwordString | testCryptoKit.swift:224:33:224:57 | call to Data.init(_:) | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:224:38:224:38 | passwordString | password (passwordString) | +| testCryptoSwift.swift:154:30:154:30 | passwdArray | testCryptoSwift.swift:154:30:154:30 | passwdArray | testCryptoSwift.swift:154:30:154:30 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:154:30:154:30 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:157:31:157:31 | passwdArray | testCryptoSwift.swift:157:31:157:31 | passwdArray | testCryptoSwift.swift:157:31:157:31 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:157:31:157:31 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:160:47:160:47 | passwdArray | testCryptoSwift.swift:160:47:160:47 | passwdArray | testCryptoSwift.swift:160:47:160:47 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:160:47:160:47 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:163:47:163:47 | passwdArray | testCryptoSwift.swift:163:47:163:47 | passwdArray | testCryptoSwift.swift:163:47:163:47 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:163:47:163:47 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:167:20:167:20 | passwdArray | testCryptoSwift.swift:167:20:167:20 | passwdArray | testCryptoSwift.swift:167:20:167:20 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:167:20:167:20 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:170:21:170:21 | passwdArray | testCryptoSwift.swift:170:21:170:21 | passwdArray | testCryptoSwift.swift:170:21:170:21 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:170:21:170:21 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:173:23:173:23 | passwdArray | testCryptoSwift.swift:173:23:173:23 | passwdArray | testCryptoSwift.swift:173:23:173:23 | passwdArray | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoSwift.swift:173:23:173:23 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:176:21:176:21 | passwdArray | testCryptoSwift.swift:176:21:176:21 | passwdArray | testCryptoSwift.swift:176:21:176:21 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:176:21:176:21 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:179:21:179:21 | passwdArray | testCryptoSwift.swift:179:21:179:21 | passwdArray | testCryptoSwift.swift:179:21:179:21 | passwdArray | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:179:21:179:21 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:183:9:183:9 | passwdArray | testCryptoSwift.swift:183:9:183:9 | passwdArray | testCryptoSwift.swift:183:9:183:9 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:183:9:183:9 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:186:9:186:9 | passwdArray | testCryptoSwift.swift:186:9:186:9 | passwdArray | testCryptoSwift.swift:186:9:186:9 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:186:9:186:9 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:189:9:189:9 | passwdArray | testCryptoSwift.swift:189:9:189:9 | passwdArray | testCryptoSwift.swift:189:9:189:9 | passwdArray | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoSwift.swift:189:9:189:9 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:192:9:192:9 | passwdArray | testCryptoSwift.swift:192:9:192:9 | passwdArray | testCryptoSwift.swift:192:9:192:9 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:192:9:192:9 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:195:9:195:9 | passwdArray | testCryptoSwift.swift:195:9:195:9 | passwdArray | testCryptoSwift.swift:195:9:195:9 | passwdArray | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:195:9:195:9 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:201:9:201:9 | passwdData | testCryptoSwift.swift:201:9:201:9 | passwdData | testCryptoSwift.swift:201:9:201:9 | passwdData | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:201:9:201:9 | passwdData | password (passwdData) | +| testCryptoSwift.swift:204:9:204:9 | passwdData | testCryptoSwift.swift:204:9:204:9 | passwdData | testCryptoSwift.swift:204:9:204:9 | passwdData | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:204:9:204:9 | passwdData | password (passwdData) | +| testCryptoSwift.swift:207:9:207:9 | passwdData | testCryptoSwift.swift:207:9:207:9 | passwdData | testCryptoSwift.swift:207:9:207:9 | passwdData | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoSwift.swift:207:9:207:9 | passwdData | password (passwdData) | +| testCryptoSwift.swift:210:9:210:9 | passwdData | testCryptoSwift.swift:210:9:210:9 | passwdData | testCryptoSwift.swift:210:9:210:9 | passwdData | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:210:9:210:9 | passwdData | password (passwdData) | +| testCryptoSwift.swift:213:9:213:9 | passwdData | testCryptoSwift.swift:213:9:213:9 | passwdData | testCryptoSwift.swift:213:9:213:9 | passwdData | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:213:9:213:9 | passwdData | password (passwdData) | +| testCryptoSwift.swift:219:9:219:9 | passwd | testCryptoSwift.swift:219:9:219:9 | passwd | testCryptoSwift.swift:219:9:219:9 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:219:9:219:9 | passwd | password (passwd) | +| testCryptoSwift.swift:222:9:222:9 | passwd | testCryptoSwift.swift:222:9:222:9 | passwd | testCryptoSwift.swift:222:9:222:9 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:222:9:222:9 | passwd | password (passwd) | +| testCryptoSwift.swift:225:9:225:9 | passwd | testCryptoSwift.swift:225:9:225:9 | passwd | testCryptoSwift.swift:225:9:225:9 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoSwift.swift:225:9:225:9 | passwd | password (passwd) | +| testCryptoSwift.swift:228:9:228:9 | passwd | testCryptoSwift.swift:228:9:228:9 | passwd | testCryptoSwift.swift:228:9:228:9 | passwd | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:228:9:228:9 | passwd | password (passwd) | +| testCryptoSwift.swift:231:9:231:9 | passwd | testCryptoSwift.swift:231:9:231:9 | passwd | testCryptoSwift.swift:231:9:231:9 | passwd | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:231:9:231:9 | passwd | password (passwd) | +edges +| testCryptoKit.swift:224:38:224:38 | passwordString | testCryptoKit.swift:224:38:224:53 | .utf8 | provenance | | +| testCryptoKit.swift:224:38:224:53 | .utf8 | testCryptoKit.swift:224:33:224:57 | call to Data.init(_:) | provenance | | +nodes +| testCryptoKit.swift:84:47:84:47 | passwd | semmle.label | passwd | +| testCryptoKit.swift:85:52:85:52 | passwd | semmle.label | passwd | +| testCryptoKit.swift:91:36:91:36 | passwd | semmle.label | passwd | +| testCryptoKit.swift:92:45:92:45 | passwd | semmle.label | passwd | +| testCryptoKit.swift:98:44:98:44 | passwd | semmle.label | passwd | +| testCryptoKit.swift:99:53:99:53 | passwd | semmle.label | passwd | +| testCryptoKit.swift:105:37:105:37 | passwd | semmle.label | passwd | +| testCryptoKit.swift:106:46:106:46 | passwd | semmle.label | passwd | +| testCryptoKit.swift:112:37:112:37 | passwd | semmle.label | passwd | +| testCryptoKit.swift:113:46:113:46 | passwd | semmle.label | passwd | +| testCryptoKit.swift:119:37:119:37 | passwd | semmle.label | passwd | +| testCryptoKit.swift:120:46:120:46 | passwd | semmle.label | passwd | +| testCryptoKit.swift:129:23:129:23 | passwd | semmle.label | passwd | +| testCryptoKit.swift:138:23:138:23 | passwd | semmle.label | passwd | +| testCryptoKit.swift:147:23:147:23 | passwd | semmle.label | passwd | +| testCryptoKit.swift:156:23:156:23 | passwd | semmle.label | passwd | +| testCryptoKit.swift:165:23:165:23 | passwd | semmle.label | passwd | +| testCryptoKit.swift:174:32:174:32 | passwd | semmle.label | passwd | +| testCryptoKit.swift:183:32:183:32 | passwd | semmle.label | passwd | +| testCryptoKit.swift:192:32:192:32 | passwd | semmle.label | passwd | +| testCryptoKit.swift:201:32:201:32 | passwd | semmle.label | passwd | +| testCryptoKit.swift:210:32:210:32 | passwd | semmle.label | passwd | +| testCryptoKit.swift:220:49:220:49 | passwordData | semmle.label | passwordData | +| testCryptoKit.swift:224:33:224:57 | call to Data.init(_:) | semmle.label | call to Data.init(_:) | +| testCryptoKit.swift:224:38:224:38 | passwordString | semmle.label | passwordString | +| testCryptoKit.swift:224:38:224:53 | .utf8 | semmle.label | .utf8 | +| testCryptoSwift.swift:154:30:154:30 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:157:31:157:31 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:160:47:160:47 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:163:47:163:47 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:167:20:167:20 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:170:21:170:21 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:173:23:173:23 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:176:21:176:21 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:179:21:179:21 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:183:9:183:9 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:186:9:186:9 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:189:9:189:9 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:192:9:192:9 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:195:9:195:9 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:201:9:201:9 | passwdData | semmle.label | passwdData | +| testCryptoSwift.swift:204:9:204:9 | passwdData | semmle.label | passwdData | +| testCryptoSwift.swift:207:9:207:9 | passwdData | semmle.label | passwdData | +| testCryptoSwift.swift:210:9:210:9 | passwdData | semmle.label | passwdData | +| testCryptoSwift.swift:213:9:213:9 | passwdData | semmle.label | passwdData | +| testCryptoSwift.swift:219:9:219:9 | passwd | semmle.label | passwd | +| testCryptoSwift.swift:222:9:222:9 | passwd | semmle.label | passwd | +| testCryptoSwift.swift:225:9:225:9 | passwd | semmle.label | passwd | +| testCryptoSwift.swift:228:9:228:9 | passwd | semmle.label | passwd | +| testCryptoSwift.swift:231:9:231:9 | passwd | semmle.label | passwd | +subpaths diff --git a/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.qlref b/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.qlref new file mode 100644 index 000000000000..24744b4a4250 --- /dev/null +++ b/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.qlref @@ -0,0 +1,2 @@ +query: queries/Security/CWE-328/WeakPasswordHashing.ql +postprocess: utils/test/InlineExpectationsTestQuery.ql diff --git a/unified/ql/test/query-tests/security/CWE-328/testArgon2Swift.swift b/unified/ql/test/query-tests/security/CWE-328/testArgon2Swift.swift new file mode 100644 index 000000000000..e88fb5eb2c73 --- /dev/null +++ b/unified/ql/test/query-tests/security/CWE-328/testArgon2Swift.swift @@ -0,0 +1,49 @@ + +// --- stubs --- + +class Data +{ + init(_ elements: S) {} +} + +class Salt { + init(bytes: Data) { } + + static func newSalt(length: Int = 16) -> Salt { + return Salt(bytes: Data(0)) + } +} + +class Argon2SwiftResult { + init(hashBytes: [Int8], encodedBytes: [Int8]) { } + + func encodedString() -> String { + return "" + } +} + +class Argon2Swift { + // slightly simplified (type and version changed to Int) + static func hashPasswordString(password: String, salt: Salt, iterations: Int = 32, memory: Int = 256, parallelism: Int = 2, length: Int = 32, type: Int = 1, version: Int = 13) throws -> Argon2SwiftResult { + return Argon2SwiftResult(hashBytes: [], encodedBytes: []) + } + + static func verifyHashString(password: String, hash: String, type: Int = 1) throws -> Bool { + return false + } +} + +// --- tests --- + +func testGoodExample(passwordString: String) { + // this is the "good" example from the .qhelp + let salt = Salt.newSalt() + let result = try! Argon2Swift.hashPasswordString(password: passwordString, salt: salt) // GOOD (suitable password hash) + let passwordHash = result.encodedString() + + // ... + + if try! Argon2Swift.verifyHashString(password: passwordString, hash: passwordHash) { + // ... + } +} diff --git a/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift b/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift new file mode 100644 index 000000000000..d2faf8812248 --- /dev/null +++ b/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift @@ -0,0 +1,260 @@ +//codeql-extractor-options: -module-name Crypto + +// --- stubs --- + +class Data +{ + init(_ elements: S) {} +} + +public protocol HashFunction { + associatedtype Digest + + init() + mutating func update(bufferPointer: UnsafeRawBufferPointer) + func finalize() -> Digest +} + +extension HashFunction { + @inlinable + public static func hash(bufferPointer: UnsafeRawBufferPointer) -> Digest { + var hasher = Self() + hasher.update(bufferPointer: bufferPointer) + return hasher.finalize() + } + + @inlinable + public static func hash(data: D) -> Self.Digest { + var hasher = Self() + hasher.update(data: data) + return hasher.finalize() + } + + @inlinable + public mutating func update(data: D) { + // ... + } +} + +public struct SHA256: HashFunction { + public typealias Digest = [UInt8] + + public init() {} + public mutating func update(bufferPointer: UnsafeRawBufferPointer) {} + public func finalize() -> Digest { return [] } +} + +public struct SHA384: HashFunction { + public typealias Digest = [UInt8] + + public init() {} + public mutating func update(bufferPointer: UnsafeRawBufferPointer) {} + public func finalize() -> Digest { return [] } +} + +public struct SHA512: HashFunction { + public typealias Digest = [UInt8] + + public init() {} + public mutating func update(bufferPointer: UnsafeRawBufferPointer) {} + public func finalize() -> Digest { return [] } +} + +enum Insecure { + public struct MD5: HashFunction { + public typealias Digest = [UInt8] + + public init() {} + public mutating func update(bufferPointer: UnsafeRawBufferPointer) {} + public func finalize() -> Digest { return [] } + } + + public struct SHA1: HashFunction { + public typealias Digest = [UInt8] + + public init() {} + public mutating func update(bufferPointer: UnsafeRawBufferPointer) {} + public func finalize() -> Digest { return [] } + } +} + +// --- tests --- + +func testHashMethods(passwd : UnsafeRawBufferPointer, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { + var hash = Crypto.Insecure.MD5.hash(data: passwd) // $ Alert[swift/weak-password-hashing] + hash = Crypto.Insecure.MD5.hash(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] + hash = Crypto.Insecure.MD5.hash(data: cert) // $ Alert[swift/weak-sensitive-data-hashing] + hash = Crypto.Insecure.MD5.hash(data: encrypted_passwd) // GOOD (not sensitive) + hash = Crypto.Insecure.MD5.hash(data: account_no) // $ Alert[swift/weak-sensitive-data-hashing] + hash = Crypto.Insecure.MD5.hash(data: credit_card_no) // $ Alert[swift/weak-sensitive-data-hashing] + + hash = Insecure.MD5.hash(data: passwd) // $ Alert[swift/weak-password-hashing] + hash = Insecure.MD5.hash(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] + hash = Insecure.MD5.hash(data: cert) // $ Alert[swift/weak-sensitive-data-hashing] + hash = Insecure.MD5.hash(data: encrypted_passwd) // GOOD (not sensitive) + hash = Insecure.MD5.hash(data: account_no) // $ Alert[swift/weak-sensitive-data-hashing] + hash = Insecure.MD5.hash(data: credit_card_no) // $ Alert[swift/weak-sensitive-data-hashing] + + hash = Crypto.Insecure.SHA1.hash(data: passwd) // $ Alert[swift/weak-password-hashing] + hash = Crypto.Insecure.SHA1.hash(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] + hash = Crypto.Insecure.SHA1.hash(data: cert) // $ Alert[swift/weak-sensitive-data-hashing] + hash = Crypto.Insecure.SHA1.hash(data: encrypted_passwd) // GOOD (not sensitive) + hash = Crypto.Insecure.SHA1.hash(data: account_no) // $ Alert[swift/weak-sensitive-data-hashing] + hash = Crypto.Insecure.SHA1.hash(data: credit_card_no) // $ Alert[swift/weak-sensitive-data-hashing] + + hash = Crypto.SHA256.hash(data: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash + hash = Crypto.SHA256.hash(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash + hash = Crypto.SHA256.hash(data: cert) // GOOD, computationally expensive hash not required + hash = Crypto.SHA256.hash(data: encrypted_passwd) // GOOD, not sensitive + hash = Crypto.SHA256.hash(data: account_no) // GOOD, computationally expensive hash not required + hash = Crypto.SHA256.hash(data: credit_card_no) // GOOD, computationally expensive hash not required + + hash = Crypto.SHA384.hash(data: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash + hash = Crypto.SHA384.hash(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash + hash = Crypto.SHA384.hash(data: cert) // GOOD, computationally expensive hash not required + hash = Crypto.SHA384.hash(data: encrypted_passwd) // GOOD, not sensitive + hash = Crypto.SHA384.hash(data: account_no) // GOOD, computationally expensive hash not required + hash = Crypto.SHA384.hash(data: credit_card_no) // GOOD, computationally expensive hash not required + + hash = Crypto.SHA512.hash(data: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash + hash = Crypto.SHA512.hash(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash + hash = Crypto.SHA512.hash(data: cert) // GOOD, computationally expensive hash not required + hash = Crypto.SHA512.hash(data: encrypted_passwd) // GOOD, not sensitive + hash = Crypto.SHA512.hash(data: account_no) // GOOD, computationally expensive hash not required + hash = Crypto.SHA512.hash(data: credit_card_no) // GOOD, computationally expensive hash not required +} + +func testMD5UpdateWithData(passwd : String, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { + var hash = Crypto.Insecure.MD5() + hash.update(data: passwd) // $ Alert[swift/weak-password-hashing] + hash.update(data: cert) // $ Alert[swift/weak-sensitive-data-hashing] + hash.update(data: encrypted_passwd) // GOOD (not sensitive) + hash.update(data: account_no) // $ Alert[swift/weak-sensitive-data-hashing] + hash.update(data: credit_card_no) // $ Alert[swift/weak-sensitive-data-hashing] +} + +func testSHA1UpdateWithData(passwd : String, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { + var hash = Crypto.Insecure.SHA1() + hash.update(data: passwd) // $ Alert[swift/weak-password-hashing] + hash.update(data: cert) // $ Alert[swift/weak-sensitive-data-hashing] + hash.update(data: encrypted_passwd) // GOOD (not sensitive) + hash.update(data: account_no) // $ Alert[swift/weak-sensitive-data-hashing] + hash.update(data: credit_card_no) // $ Alert[swift/weak-sensitive-data-hashing] +} + +func testSHA256UpdateWithData(passwd : String, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { + var hash = Crypto.SHA256() + hash.update(data: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash + hash.update(data: cert) // GOOD + hash.update(data: encrypted_passwd) // GOOD (not sensitive) + hash.update(data: account_no) // GOOD + hash.update(data: credit_card_no) // GOOD +} + +func testSHA384UpdateWithData(passwd : String, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { + var hash = Crypto.SHA384() + hash.update(data: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash + hash.update(data: cert) // GOOD + hash.update(data: encrypted_passwd) // GOOD (not sensitive) + hash.update(data: account_no) // GOOD + hash.update(data: credit_card_no) // GOOD +} + +func testSHA512UpdateWithData(passwd : String, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { + var hash = Crypto.SHA512() + hash.update(data: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash + hash.update(data: cert) // GOOD + hash.update(data: encrypted_passwd) // GOOD (not sensitive) + hash.update(data: account_no) // GOOD + hash.update(data: credit_card_no) // GOOD +} + +func testMD5UpdateWithUnsafeRawBufferPointer(passwd : UnsafeRawBufferPointer, cert: UnsafeRawBufferPointer, encrypted_passwd : UnsafeRawBufferPointer, account_no : UnsafeRawBufferPointer, credit_card_no : UnsafeRawBufferPointer) { + var hash = Crypto.Insecure.MD5() + hash.update(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] + hash.update(bufferPointer: cert) // $ Alert[swift/weak-sensitive-data-hashing] + hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) + hash.update(bufferPointer: account_no) // $ Alert[swift/weak-sensitive-data-hashing] + hash.update(bufferPointer: credit_card_no) // $ Alert[swift/weak-sensitive-data-hashing] +} + +func testSHA1UpdateWithUnsafeRawBufferPointer(passwd : UnsafeRawBufferPointer, cert: UnsafeRawBufferPointer, encrypted_passwd : UnsafeRawBufferPointer, account_no : UnsafeRawBufferPointer, credit_card_no : UnsafeRawBufferPointer) { + var hash = Crypto.Insecure.SHA1() + hash.update(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] + hash.update(bufferPointer: cert) // $ Alert[swift/weak-sensitive-data-hashing] + hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) + hash.update(bufferPointer: account_no) // $ Alert[swift/weak-sensitive-data-hashing] + hash.update(bufferPointer: credit_card_no) // $ Alert[swift/weak-sensitive-data-hashing] +} + +func testSHA256UpdateWithUnsafeRawBufferPointer(passwd : UnsafeRawBufferPointer, cert: UnsafeRawBufferPointer, encrypted_passwd : UnsafeRawBufferPointer, account_no : UnsafeRawBufferPointer, credit_card_no : UnsafeRawBufferPointer) { + var hash = Crypto.SHA256() + hash.update(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash + hash.update(bufferPointer: cert) // GOOD + hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) + hash.update(bufferPointer: account_no) // GOOD + hash.update(bufferPointer: credit_card_no) // GOOD +} + +func testSHA384UpdateWithUnsafeRawBufferPointer(passwd : UnsafeRawBufferPointer, cert: UnsafeRawBufferPointer, encrypted_passwd : UnsafeRawBufferPointer, account_no : UnsafeRawBufferPointer, credit_card_no : UnsafeRawBufferPointer) { + var hash = Crypto.SHA384() + hash.update(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash + hash.update(bufferPointer: cert) // GOOD + hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) + hash.update(bufferPointer: account_no) // GOOD + hash.update(bufferPointer: credit_card_no) // GOOD +} + +func testSHA512UpdateWithUnsafeRawBufferPointer(passwd : UnsafeRawBufferPointer, cert: UnsafeRawBufferPointer, encrypted_passwd : UnsafeRawBufferPointer, account_no : UnsafeRawBufferPointer, credit_card_no : UnsafeRawBufferPointer) { + var hash = Crypto.SHA512() + hash.update(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash + hash.update(bufferPointer: cert) // GOOD + hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) + hash.update(bufferPointer: account_no) // GOOD + hash.update(bufferPointer: credit_card_no) // GOOD +} + +func testBadExample(passwordString: String) { + // this is the "bad" example from the .qhelp + let passwordData = Data(passwordString.utf8) + let passwordHash = Crypto.SHA512.hash(data: passwordData) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash + + // ... + + if Crypto.SHA512.hash(data: Data(passwordString.utf8)) == passwordHash { // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash + // ... + } +} + +func testWithFlowAndMetatypes(cardNumber: String) { + let value1 = Data(cardNumber.utf8); // $ Source[swift/weak-sensitive-data-hashing] + let _digest1 = Insecure.MD5.hash(data: value1); // $ Alert[swift/weak-sensitive-data-hashing] + + let value2 = Data(cardNumber.utf8); // $ Source[swift/weak-sensitive-data-hashing] + let hasher2 = Insecure.MD5.self; // metatype + let _digest2 = hasher2.hash(data: value2); // $ Alert[swift/weak-sensitive-data-hashing] + + let value3 = Data(cardNumber.utf8); // $ Source[swift/weak-sensitive-data-hashing] + let _digest3 = (Insecure.MD5.self).hash(data: value3); // $ Alert[swift/weak-sensitive-data-hashing] + + let value4 = Data(cardNumber.utf8); // $ Source[swift/weak-sensitive-data-hashing] + testReceiver1(value: value4); + + let value5 = Data(cardNumber.utf8); // $ Source[swift/weak-sensitive-data-hashing] + testReceiver2(hasher: Insecure.MD5.self, value: value5); + + let value6 = Data(cardNumber.utf8); + testReceiver3(hasher: Insecure.MD5.self, value: value6); +} + +func testReceiver1(value: Data) { + let _digest = Insecure.MD5.hash(data: value); // $ Alert[swift/weak-sensitive-data-hashing] +} + +func testReceiver2(hasher: Insecure.MD5.Type, value: Data) { + let _digest = hasher.hash(data: value); // $ Alert[swift/weak-sensitive-data-hashing] +} + +func testReceiver3(hasher: H.Type, value: Data) { + let _digest = hasher.hash(data: value); // $ MISSING: Alert[swift/weak-sensitive-data-hashing] // BAD [NOT DETECTED] +} diff --git a/unified/ql/test/query-tests/security/CWE-328/testCryptoSwift.swift b/unified/ql/test/query-tests/security/CWE-328/testCryptoSwift.swift new file mode 100644 index 000000000000..a6f4584230e7 --- /dev/null +++ b/unified/ql/test/query-tests/security/CWE-328/testCryptoSwift.swift @@ -0,0 +1,232 @@ + +// --- stubs --- + +class Data +{ + init(_ elements: S) {} +} + +protocol DigestType { + func calculate(for bytes: Array) -> Array +} + +class MD5 : DigestType { + public func calculate(for bytes: Array) -> Array { + return Array() + } +} + +class SHA1 : DigestType { + public func calculate(for bytes: Array) -> Array { + return Array() + } +} + +class SHA2 : DigestType { + public enum Variant { + case sha512 + } + + public init(variant: SHA2.Variant) {} + + public func calculate(for bytes: Array) -> Array { + return Array() + } +} + +class SHA3 : DigestType { + public enum Variant { + case sha512 + } + + public init(variant: SHA3.Variant) {} + + public func calculate(for bytes: Array) -> Array { + return Array() + } +} + +struct Digest { + static func md5(_ bytes: Array) -> Array { + return MD5().calculate(for: bytes) + } + + static func sha1(_ bytes: Array) -> Array { + return SHA1().calculate(for: bytes) + } + + static func sha512(_ bytes: Array) -> Array { + return self.sha2(bytes, variant: .sha512) + } + + static func sha2(_ bytes: Array, variant: SHA2.Variant) -> Array { + return SHA2(variant: variant).calculate(for: bytes) + } + + static func sha3(_ bytes: Array, variant: SHA3.Variant) -> Array { + return SHA3(variant: variant).calculate(for: bytes) + } +} + +extension Array where Element == UInt8 { + func toHexString() -> String { + return "" + } + + func md5() -> [Element] { + return Digest.md5(self) + } + + func sha1() -> [Element] { + return Digest.sha1(self) + } + + func sha512() -> [Element] { + return Digest.sha512(self) + } + + func sha2(_ variant: SHA2.Variant) -> [Element] { + return Digest.sha2(self, variant: variant) + } + + func sha3(_ variant: SHA3.Variant) -> [Element] { + return Digest.sha3(self, variant: variant) + } +} + +extension Data { + var bytes: Array { + return Array() + } + + func md5() -> Data { + return Data(Digest.md5(bytes)) + } + + func sha1() -> Data { + return Data(Digest.sha1(bytes)) + } + + func sha512() -> Data { + return Data(Digest.sha512(bytes)) + } + + func sha2(_ variant: SHA2.Variant) -> Data { + return Data(Digest.sha2(bytes, variant: variant)) + } + + func sha3(_ variant: SHA3.Variant) -> Data { + return Data(Digest.sha3(bytes, variant: variant)) + } +} + +extension String { + var bytes: Array { + return Array() + } + + func md5() -> String { + return self.bytes.md5().toHexString() + } + + func sha1() -> String { + return self.bytes.sha1().toHexString() + } + + func sha512() -> String { + return self.bytes.sha512().toHexString() + } + + func sha2(_ variant: SHA2.Variant) -> String { + return self.bytes.sha2(variant).toHexString() + } + + func sha3(_ variant: SHA3.Variant) -> String { + return self.bytes.sha3(variant).toHexString() + } +} + +// --- tests --- + +func testArrays(harmlessArray: Array, phoneNumberArray: Array, passwdArray: Array) { + _ = MD5().calculate(for: harmlessArray) // GOOD (not sensitive) + _ = MD5().calculate(for: phoneNumberArray) // $ Alert[swift/weak-sensitive-data-hashing] + _ = MD5().calculate(for: passwdArray) // $ Alert[swift/weak-password-hashing] + _ = SHA1().calculate(for: harmlessArray) // GOOD (not sensitive) + _ = SHA1().calculate(for: phoneNumberArray) // $ Alert[swift/weak-sensitive-data-hashing] + _ = SHA1().calculate(for: passwdArray) // $ Alert[swift/weak-password-hashing] + _ = SHA2(variant: .sha512).calculate(for: harmlessArray) // GOOD + _ = SHA2(variant: .sha512).calculate(for: phoneNumberArray) // GOOD + _ = SHA2(variant: .sha512).calculate(for: passwdArray) // $ Alert[swift/weak-password-hashing] + _ = SHA3(variant: .sha512).calculate(for: harmlessArray) // GOOD + _ = SHA3(variant: .sha512).calculate(for: phoneNumberArray) // GOOD + _ = SHA3(variant: .sha512).calculate(for: passwdArray) // $ Alert[swift/weak-password-hashing] + + _ = Digest.md5(harmlessArray) // GOOD (not sensitive) + _ = Digest.md5(phoneNumberArray) // $ Alert[swift/weak-sensitive-data-hashing] + _ = Digest.md5(passwdArray) // $ Alert[swift/weak-password-hashing] + _ = Digest.sha1(harmlessArray) // GOOD (not sensitive) + _ = Digest.sha1(phoneNumberArray) // $ Alert[swift/weak-sensitive-data-hashing] + _ = Digest.sha1(passwdArray) // $ Alert[swift/weak-password-hashing] + _ = Digest.sha512(harmlessArray) // GOOD (not sensitive) + _ = Digest.sha512(phoneNumberArray) // GOOD + _ = Digest.sha512(passwdArray) // $ Alert[swift/weak-password-hashing] + _ = Digest.sha2(harmlessArray, variant: .sha512) // GOOD (not sensitive) + _ = Digest.sha2(phoneNumberArray, variant: .sha512) // GOOD + _ = Digest.sha2(passwdArray, variant: .sha512) // $ Alert[swift/weak-password-hashing] + _ = Digest.sha3(harmlessArray, variant: .sha512) // GOOD (not sensitive) + _ = Digest.sha3(phoneNumberArray, variant: .sha512) // GOOD + _ = Digest.sha3(passwdArray, variant: .sha512) // $ Alert[swift/weak-password-hashing] + + _ = harmlessArray.md5() // GOOD (not sensitive) + _ = phoneNumberArray.md5() // $ Alert[swift/weak-sensitive-data-hashing] + _ = passwdArray.md5() // $ Alert[swift/weak-password-hashing] + _ = harmlessArray.sha1() // GOOD (not sensitive) + _ = phoneNumberArray.sha1() // $ Alert[swift/weak-sensitive-data-hashing] + _ = passwdArray.sha1() // $ Alert[swift/weak-password-hashing] + _ = harmlessArray.sha512() // GOOD + _ = phoneNumberArray.sha512() // GOOD + _ = passwdArray.sha512() // $ Alert[swift/weak-password-hashing] + _ = harmlessArray.sha2(.sha512) // GOOD + _ = phoneNumberArray.sha2(.sha512) // GOOD + _ = passwdArray.sha2(.sha512) // $ Alert[swift/weak-password-hashing] + _ = harmlessArray.sha3(.sha512) // GOOD + _ = phoneNumberArray.sha3(.sha512) // GOOD + _ = passwdArray.sha3(.sha512) // $ Alert[swift/weak-password-hashing] +} + +func testData(harmlessData: Data, medicalData: Data, passwdData: Data) { + _ = harmlessData.md5() // GOOD (not sensitive) + _ = medicalData.md5() // $ Alert[swift/weak-sensitive-data-hashing] + _ = passwdData.md5() // $ Alert[swift/weak-password-hashing] + _ = harmlessData.sha1() // GOOD (not sensitive) + _ = medicalData.sha1() // $ Alert[swift/weak-sensitive-data-hashing] + _ = passwdData.sha1() // $ Alert[swift/weak-password-hashing] + _ = harmlessData.sha512() // GOOD + _ = medicalData.sha512() // GOOD + _ = passwdData.sha512() // $ Alert[swift/weak-password-hashing] + _ = harmlessData.sha2(.sha512) // GOOD + _ = medicalData.sha2(.sha512) // GOOD + _ = passwdData.sha2(.sha512) // $ Alert[swift/weak-password-hashing] + _ = harmlessData.sha3(.sha512) // GOOD + _ = medicalData.sha3(.sha512) // GOOD + _ = passwdData.sha3(.sha512) // $ Alert[swift/weak-password-hashing] +} + +func testStrings(creditCardNumber: String, passwd: String) { + _ = "harmless".md5() // GOOD (not sensitive) + _ = creditCardNumber.md5() // $ Alert[swift/weak-sensitive-data-hashing] + _ = passwd.md5() // $ Alert[swift/weak-password-hashing] + _ = "harmless".sha1() // GOOD (not sensitive) + _ = creditCardNumber.sha1() // $ Alert[swift/weak-sensitive-data-hashing] + _ = passwd.sha1() // $ Alert[swift/weak-password-hashing] + _ = "harmless".sha512() // GOOD + _ = creditCardNumber.sha512() // GOOD + _ = passwd.sha512() // $ Alert[swift/weak-password-hashing] + _ = "harmless".sha2(.sha512) // GOOD + _ = creditCardNumber.sha2(.sha512) // GOOD + _ = passwd.sha2(.sha512) // $ Alert[swift/weak-password-hashing] + _ = "harmless".sha3(.sha512) // GOOD + _ = creditCardNumber.sha3(.sha512) // GOOD + _ = passwd.sha3(.sha512) // $ Alert[swift/weak-password-hashing] +} From cbf265f12faf248aa0df5e9fc58438297e19b61d Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Wed, 2 Dec 2026 19:00:53 +0000 Subject: [PATCH 02/14] unified: Collect original Swift weak password hashing configuration and models Inline the data flow configuration and query-specific models unchanged from WeakPasswordHashingQuery.qll, WeakPasswordHashingExtensions.qll, and WeakSensitiveDataHashingExtensions.qll, marking their provenance before adapting to unified Swift APIs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../security/CWE-328/WeakPasswordHashing.ql | 311 +++++++++++++++++- 1 file changed, 310 insertions(+), 1 deletion(-) diff --git a/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql index 62a9cb652477..455b4562d414 100644 --- a/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql +++ b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql @@ -13,9 +13,318 @@ */ import swift -import codeql.swift.security.WeakPasswordHashingQuery +import codeql.swift.security.SensitiveExprs +import codeql.swift.dataflow.DataFlow +import codeql.swift.dataflow.TaintTracking +import codeql.swift.dataflow.ExternalFlow import WeakPasswordHashingFlow::PathGraph +// Copied from swift/ql/lib/codeql/swift/security/WeakPasswordHashingQuery.qll. +/** + * Provides a taint tracking configuration to find use of inappropriate + * cryptographic hashing algorithms on passwords. + */ + +/** + * A taint tracking configuration from password expressions to inappropriate + * hashing sinks. + */ +module WeakPasswordHashingConfig implements DataFlow::ConfigSig { + predicate isSource(DataFlow::Node node) { + exists(SensitiveExpr se | + node.asExpr() = se and + se.getSensitiveType() instanceof SensitivePassword + ) + } + + predicate isSink(DataFlow::Node node) { node instanceof WeakPasswordHashingSink } + + predicate isBarrier(DataFlow::Node node) { node instanceof WeakPasswordHashingBarrier } + + predicate isBarrierIn(DataFlow::Node node) { + // make sources barriers so that we only report the closest instance + isSource(node) + } + + predicate isBarrierOut(DataFlow::Node node) { + // make sinks barriers so that we only report the closest instance + isSink(node) + } + + predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) { + any(WeakPasswordHashingAdditionalFlowStep s).step(nodeFrom, nodeTo) + } + + predicate observeDiffInformedIncrementalMode() { any() } +} + +module WeakPasswordHashingFlow = TaintTracking::Global; + +// Copied from swift/ql/lib/codeql/swift/security/WeakPasswordHashingExtensions.qll. +/** + * Provides classes and predicates for reasoning about use of inappropriate + * cryptographic hashing algorithms on passwords. + */ + +/** + * A dataflow sink for weak password hashing vulnerabilities. That is, + * a `DataFlow::Node` that is passed into a weak password hashing function. + */ +abstract class WeakPasswordHashingSink extends DataFlow::Node { + /** + * Gets the name of the hashing algorithm, for display. + */ + abstract string getAlgorithm(); +} + +/** + * A barrier for weak password hashing vulnerabilities. + */ +abstract class WeakPasswordHashingBarrier extends DataFlow::Node { } + +/** + * A unit class for adding additional flow steps. + */ +class WeakPasswordHashingAdditionalFlowStep extends Unit { + /** + * Holds if the step from `node1` to `node2` should be considered a flow + * step for paths related to weak password hashing vulnerabilities. + */ + abstract predicate step(DataFlow::Node nodeFrom, DataFlow::Node nodeTo); +} + +/** + * A sink inherited from weak sensitive data hashing. Password hashing has + * stronger requirements than sensitive data hashing, since (in addition to + * its particular qualities) a password *is* sensitive data. Thus, any sink + * for the weak sensitive data hashing query is a sink for weak password + * hashing as well. + */ +private class InheritedWeakPasswordHashingSink extends WeakPasswordHashingSink instanceof WeakSensitiveDataHashingSink +{ + override string getAlgorithm() { result = this.(WeakSensitiveDataHashingSink).getAlgorithm() } +} + +private class WeakSensitiveDataHashingSinks extends SinkModelCsv { + override predicate row(string row) { + row = + [ + // CryptoKit + // (SHA-256, SHA-384 and SHA-512 are all variants of the SHA-2 algorithm) + ";SHA256;true;hash(data:);;;Argument[0];weak-password-hash-input-SHA256", + ";SHA256;true;hash(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA256", + ";SHA256;true;update(data:);;;Argument[0];weak-password-hash-input-SHA256", + ";SHA256;true;update(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA256", + ";SHA384;true;hash(data:);;;Argument[0];weak-password-hash-input-SHA384", + ";SHA384;true;hash(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA384", + ";SHA384;true;update(data:);;;Argument[0];weak-password-hash-input-SHA384", + ";SHA384;true;update(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA384", + ";SHA512;true;hash(data:);;;Argument[0];weak-password-hash-input-SHA512", + ";SHA512;true;hash(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA512", + ";SHA512;true;update(data:);;;Argument[0];weak-password-hash-input-SHA512", + ";SHA512;true;update(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA512", + // CryptoSwift + ";SHA2;true;calculate(for:);;;Argument[0];weak-password-hash-input-SHA2", + ";SHA2;true;callAsFunction(_:);;;Argument[0];weak-password-hash-input-SHA2", + ";SHA2;true;process64(block:currentHash:);;;Argument[0];weak-password-hash-input-SHA2", + ";SHA2;true;process32(block:currentHash:);;;Argument[0];weak-password-hash-input-SHA2", + ";SHA2;true;update(withBytes:isLast:);;;Argument[0];weak-password-hash-input-SHA2", + ";SHA3;true;calculate(for:);;;Argument[0];weak-password-hash-input-SHA2", + ";SHA3;true;callAsFunction(_:);;;Argument[0];weak-password-hash-input-SHA2", + ";SHA3;true;process(block:currentHash:);;;Argument[0];weak-password-hash-input-SHA2", + ";SHA3;true;update(withBytes:isLast:);;;Argument[0];weak-password-hash-input-SHA2", + ";Digest;true;sha2(_:variant:);;;Argument[0];weak-password-hash-input-SHA2", + ";Digest;true;sha3(_:variant:);;;Argument[0];weak-password-hash-input-SHA3", + ";Digest;true;sha224(_:);;;Argument[0];weak-password-hash-input-SHA224", + ";Digest;true;sha256(_:);;;Argument[0];weak-password-hash-input-SHA256", + ";Digest;true;sha384(_:);;;Argument[0];weak-password-hash-input-SHA384", + ";Digest;true;sha512(_:);;;Argument[0];weak-password-hash-input-SHA512", + ";Array;true;sha2(_:);;;Argument[-1];weak-password-hash-input-SHA2", + ";Array;true;sha3(_:);;;Argument[-1];weak-password-hash-input-SHA3", + ";Array;true;sha224();;;Argument[-1];weak-password-hash-input-SHA224", + ";Array;true;sha256();;;Argument[-1];weak-password-hash-input-SHA256", + ";Array;true;sha384();;;Argument[-1];weak-password-hash-input-SHA384", + ";Array;true;sha512();;;Argument[-1];weak-password-hash-input-SHA512", + ";Data;true;sha2(_:);;;Argument[-1];weak-password-hash-input-SHA2", + ";Data;true;sha3(_:);;;Argument[-1];weak-password-hash-input-SHA3", + ";Data;true;sha224();;;Argument[-1];weak-password-hash-input-SHA224", + ";Data;true;sha256();;;Argument[-1];weak-password-hash-input-SHA256", + ";Data;true;sha384();;;Argument[-1];weak-password-hash-input-SHA384", + ";Data;true;sha512();;;Argument[-1];weak-password-hash-input-SHA512", + ";String;true;sha2(_:);;;Argument[-1];weak-password-hash-input-SHA2", + ";String;true;sha3(_:);;;Argument[-1];weak-password-hash-input-SHA3", + ";String;true;sha224();;;Argument[-1];weak-password-hash-input-SHA224", + ";String;true;sha256();;;Argument[-1];weak-password-hash-input-SHA256", + ";String;true;sha384();;;Argument[-1];weak-password-hash-input-SHA384", + ";String;true;sha512();;;Argument[-1];weak-password-hash-input-SHA512", + ] + } +} + +/** + * A sink defined in a CSV model. + */ +private class DefaultWeakPasswordHashingSink extends WeakPasswordHashingSink { + string algorithm; + + DefaultWeakPasswordHashingSink() { sinkNode(this, "weak-password-hash-input-" + algorithm) } + + override string getAlgorithm() { result = algorithm } +} + +/** + * A sink for weak password hashing through a call with a metatype qualifier. + */ +private class WeakPasswordHashingMetatypeSink extends WeakPasswordHashingSink { + string algorithm; + + WeakPasswordHashingMetatypeSink() { + exists(CallExpr ce, Type t | + // call target + ce.getStaticTarget().getName() = + ["hash(data:)", "hash(bufferPointer:)", "update(data:)", "update(bufferPointer:)"] and + // argument + ce.getAnArgument().getExpr() = this.asExpr() and + // qualifier + t = ce.getQualifier().getType() and + algorithm = ["SHA256", "SHA384", "SHA512"] and + ( + t.getFullName() = algorithm + or + exists(TypeDecl td | + td.getInterfaceType() = t and + td.getFullName() = algorithm + ) + ) + ) + } + + override string getAlgorithm() { result = algorithm } +} + +/** + * A barrier for weak password hashing, when it occurs inside of + * certain cryptographic algorithms as part of their design. + */ +class WeakPasswordHashingImplementationBarrier extends WeakPasswordHashingBarrier { + WeakPasswordHashingImplementationBarrier() { + this.asParameter() + .getDeclaringFunction() + .(Function) + .getDeclaringDecl*() + .(NominalTypeDecl) + .getName() = ["HMAC", "PBKDF1", "PBKDF2"] + } +} + +// Copied from swift/ql/lib/codeql/swift/security/WeakSensitiveDataHashingExtensions.qll. +/** + * Provides classes and predicates for reasoning about use of broken or weak + * cryptographic hashing algorithms on sensitive data. + */ + +/** + * A dataflow sink for weak sensitive data hashing vulnerabilities. That is, + * a `DataFlow::Node` that is passed into a weak hashing function. + */ +abstract class WeakSensitiveDataHashingSink extends DataFlow::Node { + /** + * Gets the name of the hashing algorithm, for display. + */ + abstract string getAlgorithm(); +} + +/** + * A barrier for weak sensitive data hashing vulnerabilities. + */ +abstract class WeakSensitiveDataHashingBarrier extends DataFlow::Node { } + +/** + * A unit class for adding additional flow steps. + */ +class WeakSensitiveDataHashingAdditionalFlowStep extends Unit { + /** + * Holds if the step from `node1` to `node2` should be considered a flow + * step for paths related to weak sensitive data hashing vulnerabilities. + */ + abstract predicate step(DataFlow::Node nodeFrom, DataFlow::Node nodeTo); +} + +private class WeakSensitiveDataHashingSinks extends SinkModelCsv { + override predicate row(string row) { + row = + [ + // CryptoKit + ";Insecure.MD5;true;hash(data:);;;Argument[0];weak-hash-input-MD5", + ";Insecure.MD5;true;hash(bufferPointer:);;;Argument[0];weak-hash-input-MD5", + ";Insecure.MD5;true;update(data:);;;Argument[0];weak-hash-input-MD5", + ";Insecure.MD5;true;update(bufferPointer:);;;Argument[0];weak-hash-input-MD5", + ";Insecure.SHA1;true;hash(data:);;;Argument[0];weak-hash-input-SHA1", + ";Insecure.SHA1;true;hash(bufferPointer:);;;Argument[0];weak-hash-input-SHA1", + ";Insecure.SHA1;true;update(data:);;;Argument[0];weak-hash-input-SHA1", + ";Insecure.SHA1;true;update(bufferPointer:);;;Argument[0];weak-hash-input-SHA1", + // CryptoSwift + ";MD5;true;calculate(for:);;;Argument[0];weak-hash-input-MD5", + ";MD5;true;callAsFunction(_:);;;Argument[0];weak-hash-input-MD5", + ";MD5;true;process(block:currentHash:);;;Argument[0];weak-hash-input-MD5", + ";MD5;true;update(withBytes:isLast:);;;Argument[0];weak-hash-input-MD5", + ";SHA1;true;calculate(for:);;;Argument[0];weak-hash-input-SHA1", + ";SHA1;true;callAsFunction(_:);;;Argument[0];weak-hash-input-SHA1", + ";SHA1;true;process(block:currentHash:);;;Argument[0];weak-hash-input-SHA1", + ";SHA1;true;update(withBytes:isLast:);;;Argument[0];weak-hash-input-SHA1", + ";Digest;true;md5(_:);;;Argument[0];weak-hash-input-MD5", + ";Digest;true;sha1(_:);;;Argument[0];weak-hash-input-SHA1", + ";Array;true;md5();;;Argument[-1];weak-hash-input-MD5", + ";Array;true;sha1();;;Argument[-1];weak-hash-input-SHA1", + ";Data;true;md5();;;Argument[-1];weak-hash-input-MD5", + ";Data;true;sha1();;;Argument[-1];weak-hash-input-SHA1", + ";String;true;md5();;;Argument[-1];weak-hash-input-MD5", + ";String;true;sha1();;;Argument[-1];weak-hash-input-SHA1", + ] + } +} + +/** + * A sink defined in a CSV model. + */ +private class DefaultWeakSensitiveDataHashingSink extends WeakSensitiveDataHashingSink { + string algorithm; + + DefaultWeakSensitiveDataHashingSink() { sinkNode(this, "weak-hash-input-" + algorithm) } + + override string getAlgorithm() { result = algorithm } +} + +/** + * A sink for weak sensitive data hashing through a call with a metatype qualifier. + */ +private class WeakSensitiveDataHashingMetatypeSink extends WeakSensitiveDataHashingSink { + string algorithm; + + WeakSensitiveDataHashingMetatypeSink() { + exists(CallExpr ce, Type t | + // call target + ce.getStaticTarget().getName() = + ["hash(data:)", "hash(bufferPointer:)", "update(data:)", "update(bufferPointer:)"] and + // argument + ce.getAnArgument().getExpr() = this.asExpr() and + // qualifier + t = ce.getQualifier().getType() and + algorithm = ["MD5", "SHA1"] and + ( + t.getFullName() = "Insecure." + algorithm + or + exists(TypeDecl td | + td.getInterfaceType() = t and + td.getFullName() = "Insecure." + algorithm + ) + ) + ) + } + + override string getAlgorithm() { result = algorithm } +} + from WeakPasswordHashingFlow::PathNode source, WeakPasswordHashingFlow::PathNode sink, string algorithm where From 5fa9a024b6ed244cda8d24291ce5aa495bd5782d Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Wed, 2 Dec 2026 19:02:31 +0000 Subject: [PATCH 03/14] unified: Port weak password hashing query to unified Swift Adapt WeakPasswordHashing.ql to unified Swift using SensitiveData password sources, existing models-as-data sinks from legacy-swift.model.json, and an implementation barrier covering HMAC/PBKDF1/PBKDF2 declarations and extensions. Update the query ID, .qlref, and inline test expectations. All 48 original positive cases are detected with 0 testFailures. Because LegacyMaD currently ignores receiver types for method calls, overloaded sink names (hash, update, calculate) match multiple algorithm models per call site (152 #select rows total). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../security/CWE-328/WeakPasswordHashing.ql | 319 ++--------------- .../CWE-328/WeakPasswordHashing.expected | 334 ++++++++++++------ .../CWE-328/WeakPasswordHashing.qlref | 5 +- .../security/CWE-328/testArgon2Swift.swift | 2 +- .../security/CWE-328/testCryptoKit.swift | 210 +++++------ .../security/CWE-328/testCryptoSwift.swift | 69 ++-- 6 files changed, 409 insertions(+), 530 deletions(-) diff --git a/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql index 455b4562d414..ac0d3bb66915 100644 --- a/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql +++ b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql @@ -5,25 +5,27 @@ * @problem.severity warning * @security-severity 7.5 * @precision high - * @id swift/weak-password-hashing + * @id unified/swift/weak-password-hashing * @tags security * external/cwe/cwe-327 * external/cwe/cwe-328 * external/cwe/cwe-916 */ -import swift -import codeql.swift.security.SensitiveExprs -import codeql.swift.dataflow.DataFlow -import codeql.swift.dataflow.TaintTracking -import codeql.swift.dataflow.ExternalFlow -import WeakPasswordHashingFlow::PathGraph +import unified +import codeql.unified.security.SensitiveData -// Copied from swift/ql/lib/codeql/swift/security/WeakPasswordHashingQuery.qll. /** - * Provides a taint tracking configuration to find use of inappropriate - * cryptographic hashing algorithms on passwords. + * Holds if `node` is a sink for weak password hashing using `algorithm`. */ +private predicate isWeakPasswordHashingSink(DataFlow::Node node, string algorithm) { + exists(string kind | Models::isSink(node, kind) | + // match the following sinks: + // - `weak-hash-input-` (sinks that apply to both this query and `unified/swift/weak-sensitive-data-hashing`) + // - `weak-password-hash-input-` (sinks that apply to just this query) + algorithm = kind.regexpCapture("weak-(?:password-)?hash-input-(.+)", 1) + ) +} /** * A taint tracking configuration from password expressions to inappropriate @@ -31,15 +33,25 @@ import WeakPasswordHashingFlow::PathGraph */ module WeakPasswordHashingConfig implements DataFlow::ConfigSig { predicate isSource(DataFlow::Node node) { - exists(SensitiveExpr se | - node.asExpr() = se and - se.getSensitiveType() instanceof SensitivePassword - ) + node.(SensitiveData).getClassification() = SensitiveDataClassification::password() } - predicate isSink(DataFlow::Node node) { node instanceof WeakPasswordHashingSink } + predicate isSink(DataFlow::Node node) { isWeakPasswordHashingSink(node, _) } - predicate isBarrier(DataFlow::Node node) { node instanceof WeakPasswordHashingBarrier } + predicate isBarrier(DataFlow::Node node) { + // A barrier for weak password hashing, when it occurs inside of + // certain cryptographic algorithms as part of their design. + exists(Parameter param, ClassLikeDeclaration cls, string name | + node.asExpr() = param.getPattern() and + param.getParent().getParent+() = cls and + ( + name = cls.resolve().getName() + or + name = cls.getExtensionTarget().(Identifier).getValue() + ) and + name = ["HMAC", "PBKDF1", "PBKDF2"] + ) + } predicate isBarrierIn(DataFlow::Node node) { // make sources barriers so that we only report the closest instance @@ -50,286 +62,17 @@ module WeakPasswordHashingConfig implements DataFlow::ConfigSig { // make sinks barriers so that we only report the closest instance isSink(node) } - - predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) { - any(WeakPasswordHashingAdditionalFlowStep s).step(nodeFrom, nodeTo) - } - - predicate observeDiffInformedIncrementalMode() { any() } } module WeakPasswordHashingFlow = TaintTracking::Global; -// Copied from swift/ql/lib/codeql/swift/security/WeakPasswordHashingExtensions.qll. -/** - * Provides classes and predicates for reasoning about use of inappropriate - * cryptographic hashing algorithms on passwords. - */ - -/** - * A dataflow sink for weak password hashing vulnerabilities. That is, - * a `DataFlow::Node` that is passed into a weak password hashing function. - */ -abstract class WeakPasswordHashingSink extends DataFlow::Node { - /** - * Gets the name of the hashing algorithm, for display. - */ - abstract string getAlgorithm(); -} - -/** - * A barrier for weak password hashing vulnerabilities. - */ -abstract class WeakPasswordHashingBarrier extends DataFlow::Node { } - -/** - * A unit class for adding additional flow steps. - */ -class WeakPasswordHashingAdditionalFlowStep extends Unit { - /** - * Holds if the step from `node1` to `node2` should be considered a flow - * step for paths related to weak password hashing vulnerabilities. - */ - abstract predicate step(DataFlow::Node nodeFrom, DataFlow::Node nodeTo); -} - -/** - * A sink inherited from weak sensitive data hashing. Password hashing has - * stronger requirements than sensitive data hashing, since (in addition to - * its particular qualities) a password *is* sensitive data. Thus, any sink - * for the weak sensitive data hashing query is a sink for weak password - * hashing as well. - */ -private class InheritedWeakPasswordHashingSink extends WeakPasswordHashingSink instanceof WeakSensitiveDataHashingSink -{ - override string getAlgorithm() { result = this.(WeakSensitiveDataHashingSink).getAlgorithm() } -} - -private class WeakSensitiveDataHashingSinks extends SinkModelCsv { - override predicate row(string row) { - row = - [ - // CryptoKit - // (SHA-256, SHA-384 and SHA-512 are all variants of the SHA-2 algorithm) - ";SHA256;true;hash(data:);;;Argument[0];weak-password-hash-input-SHA256", - ";SHA256;true;hash(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA256", - ";SHA256;true;update(data:);;;Argument[0];weak-password-hash-input-SHA256", - ";SHA256;true;update(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA256", - ";SHA384;true;hash(data:);;;Argument[0];weak-password-hash-input-SHA384", - ";SHA384;true;hash(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA384", - ";SHA384;true;update(data:);;;Argument[0];weak-password-hash-input-SHA384", - ";SHA384;true;update(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA384", - ";SHA512;true;hash(data:);;;Argument[0];weak-password-hash-input-SHA512", - ";SHA512;true;hash(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA512", - ";SHA512;true;update(data:);;;Argument[0];weak-password-hash-input-SHA512", - ";SHA512;true;update(bufferPointer:);;;Argument[0];weak-password-hash-input-SHA512", - // CryptoSwift - ";SHA2;true;calculate(for:);;;Argument[0];weak-password-hash-input-SHA2", - ";SHA2;true;callAsFunction(_:);;;Argument[0];weak-password-hash-input-SHA2", - ";SHA2;true;process64(block:currentHash:);;;Argument[0];weak-password-hash-input-SHA2", - ";SHA2;true;process32(block:currentHash:);;;Argument[0];weak-password-hash-input-SHA2", - ";SHA2;true;update(withBytes:isLast:);;;Argument[0];weak-password-hash-input-SHA2", - ";SHA3;true;calculate(for:);;;Argument[0];weak-password-hash-input-SHA2", - ";SHA3;true;callAsFunction(_:);;;Argument[0];weak-password-hash-input-SHA2", - ";SHA3;true;process(block:currentHash:);;;Argument[0];weak-password-hash-input-SHA2", - ";SHA3;true;update(withBytes:isLast:);;;Argument[0];weak-password-hash-input-SHA2", - ";Digest;true;sha2(_:variant:);;;Argument[0];weak-password-hash-input-SHA2", - ";Digest;true;sha3(_:variant:);;;Argument[0];weak-password-hash-input-SHA3", - ";Digest;true;sha224(_:);;;Argument[0];weak-password-hash-input-SHA224", - ";Digest;true;sha256(_:);;;Argument[0];weak-password-hash-input-SHA256", - ";Digest;true;sha384(_:);;;Argument[0];weak-password-hash-input-SHA384", - ";Digest;true;sha512(_:);;;Argument[0];weak-password-hash-input-SHA512", - ";Array;true;sha2(_:);;;Argument[-1];weak-password-hash-input-SHA2", - ";Array;true;sha3(_:);;;Argument[-1];weak-password-hash-input-SHA3", - ";Array;true;sha224();;;Argument[-1];weak-password-hash-input-SHA224", - ";Array;true;sha256();;;Argument[-1];weak-password-hash-input-SHA256", - ";Array;true;sha384();;;Argument[-1];weak-password-hash-input-SHA384", - ";Array;true;sha512();;;Argument[-1];weak-password-hash-input-SHA512", - ";Data;true;sha2(_:);;;Argument[-1];weak-password-hash-input-SHA2", - ";Data;true;sha3(_:);;;Argument[-1];weak-password-hash-input-SHA3", - ";Data;true;sha224();;;Argument[-1];weak-password-hash-input-SHA224", - ";Data;true;sha256();;;Argument[-1];weak-password-hash-input-SHA256", - ";Data;true;sha384();;;Argument[-1];weak-password-hash-input-SHA384", - ";Data;true;sha512();;;Argument[-1];weak-password-hash-input-SHA512", - ";String;true;sha2(_:);;;Argument[-1];weak-password-hash-input-SHA2", - ";String;true;sha3(_:);;;Argument[-1];weak-password-hash-input-SHA3", - ";String;true;sha224();;;Argument[-1];weak-password-hash-input-SHA224", - ";String;true;sha256();;;Argument[-1];weak-password-hash-input-SHA256", - ";String;true;sha384();;;Argument[-1];weak-password-hash-input-SHA384", - ";String;true;sha512();;;Argument[-1];weak-password-hash-input-SHA512", - ] - } -} - -/** - * A sink defined in a CSV model. - */ -private class DefaultWeakPasswordHashingSink extends WeakPasswordHashingSink { - string algorithm; - - DefaultWeakPasswordHashingSink() { sinkNode(this, "weak-password-hash-input-" + algorithm) } - - override string getAlgorithm() { result = algorithm } -} - -/** - * A sink for weak password hashing through a call with a metatype qualifier. - */ -private class WeakPasswordHashingMetatypeSink extends WeakPasswordHashingSink { - string algorithm; - - WeakPasswordHashingMetatypeSink() { - exists(CallExpr ce, Type t | - // call target - ce.getStaticTarget().getName() = - ["hash(data:)", "hash(bufferPointer:)", "update(data:)", "update(bufferPointer:)"] and - // argument - ce.getAnArgument().getExpr() = this.asExpr() and - // qualifier - t = ce.getQualifier().getType() and - algorithm = ["SHA256", "SHA384", "SHA512"] and - ( - t.getFullName() = algorithm - or - exists(TypeDecl td | - td.getInterfaceType() = t and - td.getFullName() = algorithm - ) - ) - ) - } - - override string getAlgorithm() { result = algorithm } -} - -/** - * A barrier for weak password hashing, when it occurs inside of - * certain cryptographic algorithms as part of their design. - */ -class WeakPasswordHashingImplementationBarrier extends WeakPasswordHashingBarrier { - WeakPasswordHashingImplementationBarrier() { - this.asParameter() - .getDeclaringFunction() - .(Function) - .getDeclaringDecl*() - .(NominalTypeDecl) - .getName() = ["HMAC", "PBKDF1", "PBKDF2"] - } -} - -// Copied from swift/ql/lib/codeql/swift/security/WeakSensitiveDataHashingExtensions.qll. -/** - * Provides classes and predicates for reasoning about use of broken or weak - * cryptographic hashing algorithms on sensitive data. - */ - -/** - * A dataflow sink for weak sensitive data hashing vulnerabilities. That is, - * a `DataFlow::Node` that is passed into a weak hashing function. - */ -abstract class WeakSensitiveDataHashingSink extends DataFlow::Node { - /** - * Gets the name of the hashing algorithm, for display. - */ - abstract string getAlgorithm(); -} - -/** - * A barrier for weak sensitive data hashing vulnerabilities. - */ -abstract class WeakSensitiveDataHashingBarrier extends DataFlow::Node { } - -/** - * A unit class for adding additional flow steps. - */ -class WeakSensitiveDataHashingAdditionalFlowStep extends Unit { - /** - * Holds if the step from `node1` to `node2` should be considered a flow - * step for paths related to weak sensitive data hashing vulnerabilities. - */ - abstract predicate step(DataFlow::Node nodeFrom, DataFlow::Node nodeTo); -} - -private class WeakSensitiveDataHashingSinks extends SinkModelCsv { - override predicate row(string row) { - row = - [ - // CryptoKit - ";Insecure.MD5;true;hash(data:);;;Argument[0];weak-hash-input-MD5", - ";Insecure.MD5;true;hash(bufferPointer:);;;Argument[0];weak-hash-input-MD5", - ";Insecure.MD5;true;update(data:);;;Argument[0];weak-hash-input-MD5", - ";Insecure.MD5;true;update(bufferPointer:);;;Argument[0];weak-hash-input-MD5", - ";Insecure.SHA1;true;hash(data:);;;Argument[0];weak-hash-input-SHA1", - ";Insecure.SHA1;true;hash(bufferPointer:);;;Argument[0];weak-hash-input-SHA1", - ";Insecure.SHA1;true;update(data:);;;Argument[0];weak-hash-input-SHA1", - ";Insecure.SHA1;true;update(bufferPointer:);;;Argument[0];weak-hash-input-SHA1", - // CryptoSwift - ";MD5;true;calculate(for:);;;Argument[0];weak-hash-input-MD5", - ";MD5;true;callAsFunction(_:);;;Argument[0];weak-hash-input-MD5", - ";MD5;true;process(block:currentHash:);;;Argument[0];weak-hash-input-MD5", - ";MD5;true;update(withBytes:isLast:);;;Argument[0];weak-hash-input-MD5", - ";SHA1;true;calculate(for:);;;Argument[0];weak-hash-input-SHA1", - ";SHA1;true;callAsFunction(_:);;;Argument[0];weak-hash-input-SHA1", - ";SHA1;true;process(block:currentHash:);;;Argument[0];weak-hash-input-SHA1", - ";SHA1;true;update(withBytes:isLast:);;;Argument[0];weak-hash-input-SHA1", - ";Digest;true;md5(_:);;;Argument[0];weak-hash-input-MD5", - ";Digest;true;sha1(_:);;;Argument[0];weak-hash-input-SHA1", - ";Array;true;md5();;;Argument[-1];weak-hash-input-MD5", - ";Array;true;sha1();;;Argument[-1];weak-hash-input-SHA1", - ";Data;true;md5();;;Argument[-1];weak-hash-input-MD5", - ";Data;true;sha1();;;Argument[-1];weak-hash-input-SHA1", - ";String;true;md5();;;Argument[-1];weak-hash-input-MD5", - ";String;true;sha1();;;Argument[-1];weak-hash-input-SHA1", - ] - } -} - -/** - * A sink defined in a CSV model. - */ -private class DefaultWeakSensitiveDataHashingSink extends WeakSensitiveDataHashingSink { - string algorithm; - - DefaultWeakSensitiveDataHashingSink() { sinkNode(this, "weak-hash-input-" + algorithm) } - - override string getAlgorithm() { result = algorithm } -} - -/** - * A sink for weak sensitive data hashing through a call with a metatype qualifier. - */ -private class WeakSensitiveDataHashingMetatypeSink extends WeakSensitiveDataHashingSink { - string algorithm; - - WeakSensitiveDataHashingMetatypeSink() { - exists(CallExpr ce, Type t | - // call target - ce.getStaticTarget().getName() = - ["hash(data:)", "hash(bufferPointer:)", "update(data:)", "update(bufferPointer:)"] and - // argument - ce.getAnArgument().getExpr() = this.asExpr() and - // qualifier - t = ce.getQualifier().getType() and - algorithm = ["MD5", "SHA1"] and - ( - t.getFullName() = "Insecure." + algorithm - or - exists(TypeDecl td | - td.getInterfaceType() = t and - td.getFullName() = "Insecure." + algorithm - ) - ) - ) - } - - override string getAlgorithm() { result = algorithm } -} +import WeakPasswordHashingFlow::PathGraph from WeakPasswordHashingFlow::PathNode source, WeakPasswordHashingFlow::PathNode sink, string algorithm where WeakPasswordHashingFlow::flowPath(source, sink) and - algorithm = sink.getNode().(WeakPasswordHashingSink).getAlgorithm() + isWeakPasswordHashingSink(sink.getNode(), algorithm) select sink.getNode(), source, sink, "Insecure hashing algorithm (" + algorithm + ") depends on $@.", source.getNode(), - "password (" + source.getNode().asExpr() + ")" + "password (" + source.getNode().toString() + ")" diff --git a/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.expected b/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.expected index 2b0eed8d0c2b..92c988bca886 100644 --- a/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.expected +++ b/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.expected @@ -1,104 +1,238 @@ #select -| testCryptoKit.swift:84:47:84:47 | passwd | testCryptoKit.swift:84:47:84:47 | passwd | testCryptoKit.swift:84:47:84:47 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:84:47:84:47 | passwd | password (passwd) | -| testCryptoKit.swift:85:52:85:52 | passwd | testCryptoKit.swift:85:52:85:52 | passwd | testCryptoKit.swift:85:52:85:52 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:85:52:85:52 | passwd | password (passwd) | -| testCryptoKit.swift:91:36:91:36 | passwd | testCryptoKit.swift:91:36:91:36 | passwd | testCryptoKit.swift:91:36:91:36 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:91:36:91:36 | passwd | password (passwd) | -| testCryptoKit.swift:92:45:92:45 | passwd | testCryptoKit.swift:92:45:92:45 | passwd | testCryptoKit.swift:92:45:92:45 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:92:45:92:45 | passwd | password (passwd) | -| testCryptoKit.swift:98:44:98:44 | passwd | testCryptoKit.swift:98:44:98:44 | passwd | testCryptoKit.swift:98:44:98:44 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:98:44:98:44 | passwd | password (passwd) | -| testCryptoKit.swift:99:53:99:53 | passwd | testCryptoKit.swift:99:53:99:53 | passwd | testCryptoKit.swift:99:53:99:53 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:99:53:99:53 | passwd | password (passwd) | -| testCryptoKit.swift:105:37:105:37 | passwd | testCryptoKit.swift:105:37:105:37 | passwd | testCryptoKit.swift:105:37:105:37 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:105:37:105:37 | passwd | password (passwd) | -| testCryptoKit.swift:106:46:106:46 | passwd | testCryptoKit.swift:106:46:106:46 | passwd | testCryptoKit.swift:106:46:106:46 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:106:46:106:46 | passwd | password (passwd) | -| testCryptoKit.swift:112:37:112:37 | passwd | testCryptoKit.swift:112:37:112:37 | passwd | testCryptoKit.swift:112:37:112:37 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:112:37:112:37 | passwd | password (passwd) | -| testCryptoKit.swift:113:46:113:46 | passwd | testCryptoKit.swift:113:46:113:46 | passwd | testCryptoKit.swift:113:46:113:46 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:113:46:113:46 | passwd | password (passwd) | -| testCryptoKit.swift:119:37:119:37 | passwd | testCryptoKit.swift:119:37:119:37 | passwd | testCryptoKit.swift:119:37:119:37 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:119:37:119:37 | passwd | password (passwd) | -| testCryptoKit.swift:120:46:120:46 | passwd | testCryptoKit.swift:120:46:120:46 | passwd | testCryptoKit.swift:120:46:120:46 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:120:46:120:46 | passwd | password (passwd) | -| testCryptoKit.swift:129:23:129:23 | passwd | testCryptoKit.swift:129:23:129:23 | passwd | testCryptoKit.swift:129:23:129:23 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:129:23:129:23 | passwd | password (passwd) | -| testCryptoKit.swift:138:23:138:23 | passwd | testCryptoKit.swift:138:23:138:23 | passwd | testCryptoKit.swift:138:23:138:23 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:138:23:138:23 | passwd | password (passwd) | -| testCryptoKit.swift:147:23:147:23 | passwd | testCryptoKit.swift:147:23:147:23 | passwd | testCryptoKit.swift:147:23:147:23 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:147:23:147:23 | passwd | password (passwd) | -| testCryptoKit.swift:156:23:156:23 | passwd | testCryptoKit.swift:156:23:156:23 | passwd | testCryptoKit.swift:156:23:156:23 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:156:23:156:23 | passwd | password (passwd) | -| testCryptoKit.swift:165:23:165:23 | passwd | testCryptoKit.swift:165:23:165:23 | passwd | testCryptoKit.swift:165:23:165:23 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:165:23:165:23 | passwd | password (passwd) | -| testCryptoKit.swift:174:32:174:32 | passwd | testCryptoKit.swift:174:32:174:32 | passwd | testCryptoKit.swift:174:32:174:32 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:174:32:174:32 | passwd | password (passwd) | -| testCryptoKit.swift:183:32:183:32 | passwd | testCryptoKit.swift:183:32:183:32 | passwd | testCryptoKit.swift:183:32:183:32 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:183:32:183:32 | passwd | password (passwd) | -| testCryptoKit.swift:192:32:192:32 | passwd | testCryptoKit.swift:192:32:192:32 | passwd | testCryptoKit.swift:192:32:192:32 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:192:32:192:32 | passwd | password (passwd) | -| testCryptoKit.swift:201:32:201:32 | passwd | testCryptoKit.swift:201:32:201:32 | passwd | testCryptoKit.swift:201:32:201:32 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:201:32:201:32 | passwd | password (passwd) | -| testCryptoKit.swift:210:32:210:32 | passwd | testCryptoKit.swift:210:32:210:32 | passwd | testCryptoKit.swift:210:32:210:32 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:210:32:210:32 | passwd | password (passwd) | -| testCryptoKit.swift:220:49:220:49 | passwordData | testCryptoKit.swift:220:49:220:49 | passwordData | testCryptoKit.swift:220:49:220:49 | passwordData | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:220:49:220:49 | passwordData | password (passwordData) | -| testCryptoKit.swift:224:33:224:57 | call to Data.init(_:) | testCryptoKit.swift:224:38:224:38 | passwordString | testCryptoKit.swift:224:33:224:57 | call to Data.init(_:) | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:224:38:224:38 | passwordString | password (passwordString) | -| testCryptoSwift.swift:154:30:154:30 | passwdArray | testCryptoSwift.swift:154:30:154:30 | passwdArray | testCryptoSwift.swift:154:30:154:30 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:154:30:154:30 | passwdArray | password (passwdArray) | -| testCryptoSwift.swift:157:31:157:31 | passwdArray | testCryptoSwift.swift:157:31:157:31 | passwdArray | testCryptoSwift.swift:157:31:157:31 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:157:31:157:31 | passwdArray | password (passwdArray) | -| testCryptoSwift.swift:160:47:160:47 | passwdArray | testCryptoSwift.swift:160:47:160:47 | passwdArray | testCryptoSwift.swift:160:47:160:47 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:160:47:160:47 | passwdArray | password (passwdArray) | -| testCryptoSwift.swift:163:47:163:47 | passwdArray | testCryptoSwift.swift:163:47:163:47 | passwdArray | testCryptoSwift.swift:163:47:163:47 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:163:47:163:47 | passwdArray | password (passwdArray) | -| testCryptoSwift.swift:167:20:167:20 | passwdArray | testCryptoSwift.swift:167:20:167:20 | passwdArray | testCryptoSwift.swift:167:20:167:20 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:167:20:167:20 | passwdArray | password (passwdArray) | -| testCryptoSwift.swift:170:21:170:21 | passwdArray | testCryptoSwift.swift:170:21:170:21 | passwdArray | testCryptoSwift.swift:170:21:170:21 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:170:21:170:21 | passwdArray | password (passwdArray) | -| testCryptoSwift.swift:173:23:173:23 | passwdArray | testCryptoSwift.swift:173:23:173:23 | passwdArray | testCryptoSwift.swift:173:23:173:23 | passwdArray | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoSwift.swift:173:23:173:23 | passwdArray | password (passwdArray) | -| testCryptoSwift.swift:176:21:176:21 | passwdArray | testCryptoSwift.swift:176:21:176:21 | passwdArray | testCryptoSwift.swift:176:21:176:21 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:176:21:176:21 | passwdArray | password (passwdArray) | -| testCryptoSwift.swift:179:21:179:21 | passwdArray | testCryptoSwift.swift:179:21:179:21 | passwdArray | testCryptoSwift.swift:179:21:179:21 | passwdArray | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:179:21:179:21 | passwdArray | password (passwdArray) | -| testCryptoSwift.swift:183:9:183:9 | passwdArray | testCryptoSwift.swift:183:9:183:9 | passwdArray | testCryptoSwift.swift:183:9:183:9 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:183:9:183:9 | passwdArray | password (passwdArray) | -| testCryptoSwift.swift:186:9:186:9 | passwdArray | testCryptoSwift.swift:186:9:186:9 | passwdArray | testCryptoSwift.swift:186:9:186:9 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:186:9:186:9 | passwdArray | password (passwdArray) | -| testCryptoSwift.swift:189:9:189:9 | passwdArray | testCryptoSwift.swift:189:9:189:9 | passwdArray | testCryptoSwift.swift:189:9:189:9 | passwdArray | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoSwift.swift:189:9:189:9 | passwdArray | password (passwdArray) | -| testCryptoSwift.swift:192:9:192:9 | passwdArray | testCryptoSwift.swift:192:9:192:9 | passwdArray | testCryptoSwift.swift:192:9:192:9 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:192:9:192:9 | passwdArray | password (passwdArray) | -| testCryptoSwift.swift:195:9:195:9 | passwdArray | testCryptoSwift.swift:195:9:195:9 | passwdArray | testCryptoSwift.swift:195:9:195:9 | passwdArray | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:195:9:195:9 | passwdArray | password (passwdArray) | -| testCryptoSwift.swift:201:9:201:9 | passwdData | testCryptoSwift.swift:201:9:201:9 | passwdData | testCryptoSwift.swift:201:9:201:9 | passwdData | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:201:9:201:9 | passwdData | password (passwdData) | -| testCryptoSwift.swift:204:9:204:9 | passwdData | testCryptoSwift.swift:204:9:204:9 | passwdData | testCryptoSwift.swift:204:9:204:9 | passwdData | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:204:9:204:9 | passwdData | password (passwdData) | -| testCryptoSwift.swift:207:9:207:9 | passwdData | testCryptoSwift.swift:207:9:207:9 | passwdData | testCryptoSwift.swift:207:9:207:9 | passwdData | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoSwift.swift:207:9:207:9 | passwdData | password (passwdData) | -| testCryptoSwift.swift:210:9:210:9 | passwdData | testCryptoSwift.swift:210:9:210:9 | passwdData | testCryptoSwift.swift:210:9:210:9 | passwdData | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:210:9:210:9 | passwdData | password (passwdData) | -| testCryptoSwift.swift:213:9:213:9 | passwdData | testCryptoSwift.swift:213:9:213:9 | passwdData | testCryptoSwift.swift:213:9:213:9 | passwdData | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:213:9:213:9 | passwdData | password (passwdData) | -| testCryptoSwift.swift:219:9:219:9 | passwd | testCryptoSwift.swift:219:9:219:9 | passwd | testCryptoSwift.swift:219:9:219:9 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:219:9:219:9 | passwd | password (passwd) | -| testCryptoSwift.swift:222:9:222:9 | passwd | testCryptoSwift.swift:222:9:222:9 | passwd | testCryptoSwift.swift:222:9:222:9 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:222:9:222:9 | passwd | password (passwd) | -| testCryptoSwift.swift:225:9:225:9 | passwd | testCryptoSwift.swift:225:9:225:9 | passwd | testCryptoSwift.swift:225:9:225:9 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoSwift.swift:225:9:225:9 | passwd | password (passwd) | -| testCryptoSwift.swift:228:9:228:9 | passwd | testCryptoSwift.swift:228:9:228:9 | passwd | testCryptoSwift.swift:228:9:228:9 | passwd | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:228:9:228:9 | passwd | password (passwd) | -| testCryptoSwift.swift:231:9:231:9 | passwd | testCryptoSwift.swift:231:9:231:9 | passwd | testCryptoSwift.swift:231:9:231:9 | passwd | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:231:9:231:9 | passwd | password (passwd) | +| testCryptoKit.swift:84:47:84:52 | passwd | testCryptoKit.swift:84:47:84:52 | passwd | testCryptoKit.swift:84:47:84:52 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:84:47:84:52 | passwd | password (passwd) | +| testCryptoKit.swift:84:47:84:52 | passwd | testCryptoKit.swift:84:47:84:52 | passwd | testCryptoKit.swift:84:47:84:52 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:84:47:84:52 | passwd | password (passwd) | +| testCryptoKit.swift:84:47:84:52 | passwd | testCryptoKit.swift:84:47:84:52 | passwd | testCryptoKit.swift:84:47:84:52 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:84:47:84:52 | passwd | password (passwd) | +| testCryptoKit.swift:84:47:84:52 | passwd | testCryptoKit.swift:84:47:84:52 | passwd | testCryptoKit.swift:84:47:84:52 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:84:47:84:52 | passwd | password (passwd) | +| testCryptoKit.swift:84:47:84:52 | passwd | testCryptoKit.swift:84:47:84:52 | passwd | testCryptoKit.swift:84:47:84:52 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:84:47:84:52 | passwd | password (passwd) | +| testCryptoKit.swift:85:52:85:57 | passwd | testCryptoKit.swift:85:52:85:57 | passwd | testCryptoKit.swift:85:52:85:57 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:85:52:85:57 | passwd | password (passwd) | +| testCryptoKit.swift:85:52:85:57 | passwd | testCryptoKit.swift:85:52:85:57 | passwd | testCryptoKit.swift:85:52:85:57 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:85:52:85:57 | passwd | password (passwd) | +| testCryptoKit.swift:85:52:85:57 | passwd | testCryptoKit.swift:85:52:85:57 | passwd | testCryptoKit.swift:85:52:85:57 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:85:52:85:57 | passwd | password (passwd) | +| testCryptoKit.swift:85:52:85:57 | passwd | testCryptoKit.swift:85:52:85:57 | passwd | testCryptoKit.swift:85:52:85:57 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:85:52:85:57 | passwd | password (passwd) | +| testCryptoKit.swift:85:52:85:57 | passwd | testCryptoKit.swift:85:52:85:57 | passwd | testCryptoKit.swift:85:52:85:57 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:85:52:85:57 | passwd | password (passwd) | +| testCryptoKit.swift:91:36:91:41 | passwd | testCryptoKit.swift:91:36:91:41 | passwd | testCryptoKit.swift:91:36:91:41 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:91:36:91:41 | passwd | password (passwd) | +| testCryptoKit.swift:91:36:91:41 | passwd | testCryptoKit.swift:91:36:91:41 | passwd | testCryptoKit.swift:91:36:91:41 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:91:36:91:41 | passwd | password (passwd) | +| testCryptoKit.swift:91:36:91:41 | passwd | testCryptoKit.swift:91:36:91:41 | passwd | testCryptoKit.swift:91:36:91:41 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:91:36:91:41 | passwd | password (passwd) | +| testCryptoKit.swift:91:36:91:41 | passwd | testCryptoKit.swift:91:36:91:41 | passwd | testCryptoKit.swift:91:36:91:41 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:91:36:91:41 | passwd | password (passwd) | +| testCryptoKit.swift:91:36:91:41 | passwd | testCryptoKit.swift:91:36:91:41 | passwd | testCryptoKit.swift:91:36:91:41 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:91:36:91:41 | passwd | password (passwd) | +| testCryptoKit.swift:92:45:92:50 | passwd | testCryptoKit.swift:92:45:92:50 | passwd | testCryptoKit.swift:92:45:92:50 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:92:45:92:50 | passwd | password (passwd) | +| testCryptoKit.swift:92:45:92:50 | passwd | testCryptoKit.swift:92:45:92:50 | passwd | testCryptoKit.swift:92:45:92:50 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:92:45:92:50 | passwd | password (passwd) | +| testCryptoKit.swift:92:45:92:50 | passwd | testCryptoKit.swift:92:45:92:50 | passwd | testCryptoKit.swift:92:45:92:50 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:92:45:92:50 | passwd | password (passwd) | +| testCryptoKit.swift:92:45:92:50 | passwd | testCryptoKit.swift:92:45:92:50 | passwd | testCryptoKit.swift:92:45:92:50 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:92:45:92:50 | passwd | password (passwd) | +| testCryptoKit.swift:92:45:92:50 | passwd | testCryptoKit.swift:92:45:92:50 | passwd | testCryptoKit.swift:92:45:92:50 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:92:45:92:50 | passwd | password (passwd) | +| testCryptoKit.swift:98:44:98:49 | passwd | testCryptoKit.swift:98:44:98:49 | passwd | testCryptoKit.swift:98:44:98:49 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:98:44:98:49 | passwd | password (passwd) | +| testCryptoKit.swift:98:44:98:49 | passwd | testCryptoKit.swift:98:44:98:49 | passwd | testCryptoKit.swift:98:44:98:49 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:98:44:98:49 | passwd | password (passwd) | +| testCryptoKit.swift:98:44:98:49 | passwd | testCryptoKit.swift:98:44:98:49 | passwd | testCryptoKit.swift:98:44:98:49 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:98:44:98:49 | passwd | password (passwd) | +| testCryptoKit.swift:98:44:98:49 | passwd | testCryptoKit.swift:98:44:98:49 | passwd | testCryptoKit.swift:98:44:98:49 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:98:44:98:49 | passwd | password (passwd) | +| testCryptoKit.swift:98:44:98:49 | passwd | testCryptoKit.swift:98:44:98:49 | passwd | testCryptoKit.swift:98:44:98:49 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:98:44:98:49 | passwd | password (passwd) | +| testCryptoKit.swift:99:53:99:58 | passwd | testCryptoKit.swift:99:53:99:58 | passwd | testCryptoKit.swift:99:53:99:58 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:99:53:99:58 | passwd | password (passwd) | +| testCryptoKit.swift:99:53:99:58 | passwd | testCryptoKit.swift:99:53:99:58 | passwd | testCryptoKit.swift:99:53:99:58 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:99:53:99:58 | passwd | password (passwd) | +| testCryptoKit.swift:99:53:99:58 | passwd | testCryptoKit.swift:99:53:99:58 | passwd | testCryptoKit.swift:99:53:99:58 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:99:53:99:58 | passwd | password (passwd) | +| testCryptoKit.swift:99:53:99:58 | passwd | testCryptoKit.swift:99:53:99:58 | passwd | testCryptoKit.swift:99:53:99:58 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:99:53:99:58 | passwd | password (passwd) | +| testCryptoKit.swift:99:53:99:58 | passwd | testCryptoKit.swift:99:53:99:58 | passwd | testCryptoKit.swift:99:53:99:58 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:99:53:99:58 | passwd | password (passwd) | +| testCryptoKit.swift:105:37:105:42 | passwd | testCryptoKit.swift:105:37:105:42 | passwd | testCryptoKit.swift:105:37:105:42 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:105:37:105:42 | passwd | password (passwd) | +| testCryptoKit.swift:105:37:105:42 | passwd | testCryptoKit.swift:105:37:105:42 | passwd | testCryptoKit.swift:105:37:105:42 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:105:37:105:42 | passwd | password (passwd) | +| testCryptoKit.swift:105:37:105:42 | passwd | testCryptoKit.swift:105:37:105:42 | passwd | testCryptoKit.swift:105:37:105:42 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:105:37:105:42 | passwd | password (passwd) | +| testCryptoKit.swift:105:37:105:42 | passwd | testCryptoKit.swift:105:37:105:42 | passwd | testCryptoKit.swift:105:37:105:42 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:105:37:105:42 | passwd | password (passwd) | +| testCryptoKit.swift:105:37:105:42 | passwd | testCryptoKit.swift:105:37:105:42 | passwd | testCryptoKit.swift:105:37:105:42 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:105:37:105:42 | passwd | password (passwd) | +| testCryptoKit.swift:106:46:106:51 | passwd | testCryptoKit.swift:106:46:106:51 | passwd | testCryptoKit.swift:106:46:106:51 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:106:46:106:51 | passwd | password (passwd) | +| testCryptoKit.swift:106:46:106:51 | passwd | testCryptoKit.swift:106:46:106:51 | passwd | testCryptoKit.swift:106:46:106:51 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:106:46:106:51 | passwd | password (passwd) | +| testCryptoKit.swift:106:46:106:51 | passwd | testCryptoKit.swift:106:46:106:51 | passwd | testCryptoKit.swift:106:46:106:51 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:106:46:106:51 | passwd | password (passwd) | +| testCryptoKit.swift:106:46:106:51 | passwd | testCryptoKit.swift:106:46:106:51 | passwd | testCryptoKit.swift:106:46:106:51 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:106:46:106:51 | passwd | password (passwd) | +| testCryptoKit.swift:106:46:106:51 | passwd | testCryptoKit.swift:106:46:106:51 | passwd | testCryptoKit.swift:106:46:106:51 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:106:46:106:51 | passwd | password (passwd) | +| testCryptoKit.swift:112:37:112:42 | passwd | testCryptoKit.swift:112:37:112:42 | passwd | testCryptoKit.swift:112:37:112:42 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:112:37:112:42 | passwd | password (passwd) | +| testCryptoKit.swift:112:37:112:42 | passwd | testCryptoKit.swift:112:37:112:42 | passwd | testCryptoKit.swift:112:37:112:42 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:112:37:112:42 | passwd | password (passwd) | +| testCryptoKit.swift:112:37:112:42 | passwd | testCryptoKit.swift:112:37:112:42 | passwd | testCryptoKit.swift:112:37:112:42 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:112:37:112:42 | passwd | password (passwd) | +| testCryptoKit.swift:112:37:112:42 | passwd | testCryptoKit.swift:112:37:112:42 | passwd | testCryptoKit.swift:112:37:112:42 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:112:37:112:42 | passwd | password (passwd) | +| testCryptoKit.swift:112:37:112:42 | passwd | testCryptoKit.swift:112:37:112:42 | passwd | testCryptoKit.swift:112:37:112:42 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:112:37:112:42 | passwd | password (passwd) | +| testCryptoKit.swift:113:46:113:51 | passwd | testCryptoKit.swift:113:46:113:51 | passwd | testCryptoKit.swift:113:46:113:51 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:113:46:113:51 | passwd | password (passwd) | +| testCryptoKit.swift:113:46:113:51 | passwd | testCryptoKit.swift:113:46:113:51 | passwd | testCryptoKit.swift:113:46:113:51 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:113:46:113:51 | passwd | password (passwd) | +| testCryptoKit.swift:113:46:113:51 | passwd | testCryptoKit.swift:113:46:113:51 | passwd | testCryptoKit.swift:113:46:113:51 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:113:46:113:51 | passwd | password (passwd) | +| testCryptoKit.swift:113:46:113:51 | passwd | testCryptoKit.swift:113:46:113:51 | passwd | testCryptoKit.swift:113:46:113:51 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:113:46:113:51 | passwd | password (passwd) | +| testCryptoKit.swift:113:46:113:51 | passwd | testCryptoKit.swift:113:46:113:51 | passwd | testCryptoKit.swift:113:46:113:51 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:113:46:113:51 | passwd | password (passwd) | +| testCryptoKit.swift:119:37:119:42 | passwd | testCryptoKit.swift:119:37:119:42 | passwd | testCryptoKit.swift:119:37:119:42 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:119:37:119:42 | passwd | password (passwd) | +| testCryptoKit.swift:119:37:119:42 | passwd | testCryptoKit.swift:119:37:119:42 | passwd | testCryptoKit.swift:119:37:119:42 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:119:37:119:42 | passwd | password (passwd) | +| testCryptoKit.swift:119:37:119:42 | passwd | testCryptoKit.swift:119:37:119:42 | passwd | testCryptoKit.swift:119:37:119:42 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:119:37:119:42 | passwd | password (passwd) | +| testCryptoKit.swift:119:37:119:42 | passwd | testCryptoKit.swift:119:37:119:42 | passwd | testCryptoKit.swift:119:37:119:42 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:119:37:119:42 | passwd | password (passwd) | +| testCryptoKit.swift:119:37:119:42 | passwd | testCryptoKit.swift:119:37:119:42 | passwd | testCryptoKit.swift:119:37:119:42 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:119:37:119:42 | passwd | password (passwd) | +| testCryptoKit.swift:120:46:120:51 | passwd | testCryptoKit.swift:120:46:120:51 | passwd | testCryptoKit.swift:120:46:120:51 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:120:46:120:51 | passwd | password (passwd) | +| testCryptoKit.swift:120:46:120:51 | passwd | testCryptoKit.swift:120:46:120:51 | passwd | testCryptoKit.swift:120:46:120:51 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:120:46:120:51 | passwd | password (passwd) | +| testCryptoKit.swift:120:46:120:51 | passwd | testCryptoKit.swift:120:46:120:51 | passwd | testCryptoKit.swift:120:46:120:51 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:120:46:120:51 | passwd | password (passwd) | +| testCryptoKit.swift:120:46:120:51 | passwd | testCryptoKit.swift:120:46:120:51 | passwd | testCryptoKit.swift:120:46:120:51 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:120:46:120:51 | passwd | password (passwd) | +| testCryptoKit.swift:120:46:120:51 | passwd | testCryptoKit.swift:120:46:120:51 | passwd | testCryptoKit.swift:120:46:120:51 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:120:46:120:51 | passwd | password (passwd) | +| testCryptoKit.swift:129:23:129:28 | passwd | testCryptoKit.swift:129:23:129:28 | passwd | testCryptoKit.swift:129:23:129:28 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:129:23:129:28 | passwd | password (passwd) | +| testCryptoKit.swift:129:23:129:28 | passwd | testCryptoKit.swift:129:23:129:28 | passwd | testCryptoKit.swift:129:23:129:28 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:129:23:129:28 | passwd | password (passwd) | +| testCryptoKit.swift:129:23:129:28 | passwd | testCryptoKit.swift:129:23:129:28 | passwd | testCryptoKit.swift:129:23:129:28 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:129:23:129:28 | passwd | password (passwd) | +| testCryptoKit.swift:129:23:129:28 | passwd | testCryptoKit.swift:129:23:129:28 | passwd | testCryptoKit.swift:129:23:129:28 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:129:23:129:28 | passwd | password (passwd) | +| testCryptoKit.swift:129:23:129:28 | passwd | testCryptoKit.swift:129:23:129:28 | passwd | testCryptoKit.swift:129:23:129:28 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:129:23:129:28 | passwd | password (passwd) | +| testCryptoKit.swift:138:23:138:28 | passwd | testCryptoKit.swift:138:23:138:28 | passwd | testCryptoKit.swift:138:23:138:28 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:138:23:138:28 | passwd | password (passwd) | +| testCryptoKit.swift:138:23:138:28 | passwd | testCryptoKit.swift:138:23:138:28 | passwd | testCryptoKit.swift:138:23:138:28 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:138:23:138:28 | passwd | password (passwd) | +| testCryptoKit.swift:138:23:138:28 | passwd | testCryptoKit.swift:138:23:138:28 | passwd | testCryptoKit.swift:138:23:138:28 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:138:23:138:28 | passwd | password (passwd) | +| testCryptoKit.swift:138:23:138:28 | passwd | testCryptoKit.swift:138:23:138:28 | passwd | testCryptoKit.swift:138:23:138:28 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:138:23:138:28 | passwd | password (passwd) | +| testCryptoKit.swift:138:23:138:28 | passwd | testCryptoKit.swift:138:23:138:28 | passwd | testCryptoKit.swift:138:23:138:28 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:138:23:138:28 | passwd | password (passwd) | +| testCryptoKit.swift:147:23:147:28 | passwd | testCryptoKit.swift:147:23:147:28 | passwd | testCryptoKit.swift:147:23:147:28 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:147:23:147:28 | passwd | password (passwd) | +| testCryptoKit.swift:147:23:147:28 | passwd | testCryptoKit.swift:147:23:147:28 | passwd | testCryptoKit.swift:147:23:147:28 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:147:23:147:28 | passwd | password (passwd) | +| testCryptoKit.swift:147:23:147:28 | passwd | testCryptoKit.swift:147:23:147:28 | passwd | testCryptoKit.swift:147:23:147:28 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:147:23:147:28 | passwd | password (passwd) | +| testCryptoKit.swift:147:23:147:28 | passwd | testCryptoKit.swift:147:23:147:28 | passwd | testCryptoKit.swift:147:23:147:28 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:147:23:147:28 | passwd | password (passwd) | +| testCryptoKit.swift:147:23:147:28 | passwd | testCryptoKit.swift:147:23:147:28 | passwd | testCryptoKit.swift:147:23:147:28 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:147:23:147:28 | passwd | password (passwd) | +| testCryptoKit.swift:156:23:156:28 | passwd | testCryptoKit.swift:156:23:156:28 | passwd | testCryptoKit.swift:156:23:156:28 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:156:23:156:28 | passwd | password (passwd) | +| testCryptoKit.swift:156:23:156:28 | passwd | testCryptoKit.swift:156:23:156:28 | passwd | testCryptoKit.swift:156:23:156:28 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:156:23:156:28 | passwd | password (passwd) | +| testCryptoKit.swift:156:23:156:28 | passwd | testCryptoKit.swift:156:23:156:28 | passwd | testCryptoKit.swift:156:23:156:28 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:156:23:156:28 | passwd | password (passwd) | +| testCryptoKit.swift:156:23:156:28 | passwd | testCryptoKit.swift:156:23:156:28 | passwd | testCryptoKit.swift:156:23:156:28 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:156:23:156:28 | passwd | password (passwd) | +| testCryptoKit.swift:156:23:156:28 | passwd | testCryptoKit.swift:156:23:156:28 | passwd | testCryptoKit.swift:156:23:156:28 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:156:23:156:28 | passwd | password (passwd) | +| testCryptoKit.swift:165:23:165:28 | passwd | testCryptoKit.swift:165:23:165:28 | passwd | testCryptoKit.swift:165:23:165:28 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:165:23:165:28 | passwd | password (passwd) | +| testCryptoKit.swift:165:23:165:28 | passwd | testCryptoKit.swift:165:23:165:28 | passwd | testCryptoKit.swift:165:23:165:28 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:165:23:165:28 | passwd | password (passwd) | +| testCryptoKit.swift:165:23:165:28 | passwd | testCryptoKit.swift:165:23:165:28 | passwd | testCryptoKit.swift:165:23:165:28 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:165:23:165:28 | passwd | password (passwd) | +| testCryptoKit.swift:165:23:165:28 | passwd | testCryptoKit.swift:165:23:165:28 | passwd | testCryptoKit.swift:165:23:165:28 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:165:23:165:28 | passwd | password (passwd) | +| testCryptoKit.swift:165:23:165:28 | passwd | testCryptoKit.swift:165:23:165:28 | passwd | testCryptoKit.swift:165:23:165:28 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:165:23:165:28 | passwd | password (passwd) | +| testCryptoKit.swift:174:32:174:37 | passwd | testCryptoKit.swift:174:32:174:37 | passwd | testCryptoKit.swift:174:32:174:37 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:174:32:174:37 | passwd | password (passwd) | +| testCryptoKit.swift:174:32:174:37 | passwd | testCryptoKit.swift:174:32:174:37 | passwd | testCryptoKit.swift:174:32:174:37 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:174:32:174:37 | passwd | password (passwd) | +| testCryptoKit.swift:174:32:174:37 | passwd | testCryptoKit.swift:174:32:174:37 | passwd | testCryptoKit.swift:174:32:174:37 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:174:32:174:37 | passwd | password (passwd) | +| testCryptoKit.swift:174:32:174:37 | passwd | testCryptoKit.swift:174:32:174:37 | passwd | testCryptoKit.swift:174:32:174:37 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:174:32:174:37 | passwd | password (passwd) | +| testCryptoKit.swift:174:32:174:37 | passwd | testCryptoKit.swift:174:32:174:37 | passwd | testCryptoKit.swift:174:32:174:37 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:174:32:174:37 | passwd | password (passwd) | +| testCryptoKit.swift:183:32:183:37 | passwd | testCryptoKit.swift:183:32:183:37 | passwd | testCryptoKit.swift:183:32:183:37 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:183:32:183:37 | passwd | password (passwd) | +| testCryptoKit.swift:183:32:183:37 | passwd | testCryptoKit.swift:183:32:183:37 | passwd | testCryptoKit.swift:183:32:183:37 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:183:32:183:37 | passwd | password (passwd) | +| testCryptoKit.swift:183:32:183:37 | passwd | testCryptoKit.swift:183:32:183:37 | passwd | testCryptoKit.swift:183:32:183:37 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:183:32:183:37 | passwd | password (passwd) | +| testCryptoKit.swift:183:32:183:37 | passwd | testCryptoKit.swift:183:32:183:37 | passwd | testCryptoKit.swift:183:32:183:37 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:183:32:183:37 | passwd | password (passwd) | +| testCryptoKit.swift:183:32:183:37 | passwd | testCryptoKit.swift:183:32:183:37 | passwd | testCryptoKit.swift:183:32:183:37 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:183:32:183:37 | passwd | password (passwd) | +| testCryptoKit.swift:192:32:192:37 | passwd | testCryptoKit.swift:192:32:192:37 | passwd | testCryptoKit.swift:192:32:192:37 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:192:32:192:37 | passwd | password (passwd) | +| testCryptoKit.swift:192:32:192:37 | passwd | testCryptoKit.swift:192:32:192:37 | passwd | testCryptoKit.swift:192:32:192:37 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:192:32:192:37 | passwd | password (passwd) | +| testCryptoKit.swift:192:32:192:37 | passwd | testCryptoKit.swift:192:32:192:37 | passwd | testCryptoKit.swift:192:32:192:37 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:192:32:192:37 | passwd | password (passwd) | +| testCryptoKit.swift:192:32:192:37 | passwd | testCryptoKit.swift:192:32:192:37 | passwd | testCryptoKit.swift:192:32:192:37 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:192:32:192:37 | passwd | password (passwd) | +| testCryptoKit.swift:192:32:192:37 | passwd | testCryptoKit.swift:192:32:192:37 | passwd | testCryptoKit.swift:192:32:192:37 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:192:32:192:37 | passwd | password (passwd) | +| testCryptoKit.swift:201:32:201:37 | passwd | testCryptoKit.swift:201:32:201:37 | passwd | testCryptoKit.swift:201:32:201:37 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:201:32:201:37 | passwd | password (passwd) | +| testCryptoKit.swift:201:32:201:37 | passwd | testCryptoKit.swift:201:32:201:37 | passwd | testCryptoKit.swift:201:32:201:37 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:201:32:201:37 | passwd | password (passwd) | +| testCryptoKit.swift:201:32:201:37 | passwd | testCryptoKit.swift:201:32:201:37 | passwd | testCryptoKit.swift:201:32:201:37 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:201:32:201:37 | passwd | password (passwd) | +| testCryptoKit.swift:201:32:201:37 | passwd | testCryptoKit.swift:201:32:201:37 | passwd | testCryptoKit.swift:201:32:201:37 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:201:32:201:37 | passwd | password (passwd) | +| testCryptoKit.swift:201:32:201:37 | passwd | testCryptoKit.swift:201:32:201:37 | passwd | testCryptoKit.swift:201:32:201:37 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:201:32:201:37 | passwd | password (passwd) | +| testCryptoKit.swift:210:32:210:37 | passwd | testCryptoKit.swift:210:32:210:37 | passwd | testCryptoKit.swift:210:32:210:37 | passwd | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:210:32:210:37 | passwd | password (passwd) | +| testCryptoKit.swift:210:32:210:37 | passwd | testCryptoKit.swift:210:32:210:37 | passwd | testCryptoKit.swift:210:32:210:37 | passwd | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:210:32:210:37 | passwd | password (passwd) | +| testCryptoKit.swift:210:32:210:37 | passwd | testCryptoKit.swift:210:32:210:37 | passwd | testCryptoKit.swift:210:32:210:37 | passwd | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:210:32:210:37 | passwd | password (passwd) | +| testCryptoKit.swift:210:32:210:37 | passwd | testCryptoKit.swift:210:32:210:37 | passwd | testCryptoKit.swift:210:32:210:37 | passwd | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:210:32:210:37 | passwd | password (passwd) | +| testCryptoKit.swift:210:32:210:37 | passwd | testCryptoKit.swift:210:32:210:37 | passwd | testCryptoKit.swift:210:32:210:37 | passwd | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:210:32:210:37 | passwd | password (passwd) | +| testCryptoKit.swift:220:49:220:60 | passwordData | testCryptoKit.swift:220:49:220:60 | passwordData | testCryptoKit.swift:220:49:220:60 | passwordData | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:220:49:220:60 | passwordData | password (passwordData) | +| testCryptoKit.swift:220:49:220:60 | passwordData | testCryptoKit.swift:220:49:220:60 | passwordData | testCryptoKit.swift:220:49:220:60 | passwordData | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:220:49:220:60 | passwordData | password (passwordData) | +| testCryptoKit.swift:220:49:220:60 | passwordData | testCryptoKit.swift:220:49:220:60 | passwordData | testCryptoKit.swift:220:49:220:60 | passwordData | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:220:49:220:60 | passwordData | password (passwordData) | +| testCryptoKit.swift:220:49:220:60 | passwordData | testCryptoKit.swift:220:49:220:60 | passwordData | testCryptoKit.swift:220:49:220:60 | passwordData | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:220:49:220:60 | passwordData | password (passwordData) | +| testCryptoKit.swift:220:49:220:60 | passwordData | testCryptoKit.swift:220:49:220:60 | passwordData | testCryptoKit.swift:220:49:220:60 | passwordData | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:220:49:220:60 | passwordData | password (passwordData) | +| testCryptoKit.swift:224:33:224:57 | Data(...) | testCryptoKit.swift:224:38:224:51 | passwordString | testCryptoKit.swift:224:33:224:57 | Data(...) | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:224:38:224:51 | passwordString | password (passwordString) | +| testCryptoKit.swift:224:33:224:57 | Data(...) | testCryptoKit.swift:224:38:224:51 | passwordString | testCryptoKit.swift:224:33:224:57 | Data(...) | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:224:38:224:51 | passwordString | password (passwordString) | +| testCryptoKit.swift:224:33:224:57 | Data(...) | testCryptoKit.swift:224:38:224:51 | passwordString | testCryptoKit.swift:224:33:224:57 | Data(...) | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:224:38:224:51 | passwordString | password (passwordString) | +| testCryptoKit.swift:224:33:224:57 | Data(...) | testCryptoKit.swift:224:38:224:51 | passwordString | testCryptoKit.swift:224:33:224:57 | Data(...) | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:224:38:224:51 | passwordString | password (passwordString) | +| testCryptoKit.swift:224:33:224:57 | Data(...) | testCryptoKit.swift:224:38:224:51 | passwordString | testCryptoKit.swift:224:33:224:57 | Data(...) | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:224:38:224:51 | passwordString | password (passwordString) | +| testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:154:30:154:40 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:154:30:154:40 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:154:30:154:40 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:157:31:157:41 | passwdArray | testCryptoSwift.swift:157:31:157:41 | passwdArray | testCryptoSwift.swift:157:31:157:41 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:157:31:157:41 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:157:31:157:41 | passwdArray | testCryptoSwift.swift:157:31:157:41 | passwdArray | testCryptoSwift.swift:157:31:157:41 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:157:31:157:41 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:157:31:157:41 | passwdArray | testCryptoSwift.swift:157:31:157:41 | passwdArray | testCryptoSwift.swift:157:31:157:41 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:157:31:157:41 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:160:47:160:57 | passwdArray | testCryptoSwift.swift:160:47:160:57 | passwdArray | testCryptoSwift.swift:160:47:160:57 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:160:47:160:57 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:160:47:160:57 | passwdArray | testCryptoSwift.swift:160:47:160:57 | passwdArray | testCryptoSwift.swift:160:47:160:57 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:160:47:160:57 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:160:47:160:57 | passwdArray | testCryptoSwift.swift:160:47:160:57 | passwdArray | testCryptoSwift.swift:160:47:160:57 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:160:47:160:57 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:163:47:163:57 | passwdArray | testCryptoSwift.swift:163:47:163:57 | passwdArray | testCryptoSwift.swift:163:47:163:57 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:163:47:163:57 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:163:47:163:57 | passwdArray | testCryptoSwift.swift:163:47:163:57 | passwdArray | testCryptoSwift.swift:163:47:163:57 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:163:47:163:57 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:163:47:163:57 | passwdArray | testCryptoSwift.swift:163:47:163:57 | passwdArray | testCryptoSwift.swift:163:47:163:57 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:163:47:163:57 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:167:20:167:30 | passwdArray | testCryptoSwift.swift:167:20:167:30 | passwdArray | testCryptoSwift.swift:167:20:167:30 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:167:20:167:30 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:170:21:170:31 | passwdArray | testCryptoSwift.swift:170:21:170:31 | passwdArray | testCryptoSwift.swift:170:21:170:31 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:170:21:170:31 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:173:23:173:33 | passwdArray | testCryptoSwift.swift:173:23:173:33 | passwdArray | testCryptoSwift.swift:173:23:173:33 | passwdArray | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoSwift.swift:173:23:173:33 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:176:21:176:31 | passwdArray | testCryptoSwift.swift:176:21:176:31 | passwdArray | testCryptoSwift.swift:176:21:176:31 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:176:21:176:31 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:179:21:179:31 | passwdArray | testCryptoSwift.swift:179:21:179:31 | passwdArray | testCryptoSwift.swift:179:21:179:31 | passwdArray | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:179:21:179:31 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:183:9:183:25 | [self arg] ... .md5(...) | testCryptoSwift.swift:183:9:183:19 | passwdArray | testCryptoSwift.swift:183:9:183:25 | [self arg] ... .md5(...) | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:183:9:183:19 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:186:9:186:26 | [self arg] ... .sha1(...) | testCryptoSwift.swift:186:9:186:19 | passwdArray | testCryptoSwift.swift:186:9:186:26 | [self arg] ... .sha1(...) | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:186:9:186:19 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:189:9:189:28 | [self arg] ... .sha512(...) | testCryptoSwift.swift:189:9:189:19 | passwdArray | testCryptoSwift.swift:189:9:189:28 | [self arg] ... .sha512(...) | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoSwift.swift:189:9:189:19 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:192:9:192:33 | [self arg] ... .sha2(...) | testCryptoSwift.swift:192:9:192:19 | passwdArray | testCryptoSwift.swift:192:9:192:33 | [self arg] ... .sha2(...) | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:192:9:192:19 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:195:9:195:33 | [self arg] ... .sha3(...) | testCryptoSwift.swift:195:9:195:19 | passwdArray | testCryptoSwift.swift:195:9:195:33 | [self arg] ... .sha3(...) | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:195:9:195:19 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:201:9:201:24 | [self arg] ... .md5(...) | testCryptoSwift.swift:201:9:201:18 | passwdData | testCryptoSwift.swift:201:9:201:24 | [self arg] ... .md5(...) | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:201:9:201:18 | passwdData | password (passwdData) | +| testCryptoSwift.swift:204:9:204:25 | [self arg] ... .sha1(...) | testCryptoSwift.swift:204:9:204:18 | passwdData | testCryptoSwift.swift:204:9:204:25 | [self arg] ... .sha1(...) | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:204:9:204:18 | passwdData | password (passwdData) | +| testCryptoSwift.swift:207:9:207:27 | [self arg] ... .sha512(...) | testCryptoSwift.swift:207:9:207:18 | passwdData | testCryptoSwift.swift:207:9:207:27 | [self arg] ... .sha512(...) | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoSwift.swift:207:9:207:18 | passwdData | password (passwdData) | +| testCryptoSwift.swift:210:9:210:32 | [self arg] ... .sha2(...) | testCryptoSwift.swift:210:9:210:18 | passwdData | testCryptoSwift.swift:210:9:210:32 | [self arg] ... .sha2(...) | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:210:9:210:18 | passwdData | password (passwdData) | +| testCryptoSwift.swift:213:9:213:32 | [self arg] ... .sha3(...) | testCryptoSwift.swift:213:9:213:18 | passwdData | testCryptoSwift.swift:213:9:213:32 | [self arg] ... .sha3(...) | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:213:9:213:18 | passwdData | password (passwdData) | +| testCryptoSwift.swift:219:9:219:20 | [self arg] ... .md5(...) | testCryptoSwift.swift:219:9:219:14 | passwd | testCryptoSwift.swift:219:9:219:20 | [self arg] ... .md5(...) | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:219:9:219:14 | passwd | password (passwd) | +| testCryptoSwift.swift:222:9:222:21 | [self arg] ... .sha1(...) | testCryptoSwift.swift:222:9:222:14 | passwd | testCryptoSwift.swift:222:9:222:21 | [self arg] ... .sha1(...) | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:222:9:222:14 | passwd | password (passwd) | +| testCryptoSwift.swift:225:9:225:23 | [self arg] ... .sha512(...) | testCryptoSwift.swift:225:9:225:14 | passwd | testCryptoSwift.swift:225:9:225:23 | [self arg] ... .sha512(...) | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoSwift.swift:225:9:225:14 | passwd | password (passwd) | +| testCryptoSwift.swift:228:9:228:28 | [self arg] ... .sha2(...) | testCryptoSwift.swift:228:9:228:14 | passwd | testCryptoSwift.swift:228:9:228:28 | [self arg] ... .sha2(...) | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:228:9:228:14 | passwd | password (passwd) | +| testCryptoSwift.swift:231:9:231:28 | [self arg] ... .sha3(...) | testCryptoSwift.swift:231:9:231:14 | passwd | testCryptoSwift.swift:231:9:231:28 | [self arg] ... .sha3(...) | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:231:9:231:14 | passwd | password (passwd) | edges -| testCryptoKit.swift:224:38:224:38 | passwordString | testCryptoKit.swift:224:38:224:53 | .utf8 | provenance | | -| testCryptoKit.swift:224:38:224:53 | .utf8 | testCryptoKit.swift:224:33:224:57 | call to Data.init(_:) | provenance | | +| testCryptoKit.swift:224:38:224:51 | passwordString | testCryptoKit.swift:224:38:224:56 | ... .utf8 | provenance | | +| testCryptoKit.swift:224:38:224:56 | ... .utf8 | testCryptoKit.swift:224:33:224:57 | Data(...) | provenance | | +| testCryptoSwift.swift:183:9:183:19 | passwdArray | testCryptoSwift.swift:183:9:183:25 | [self arg] ... .md5(...) | provenance | | +| testCryptoSwift.swift:186:9:186:19 | passwdArray | testCryptoSwift.swift:186:9:186:26 | [self arg] ... .sha1(...) | provenance | | +| testCryptoSwift.swift:189:9:189:19 | passwdArray | testCryptoSwift.swift:189:9:189:28 | [self arg] ... .sha512(...) | provenance | | +| testCryptoSwift.swift:192:9:192:19 | passwdArray | testCryptoSwift.swift:192:9:192:33 | [self arg] ... .sha2(...) | provenance | | +| testCryptoSwift.swift:195:9:195:19 | passwdArray | testCryptoSwift.swift:195:9:195:33 | [self arg] ... .sha3(...) | provenance | | +| testCryptoSwift.swift:201:9:201:18 | passwdData | testCryptoSwift.swift:201:9:201:24 | [self arg] ... .md5(...) | provenance | | +| testCryptoSwift.swift:204:9:204:18 | passwdData | testCryptoSwift.swift:204:9:204:25 | [self arg] ... .sha1(...) | provenance | | +| testCryptoSwift.swift:207:9:207:18 | passwdData | testCryptoSwift.swift:207:9:207:27 | [self arg] ... .sha512(...) | provenance | | +| testCryptoSwift.swift:210:9:210:18 | passwdData | testCryptoSwift.swift:210:9:210:32 | [self arg] ... .sha2(...) | provenance | | +| testCryptoSwift.swift:213:9:213:18 | passwdData | testCryptoSwift.swift:213:9:213:32 | [self arg] ... .sha3(...) | provenance | | +| testCryptoSwift.swift:219:9:219:14 | passwd | testCryptoSwift.swift:219:9:219:20 | [self arg] ... .md5(...) | provenance | | +| testCryptoSwift.swift:222:9:222:14 | passwd | testCryptoSwift.swift:222:9:222:21 | [self arg] ... .sha1(...) | provenance | | +| testCryptoSwift.swift:225:9:225:14 | passwd | testCryptoSwift.swift:225:9:225:23 | [self arg] ... .sha512(...) | provenance | | +| testCryptoSwift.swift:228:9:228:14 | passwd | testCryptoSwift.swift:228:9:228:28 | [self arg] ... .sha2(...) | provenance | | +| testCryptoSwift.swift:231:9:231:14 | passwd | testCryptoSwift.swift:231:9:231:28 | [self arg] ... .sha3(...) | provenance | | nodes -| testCryptoKit.swift:84:47:84:47 | passwd | semmle.label | passwd | -| testCryptoKit.swift:85:52:85:52 | passwd | semmle.label | passwd | -| testCryptoKit.swift:91:36:91:36 | passwd | semmle.label | passwd | -| testCryptoKit.swift:92:45:92:45 | passwd | semmle.label | passwd | -| testCryptoKit.swift:98:44:98:44 | passwd | semmle.label | passwd | -| testCryptoKit.swift:99:53:99:53 | passwd | semmle.label | passwd | -| testCryptoKit.swift:105:37:105:37 | passwd | semmle.label | passwd | -| testCryptoKit.swift:106:46:106:46 | passwd | semmle.label | passwd | -| testCryptoKit.swift:112:37:112:37 | passwd | semmle.label | passwd | -| testCryptoKit.swift:113:46:113:46 | passwd | semmle.label | passwd | -| testCryptoKit.swift:119:37:119:37 | passwd | semmle.label | passwd | -| testCryptoKit.swift:120:46:120:46 | passwd | semmle.label | passwd | -| testCryptoKit.swift:129:23:129:23 | passwd | semmle.label | passwd | -| testCryptoKit.swift:138:23:138:23 | passwd | semmle.label | passwd | -| testCryptoKit.swift:147:23:147:23 | passwd | semmle.label | passwd | -| testCryptoKit.swift:156:23:156:23 | passwd | semmle.label | passwd | -| testCryptoKit.swift:165:23:165:23 | passwd | semmle.label | passwd | -| testCryptoKit.swift:174:32:174:32 | passwd | semmle.label | passwd | -| testCryptoKit.swift:183:32:183:32 | passwd | semmle.label | passwd | -| testCryptoKit.swift:192:32:192:32 | passwd | semmle.label | passwd | -| testCryptoKit.swift:201:32:201:32 | passwd | semmle.label | passwd | -| testCryptoKit.swift:210:32:210:32 | passwd | semmle.label | passwd | -| testCryptoKit.swift:220:49:220:49 | passwordData | semmle.label | passwordData | -| testCryptoKit.swift:224:33:224:57 | call to Data.init(_:) | semmle.label | call to Data.init(_:) | -| testCryptoKit.swift:224:38:224:38 | passwordString | semmle.label | passwordString | -| testCryptoKit.swift:224:38:224:53 | .utf8 | semmle.label | .utf8 | -| testCryptoSwift.swift:154:30:154:30 | passwdArray | semmle.label | passwdArray | -| testCryptoSwift.swift:157:31:157:31 | passwdArray | semmle.label | passwdArray | -| testCryptoSwift.swift:160:47:160:47 | passwdArray | semmle.label | passwdArray | -| testCryptoSwift.swift:163:47:163:47 | passwdArray | semmle.label | passwdArray | -| testCryptoSwift.swift:167:20:167:20 | passwdArray | semmle.label | passwdArray | -| testCryptoSwift.swift:170:21:170:21 | passwdArray | semmle.label | passwdArray | -| testCryptoSwift.swift:173:23:173:23 | passwdArray | semmle.label | passwdArray | -| testCryptoSwift.swift:176:21:176:21 | passwdArray | semmle.label | passwdArray | -| testCryptoSwift.swift:179:21:179:21 | passwdArray | semmle.label | passwdArray | -| testCryptoSwift.swift:183:9:183:9 | passwdArray | semmle.label | passwdArray | -| testCryptoSwift.swift:186:9:186:9 | passwdArray | semmle.label | passwdArray | -| testCryptoSwift.swift:189:9:189:9 | passwdArray | semmle.label | passwdArray | -| testCryptoSwift.swift:192:9:192:9 | passwdArray | semmle.label | passwdArray | -| testCryptoSwift.swift:195:9:195:9 | passwdArray | semmle.label | passwdArray | -| testCryptoSwift.swift:201:9:201:9 | passwdData | semmle.label | passwdData | -| testCryptoSwift.swift:204:9:204:9 | passwdData | semmle.label | passwdData | -| testCryptoSwift.swift:207:9:207:9 | passwdData | semmle.label | passwdData | -| testCryptoSwift.swift:210:9:210:9 | passwdData | semmle.label | passwdData | -| testCryptoSwift.swift:213:9:213:9 | passwdData | semmle.label | passwdData | -| testCryptoSwift.swift:219:9:219:9 | passwd | semmle.label | passwd | -| testCryptoSwift.swift:222:9:222:9 | passwd | semmle.label | passwd | -| testCryptoSwift.swift:225:9:225:9 | passwd | semmle.label | passwd | -| testCryptoSwift.swift:228:9:228:9 | passwd | semmle.label | passwd | -| testCryptoSwift.swift:231:9:231:9 | passwd | semmle.label | passwd | +| testCryptoKit.swift:84:47:84:52 | passwd | semmle.label | passwd | +| testCryptoKit.swift:85:52:85:57 | passwd | semmle.label | passwd | +| testCryptoKit.swift:91:36:91:41 | passwd | semmle.label | passwd | +| testCryptoKit.swift:92:45:92:50 | passwd | semmle.label | passwd | +| testCryptoKit.swift:98:44:98:49 | passwd | semmle.label | passwd | +| testCryptoKit.swift:99:53:99:58 | passwd | semmle.label | passwd | +| testCryptoKit.swift:105:37:105:42 | passwd | semmle.label | passwd | +| testCryptoKit.swift:106:46:106:51 | passwd | semmle.label | passwd | +| testCryptoKit.swift:112:37:112:42 | passwd | semmle.label | passwd | +| testCryptoKit.swift:113:46:113:51 | passwd | semmle.label | passwd | +| testCryptoKit.swift:119:37:119:42 | passwd | semmle.label | passwd | +| testCryptoKit.swift:120:46:120:51 | passwd | semmle.label | passwd | +| testCryptoKit.swift:129:23:129:28 | passwd | semmle.label | passwd | +| testCryptoKit.swift:138:23:138:28 | passwd | semmle.label | passwd | +| testCryptoKit.swift:147:23:147:28 | passwd | semmle.label | passwd | +| testCryptoKit.swift:156:23:156:28 | passwd | semmle.label | passwd | +| testCryptoKit.swift:165:23:165:28 | passwd | semmle.label | passwd | +| testCryptoKit.swift:174:32:174:37 | passwd | semmle.label | passwd | +| testCryptoKit.swift:183:32:183:37 | passwd | semmle.label | passwd | +| testCryptoKit.swift:192:32:192:37 | passwd | semmle.label | passwd | +| testCryptoKit.swift:201:32:201:37 | passwd | semmle.label | passwd | +| testCryptoKit.swift:210:32:210:37 | passwd | semmle.label | passwd | +| testCryptoKit.swift:220:49:220:60 | passwordData | semmle.label | passwordData | +| testCryptoKit.swift:224:33:224:57 | Data(...) | semmle.label | Data(...) | +| testCryptoKit.swift:224:38:224:51 | passwordString | semmle.label | passwordString | +| testCryptoKit.swift:224:38:224:56 | ... .utf8 | semmle.label | ... .utf8 | +| testCryptoSwift.swift:154:30:154:40 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:157:31:157:41 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:160:47:160:57 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:163:47:163:57 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:167:20:167:30 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:170:21:170:31 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:173:23:173:33 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:176:21:176:31 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:179:21:179:31 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:183:9:183:19 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:183:9:183:25 | [self arg] ... .md5(...) | semmle.label | [self arg] ... .md5(...) | +| testCryptoSwift.swift:186:9:186:19 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:186:9:186:26 | [self arg] ... .sha1(...) | semmle.label | [self arg] ... .sha1(...) | +| testCryptoSwift.swift:189:9:189:19 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:189:9:189:28 | [self arg] ... .sha512(...) | semmle.label | [self arg] ... .sha512(...) | +| testCryptoSwift.swift:192:9:192:19 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:192:9:192:33 | [self arg] ... .sha2(...) | semmle.label | [self arg] ... .sha2(...) | +| testCryptoSwift.swift:195:9:195:19 | passwdArray | semmle.label | passwdArray | +| testCryptoSwift.swift:195:9:195:33 | [self arg] ... .sha3(...) | semmle.label | [self arg] ... .sha3(...) | +| testCryptoSwift.swift:201:9:201:18 | passwdData | semmle.label | passwdData | +| testCryptoSwift.swift:201:9:201:24 | [self arg] ... .md5(...) | semmle.label | [self arg] ... .md5(...) | +| testCryptoSwift.swift:204:9:204:18 | passwdData | semmle.label | passwdData | +| testCryptoSwift.swift:204:9:204:25 | [self arg] ... .sha1(...) | semmle.label | [self arg] ... .sha1(...) | +| testCryptoSwift.swift:207:9:207:18 | passwdData | semmle.label | passwdData | +| testCryptoSwift.swift:207:9:207:27 | [self arg] ... .sha512(...) | semmle.label | [self arg] ... .sha512(...) | +| testCryptoSwift.swift:210:9:210:18 | passwdData | semmle.label | passwdData | +| testCryptoSwift.swift:210:9:210:32 | [self arg] ... .sha2(...) | semmle.label | [self arg] ... .sha2(...) | +| testCryptoSwift.swift:213:9:213:18 | passwdData | semmle.label | passwdData | +| testCryptoSwift.swift:213:9:213:32 | [self arg] ... .sha3(...) | semmle.label | [self arg] ... .sha3(...) | +| testCryptoSwift.swift:219:9:219:14 | passwd | semmle.label | passwd | +| testCryptoSwift.swift:219:9:219:20 | [self arg] ... .md5(...) | semmle.label | [self arg] ... .md5(...) | +| testCryptoSwift.swift:222:9:222:14 | passwd | semmle.label | passwd | +| testCryptoSwift.swift:222:9:222:21 | [self arg] ... .sha1(...) | semmle.label | [self arg] ... .sha1(...) | +| testCryptoSwift.swift:225:9:225:14 | passwd | semmle.label | passwd | +| testCryptoSwift.swift:225:9:225:23 | [self arg] ... .sha512(...) | semmle.label | [self arg] ... .sha512(...) | +| testCryptoSwift.swift:228:9:228:14 | passwd | semmle.label | passwd | +| testCryptoSwift.swift:228:9:228:28 | [self arg] ... .sha2(...) | semmle.label | [self arg] ... .sha2(...) | +| testCryptoSwift.swift:231:9:231:14 | passwd | semmle.label | passwd | +| testCryptoSwift.swift:231:9:231:28 | [self arg] ... .sha3(...) | semmle.label | [self arg] ... .sha3(...) | subpaths diff --git a/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.qlref b/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.qlref index 24744b4a4250..8648f309dcfb 100644 --- a/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.qlref +++ b/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.qlref @@ -1,2 +1,3 @@ -query: queries/Security/CWE-328/WeakPasswordHashing.ql -postprocess: utils/test/InlineExpectationsTestQuery.ql +query: queries/security/CWE-328/WeakPasswordHashing.ql +postprocess: + - utils/test/InlineExpectationsTestQuery.ql diff --git a/unified/ql/test/query-tests/security/CWE-328/testArgon2Swift.swift b/unified/ql/test/query-tests/security/CWE-328/testArgon2Swift.swift index e88fb5eb2c73..c0a02ef8b4e1 100644 --- a/unified/ql/test/query-tests/security/CWE-328/testArgon2Swift.swift +++ b/unified/ql/test/query-tests/security/CWE-328/testArgon2Swift.swift @@ -36,7 +36,7 @@ class Argon2Swift { // --- tests --- func testGoodExample(passwordString: String) { - // this is the "good" example from the .qhelp + // this is the "good" example from the `.qhelp` let salt = Salt.newSalt() let result = try! Argon2Swift.hashPasswordString(password: passwordString, salt: salt) // GOOD (suitable password hash) let passwordHash = result.encodedString() diff --git a/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift b/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift index d2faf8812248..6c9410276e35 100644 --- a/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift +++ b/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift @@ -81,166 +81,166 @@ enum Insecure { // --- tests --- func testHashMethods(passwd : UnsafeRawBufferPointer, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { - var hash = Crypto.Insecure.MD5.hash(data: passwd) // $ Alert[swift/weak-password-hashing] - hash = Crypto.Insecure.MD5.hash(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] - hash = Crypto.Insecure.MD5.hash(data: cert) // $ Alert[swift/weak-sensitive-data-hashing] - hash = Crypto.Insecure.MD5.hash(data: encrypted_passwd) // GOOD (not sensitive) - hash = Crypto.Insecure.MD5.hash(data: account_no) // $ Alert[swift/weak-sensitive-data-hashing] - hash = Crypto.Insecure.MD5.hash(data: credit_card_no) // $ Alert[swift/weak-sensitive-data-hashing] - - hash = Insecure.MD5.hash(data: passwd) // $ Alert[swift/weak-password-hashing] - hash = Insecure.MD5.hash(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] - hash = Insecure.MD5.hash(data: cert) // $ Alert[swift/weak-sensitive-data-hashing] - hash = Insecure.MD5.hash(data: encrypted_passwd) // GOOD (not sensitive) - hash = Insecure.MD5.hash(data: account_no) // $ Alert[swift/weak-sensitive-data-hashing] - hash = Insecure.MD5.hash(data: credit_card_no) // $ Alert[swift/weak-sensitive-data-hashing] - - hash = Crypto.Insecure.SHA1.hash(data: passwd) // $ Alert[swift/weak-password-hashing] - hash = Crypto.Insecure.SHA1.hash(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] - hash = Crypto.Insecure.SHA1.hash(data: cert) // $ Alert[swift/weak-sensitive-data-hashing] - hash = Crypto.Insecure.SHA1.hash(data: encrypted_passwd) // GOOD (not sensitive) - hash = Crypto.Insecure.SHA1.hash(data: account_no) // $ Alert[swift/weak-sensitive-data-hashing] - hash = Crypto.Insecure.SHA1.hash(data: credit_card_no) // $ Alert[swift/weak-sensitive-data-hashing] - - hash = Crypto.SHA256.hash(data: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash - hash = Crypto.SHA256.hash(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash - hash = Crypto.SHA256.hash(data: cert) // GOOD, computationally expensive hash not required - hash = Crypto.SHA256.hash(data: encrypted_passwd) // GOOD, not sensitive - hash = Crypto.SHA256.hash(data: account_no) // GOOD, computationally expensive hash not required - hash = Crypto.SHA256.hash(data: credit_card_no) // GOOD, computationally expensive hash not required - - hash = Crypto.SHA384.hash(data: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash - hash = Crypto.SHA384.hash(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash - hash = Crypto.SHA384.hash(data: cert) // GOOD, computationally expensive hash not required - hash = Crypto.SHA384.hash(data: encrypted_passwd) // GOOD, not sensitive - hash = Crypto.SHA384.hash(data: account_no) // GOOD, computationally expensive hash not required - hash = Crypto.SHA384.hash(data: credit_card_no) // GOOD, computationally expensive hash not required - - hash = Crypto.SHA512.hash(data: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash - hash = Crypto.SHA512.hash(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash - hash = Crypto.SHA512.hash(data: cert) // GOOD, computationally expensive hash not required - hash = Crypto.SHA512.hash(data: encrypted_passwd) // GOOD, not sensitive - hash = Crypto.SHA512.hash(data: account_no) // GOOD, computationally expensive hash not required - hash = Crypto.SHA512.hash(data: credit_card_no) // GOOD, computationally expensive hash not required + var hash = Crypto.Insecure.MD5.hash(data: passwd) // $ Alert[unified/swift/weak-password-hashing] + hash = Crypto.Insecure.MD5.hash(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] + hash = Crypto.Insecure.MD5.hash(data: cert) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash = Crypto.Insecure.MD5.hash(data: encrypted_passwd) // GOOD (not sensitive) + hash = Crypto.Insecure.MD5.hash(data: account_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash = Crypto.Insecure.MD5.hash(data: credit_card_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + + hash = Insecure.MD5.hash(data: passwd) // $ Alert[unified/swift/weak-password-hashing] + hash = Insecure.MD5.hash(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] + hash = Insecure.MD5.hash(data: cert) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash = Insecure.MD5.hash(data: encrypted_passwd) // GOOD (not sensitive) + hash = Insecure.MD5.hash(data: account_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash = Insecure.MD5.hash(data: credit_card_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + + hash = Crypto.Insecure.SHA1.hash(data: passwd) // $ Alert[unified/swift/weak-password-hashing] + hash = Crypto.Insecure.SHA1.hash(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] + hash = Crypto.Insecure.SHA1.hash(data: cert) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash = Crypto.Insecure.SHA1.hash(data: encrypted_passwd) // GOOD (not sensitive) + hash = Crypto.Insecure.SHA1.hash(data: account_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash = Crypto.Insecure.SHA1.hash(data: credit_card_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + + hash = Crypto.SHA256.hash(data: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) + hash = Crypto.SHA256.hash(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) + hash = Crypto.SHA256.hash(data: cert) // GOOD, computationally expensive hash not required + hash = Crypto.SHA256.hash(data: encrypted_passwd) // GOOD, not sensitive + hash = Crypto.SHA256.hash(data: account_no) // GOOD, computationally expensive hash not required + hash = Crypto.SHA256.hash(data: credit_card_no) // GOOD, computationally expensive hash not required + + hash = Crypto.SHA384.hash(data: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) + hash = Crypto.SHA384.hash(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) + hash = Crypto.SHA384.hash(data: cert) // GOOD, computationally expensive hash not required + hash = Crypto.SHA384.hash(data: encrypted_passwd) // GOOD, not sensitive + hash = Crypto.SHA384.hash(data: account_no) // GOOD, computationally expensive hash not required + hash = Crypto.SHA384.hash(data: credit_card_no) // GOOD, computationally expensive hash not required + + hash = Crypto.SHA512.hash(data: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) + hash = Crypto.SHA512.hash(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) + hash = Crypto.SHA512.hash(data: cert) // GOOD, computationally expensive hash not required + hash = Crypto.SHA512.hash(data: encrypted_passwd) // GOOD, not sensitive + hash = Crypto.SHA512.hash(data: account_no) // GOOD, computationally expensive hash not required + hash = Crypto.SHA512.hash(data: credit_card_no) // GOOD, computationally expensive hash not required } func testMD5UpdateWithData(passwd : String, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { var hash = Crypto.Insecure.MD5() - hash.update(data: passwd) // $ Alert[swift/weak-password-hashing] - hash.update(data: cert) // $ Alert[swift/weak-sensitive-data-hashing] - hash.update(data: encrypted_passwd) // GOOD (not sensitive) - hash.update(data: account_no) // $ Alert[swift/weak-sensitive-data-hashing] - hash.update(data: credit_card_no) // $ Alert[swift/weak-sensitive-data-hashing] + hash.update(data: passwd) // $ Alert[unified/swift/weak-password-hashing] + hash.update(data: cert) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(data: encrypted_passwd) // GOOD (not sensitive) + hash.update(data: account_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(data: credit_card_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] } func testSHA1UpdateWithData(passwd : String, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { var hash = Crypto.Insecure.SHA1() - hash.update(data: passwd) // $ Alert[swift/weak-password-hashing] - hash.update(data: cert) // $ Alert[swift/weak-sensitive-data-hashing] - hash.update(data: encrypted_passwd) // GOOD (not sensitive) - hash.update(data: account_no) // $ Alert[swift/weak-sensitive-data-hashing] - hash.update(data: credit_card_no) // $ Alert[swift/weak-sensitive-data-hashing] + hash.update(data: passwd) // $ Alert[unified/swift/weak-password-hashing] + hash.update(data: cert) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(data: encrypted_passwd) // GOOD (not sensitive) + hash.update(data: account_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(data: credit_card_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] } func testSHA256UpdateWithData(passwd : String, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { var hash = Crypto.SHA256() - hash.update(data: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash - hash.update(data: cert) // GOOD - hash.update(data: encrypted_passwd) // GOOD (not sensitive) - hash.update(data: account_no) // GOOD - hash.update(data: credit_card_no) // GOOD + hash.update(data: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) + hash.update(data: cert) // GOOD + hash.update(data: encrypted_passwd) // GOOD (not sensitive) + hash.update(data: account_no) // GOOD + hash.update(data: credit_card_no) // GOOD } func testSHA384UpdateWithData(passwd : String, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { var hash = Crypto.SHA384() - hash.update(data: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash - hash.update(data: cert) // GOOD - hash.update(data: encrypted_passwd) // GOOD (not sensitive) - hash.update(data: account_no) // GOOD - hash.update(data: credit_card_no) // GOOD + hash.update(data: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) + hash.update(data: cert) // GOOD + hash.update(data: encrypted_passwd) // GOOD (not sensitive) + hash.update(data: account_no) // GOOD + hash.update(data: credit_card_no) // GOOD } func testSHA512UpdateWithData(passwd : String, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { var hash = Crypto.SHA512() - hash.update(data: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash - hash.update(data: cert) // GOOD - hash.update(data: encrypted_passwd) // GOOD (not sensitive) - hash.update(data: account_no) // GOOD - hash.update(data: credit_card_no) // GOOD + hash.update(data: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) + hash.update(data: cert) // GOOD + hash.update(data: encrypted_passwd) // GOOD (not sensitive) + hash.update(data: account_no) // GOOD + hash.update(data: credit_card_no) // GOOD } func testMD5UpdateWithUnsafeRawBufferPointer(passwd : UnsafeRawBufferPointer, cert: UnsafeRawBufferPointer, encrypted_passwd : UnsafeRawBufferPointer, account_no : UnsafeRawBufferPointer, credit_card_no : UnsafeRawBufferPointer) { var hash = Crypto.Insecure.MD5() - hash.update(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] - hash.update(bufferPointer: cert) // $ Alert[swift/weak-sensitive-data-hashing] - hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) - hash.update(bufferPointer: account_no) // $ Alert[swift/weak-sensitive-data-hashing] - hash.update(bufferPointer: credit_card_no) // $ Alert[swift/weak-sensitive-data-hashing] + hash.update(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] + hash.update(bufferPointer: cert) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) + hash.update(bufferPointer: account_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(bufferPointer: credit_card_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] } func testSHA1UpdateWithUnsafeRawBufferPointer(passwd : UnsafeRawBufferPointer, cert: UnsafeRawBufferPointer, encrypted_passwd : UnsafeRawBufferPointer, account_no : UnsafeRawBufferPointer, credit_card_no : UnsafeRawBufferPointer) { var hash = Crypto.Insecure.SHA1() - hash.update(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] - hash.update(bufferPointer: cert) // $ Alert[swift/weak-sensitive-data-hashing] - hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) - hash.update(bufferPointer: account_no) // $ Alert[swift/weak-sensitive-data-hashing] - hash.update(bufferPointer: credit_card_no) // $ Alert[swift/weak-sensitive-data-hashing] + hash.update(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] + hash.update(bufferPointer: cert) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) + hash.update(bufferPointer: account_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(bufferPointer: credit_card_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] } func testSHA256UpdateWithUnsafeRawBufferPointer(passwd : UnsafeRawBufferPointer, cert: UnsafeRawBufferPointer, encrypted_passwd : UnsafeRawBufferPointer, account_no : UnsafeRawBufferPointer, credit_card_no : UnsafeRawBufferPointer) { var hash = Crypto.SHA256() - hash.update(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash - hash.update(bufferPointer: cert) // GOOD - hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) - hash.update(bufferPointer: account_no) // GOOD - hash.update(bufferPointer: credit_card_no) // GOOD + hash.update(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) + hash.update(bufferPointer: cert) // GOOD + hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) + hash.update(bufferPointer: account_no) // GOOD + hash.update(bufferPointer: credit_card_no) // GOOD } func testSHA384UpdateWithUnsafeRawBufferPointer(passwd : UnsafeRawBufferPointer, cert: UnsafeRawBufferPointer, encrypted_passwd : UnsafeRawBufferPointer, account_no : UnsafeRawBufferPointer, credit_card_no : UnsafeRawBufferPointer) { var hash = Crypto.SHA384() - hash.update(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash - hash.update(bufferPointer: cert) // GOOD - hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) - hash.update(bufferPointer: account_no) // GOOD - hash.update(bufferPointer: credit_card_no) // GOOD + hash.update(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) + hash.update(bufferPointer: cert) // GOOD + hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) + hash.update(bufferPointer: account_no) // GOOD + hash.update(bufferPointer: credit_card_no) // GOOD } func testSHA512UpdateWithUnsafeRawBufferPointer(passwd : UnsafeRawBufferPointer, cert: UnsafeRawBufferPointer, encrypted_passwd : UnsafeRawBufferPointer, account_no : UnsafeRawBufferPointer, credit_card_no : UnsafeRawBufferPointer) { var hash = Crypto.SHA512() - hash.update(bufferPointer: passwd) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash - hash.update(bufferPointer: cert) // GOOD - hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) - hash.update(bufferPointer: account_no) // GOOD - hash.update(bufferPointer: credit_card_no) // GOOD + hash.update(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) + hash.update(bufferPointer: cert) // GOOD + hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) + hash.update(bufferPointer: account_no) // GOOD + hash.update(bufferPointer: credit_card_no) // GOOD } func testBadExample(passwordString: String) { - // this is the "bad" example from the .qhelp + // this is the "bad" example from the `.qhelp` let passwordData = Data(passwordString.utf8) - let passwordHash = Crypto.SHA512.hash(data: passwordData) // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash + let passwordHash = Crypto.SHA512.hash(data: passwordData) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) // ... - if Crypto.SHA512.hash(data: Data(passwordString.utf8)) == passwordHash { // $ Alert[swift/weak-password-hashing] // BAD, not a computationally expensive hash + if Crypto.SHA512.hash(data: Data(passwordString.utf8)) == passwordHash { // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) // ... } } func testWithFlowAndMetatypes(cardNumber: String) { - let value1 = Data(cardNumber.utf8); // $ Source[swift/weak-sensitive-data-hashing] - let _digest1 = Insecure.MD5.hash(data: value1); // $ Alert[swift/weak-sensitive-data-hashing] + let value1 = Data(cardNumber.utf8); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + let _digest1 = Insecure.MD5.hash(data: value1); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] - let value2 = Data(cardNumber.utf8); // $ Source[swift/weak-sensitive-data-hashing] + let value2 = Data(cardNumber.utf8); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] let hasher2 = Insecure.MD5.self; // metatype - let _digest2 = hasher2.hash(data: value2); // $ Alert[swift/weak-sensitive-data-hashing] + let _digest2 = hasher2.hash(data: value2); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] - let value3 = Data(cardNumber.utf8); // $ Source[swift/weak-sensitive-data-hashing] - let _digest3 = (Insecure.MD5.self).hash(data: value3); // $ Alert[swift/weak-sensitive-data-hashing] + let value3 = Data(cardNumber.utf8); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + let _digest3 = (Insecure.MD5.self).hash(data: value3); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] - let value4 = Data(cardNumber.utf8); // $ Source[swift/weak-sensitive-data-hashing] + let value4 = Data(cardNumber.utf8); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] testReceiver1(value: value4); - let value5 = Data(cardNumber.utf8); // $ Source[swift/weak-sensitive-data-hashing] + let value5 = Data(cardNumber.utf8); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] testReceiver2(hasher: Insecure.MD5.self, value: value5); let value6 = Data(cardNumber.utf8); @@ -248,13 +248,13 @@ func testWithFlowAndMetatypes(cardNumber: String) { } func testReceiver1(value: Data) { - let _digest = Insecure.MD5.hash(data: value); // $ Alert[swift/weak-sensitive-data-hashing] + let _digest = Insecure.MD5.hash(data: value); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] } func testReceiver2(hasher: Insecure.MD5.Type, value: Data) { - let _digest = hasher.hash(data: value); // $ Alert[swift/weak-sensitive-data-hashing] + let _digest = hasher.hash(data: value); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] } func testReceiver3(hasher: H.Type, value: Data) { - let _digest = hasher.hash(data: value); // $ MISSING: Alert[swift/weak-sensitive-data-hashing] // BAD [NOT DETECTED] + let _digest = hasher.hash(data: value); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] } diff --git a/unified/ql/test/query-tests/security/CWE-328/testCryptoSwift.swift b/unified/ql/test/query-tests/security/CWE-328/testCryptoSwift.swift index a6f4584230e7..be3a136b9682 100644 --- a/unified/ql/test/query-tests/security/CWE-328/testCryptoSwift.swift +++ b/unified/ql/test/query-tests/security/CWE-328/testCryptoSwift.swift @@ -150,83 +150,84 @@ extension String { func testArrays(harmlessArray: Array, phoneNumberArray: Array, passwdArray: Array) { _ = MD5().calculate(for: harmlessArray) // GOOD (not sensitive) - _ = MD5().calculate(for: phoneNumberArray) // $ Alert[swift/weak-sensitive-data-hashing] - _ = MD5().calculate(for: passwdArray) // $ Alert[swift/weak-password-hashing] + _ = MD5().calculate(for: phoneNumberArray) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = MD5().calculate(for: passwdArray) // $ Alert[unified/swift/weak-password-hashing] _ = SHA1().calculate(for: harmlessArray) // GOOD (not sensitive) - _ = SHA1().calculate(for: phoneNumberArray) // $ Alert[swift/weak-sensitive-data-hashing] - _ = SHA1().calculate(for: passwdArray) // $ Alert[swift/weak-password-hashing] + _ = SHA1().calculate(for: phoneNumberArray) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = SHA1().calculate(for: passwdArray) // $ Alert[unified/swift/weak-password-hashing] _ = SHA2(variant: .sha512).calculate(for: harmlessArray) // GOOD _ = SHA2(variant: .sha512).calculate(for: phoneNumberArray) // GOOD - _ = SHA2(variant: .sha512).calculate(for: passwdArray) // $ Alert[swift/weak-password-hashing] + _ = SHA2(variant: .sha512).calculate(for: passwdArray) // $ Alert[unified/swift/weak-password-hashing] _ = SHA3(variant: .sha512).calculate(for: harmlessArray) // GOOD _ = SHA3(variant: .sha512).calculate(for: phoneNumberArray) // GOOD - _ = SHA3(variant: .sha512).calculate(for: passwdArray) // $ Alert[swift/weak-password-hashing] + _ = SHA3(variant: .sha512).calculate(for: passwdArray) // $ Alert[unified/swift/weak-password-hashing] _ = Digest.md5(harmlessArray) // GOOD (not sensitive) - _ = Digest.md5(phoneNumberArray) // $ Alert[swift/weak-sensitive-data-hashing] - _ = Digest.md5(passwdArray) // $ Alert[swift/weak-password-hashing] + _ = Digest.md5(phoneNumberArray) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = Digest.md5(passwdArray) // $ Alert[unified/swift/weak-password-hashing] _ = Digest.sha1(harmlessArray) // GOOD (not sensitive) - _ = Digest.sha1(phoneNumberArray) // $ Alert[swift/weak-sensitive-data-hashing] - _ = Digest.sha1(passwdArray) // $ Alert[swift/weak-password-hashing] + _ = Digest.sha1(phoneNumberArray) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = Digest.sha1(passwdArray) // $ Alert[unified/swift/weak-password-hashing] _ = Digest.sha512(harmlessArray) // GOOD (not sensitive) _ = Digest.sha512(phoneNumberArray) // GOOD - _ = Digest.sha512(passwdArray) // $ Alert[swift/weak-password-hashing] + _ = Digest.sha512(passwdArray) // $ Alert[unified/swift/weak-password-hashing] _ = Digest.sha2(harmlessArray, variant: .sha512) // GOOD (not sensitive) _ = Digest.sha2(phoneNumberArray, variant: .sha512) // GOOD - _ = Digest.sha2(passwdArray, variant: .sha512) // $ Alert[swift/weak-password-hashing] + _ = Digest.sha2(passwdArray, variant: .sha512) // $ Alert[unified/swift/weak-password-hashing] _ = Digest.sha3(harmlessArray, variant: .sha512) // GOOD (not sensitive) _ = Digest.sha3(phoneNumberArray, variant: .sha512) // GOOD - _ = Digest.sha3(passwdArray, variant: .sha512) // $ Alert[swift/weak-password-hashing] + _ = Digest.sha3(passwdArray, variant: .sha512) // $ Alert[unified/swift/weak-password-hashing] _ = harmlessArray.md5() // GOOD (not sensitive) - _ = phoneNumberArray.md5() // $ Alert[swift/weak-sensitive-data-hashing] - _ = passwdArray.md5() // $ Alert[swift/weak-password-hashing] + _ = phoneNumberArray.md5() // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = passwdArray.md5() // $ Alert[unified/swift/weak-password-hashing] _ = harmlessArray.sha1() // GOOD (not sensitive) - _ = phoneNumberArray.sha1() // $ Alert[swift/weak-sensitive-data-hashing] - _ = passwdArray.sha1() // $ Alert[swift/weak-password-hashing] + _ = phoneNumberArray.sha1() // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = passwdArray.sha1() // $ Alert[unified/swift/weak-password-hashing] _ = harmlessArray.sha512() // GOOD _ = phoneNumberArray.sha512() // GOOD - _ = passwdArray.sha512() // $ Alert[swift/weak-password-hashing] + _ = passwdArray.sha512() // $ Alert[unified/swift/weak-password-hashing] _ = harmlessArray.sha2(.sha512) // GOOD _ = phoneNumberArray.sha2(.sha512) // GOOD - _ = passwdArray.sha2(.sha512) // $ Alert[swift/weak-password-hashing] + _ = passwdArray.sha2(.sha512) // $ Alert[unified/swift/weak-password-hashing] _ = harmlessArray.sha3(.sha512) // GOOD _ = phoneNumberArray.sha3(.sha512) // GOOD - _ = passwdArray.sha3(.sha512) // $ Alert[swift/weak-password-hashing] + _ = passwdArray.sha3(.sha512) // $ Alert[unified/swift/weak-password-hashing] } func testData(harmlessData: Data, medicalData: Data, passwdData: Data) { _ = harmlessData.md5() // GOOD (not sensitive) - _ = medicalData.md5() // $ Alert[swift/weak-sensitive-data-hashing] - _ = passwdData.md5() // $ Alert[swift/weak-password-hashing] + _ = medicalData.md5() // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = passwdData.md5() // $ Alert[unified/swift/weak-password-hashing] _ = harmlessData.sha1() // GOOD (not sensitive) - _ = medicalData.sha1() // $ Alert[swift/weak-sensitive-data-hashing] - _ = passwdData.sha1() // $ Alert[swift/weak-password-hashing] + _ = medicalData.sha1() // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = passwdData.sha1() // $ Alert[unified/swift/weak-password-hashing] _ = harmlessData.sha512() // GOOD _ = medicalData.sha512() // GOOD - _ = passwdData.sha512() // $ Alert[swift/weak-password-hashing] + _ = passwdData.sha512() // $ Alert[unified/swift/weak-password-hashing] _ = harmlessData.sha2(.sha512) // GOOD _ = medicalData.sha2(.sha512) // GOOD - _ = passwdData.sha2(.sha512) // $ Alert[swift/weak-password-hashing] + _ = passwdData.sha2(.sha512) // $ Alert[unified/swift/weak-password-hashing] _ = harmlessData.sha3(.sha512) // GOOD _ = medicalData.sha3(.sha512) // GOOD - _ = passwdData.sha3(.sha512) // $ Alert[swift/weak-password-hashing] + _ = passwdData.sha3(.sha512) // $ Alert[unified/swift/weak-password-hashing] } func testStrings(creditCardNumber: String, passwd: String) { _ = "harmless".md5() // GOOD (not sensitive) - _ = creditCardNumber.md5() // $ Alert[swift/weak-sensitive-data-hashing] - _ = passwd.md5() // $ Alert[swift/weak-password-hashing] + _ = creditCardNumber.md5() // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = passwd.md5() // $ Alert[unified/swift/weak-password-hashing] _ = "harmless".sha1() // GOOD (not sensitive) - _ = creditCardNumber.sha1() // $ Alert[swift/weak-sensitive-data-hashing] - _ = passwd.sha1() // $ Alert[swift/weak-password-hashing] + _ = creditCardNumber.sha1() // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = passwd.sha1() // $ Alert[unified/swift/weak-password-hashing] _ = "harmless".sha512() // GOOD _ = creditCardNumber.sha512() // GOOD - _ = passwd.sha512() // $ Alert[swift/weak-password-hashing] + _ = passwd.sha512() // $ Alert[unified/swift/weak-password-hashing] _ = "harmless".sha2(.sha512) // GOOD _ = creditCardNumber.sha2(.sha512) // GOOD - _ = passwd.sha2(.sha512) // $ Alert[swift/weak-password-hashing] + _ = passwd.sha2(.sha512) // $ Alert[unified/swift/weak-password-hashing] _ = "harmless".sha3(.sha512) // GOOD _ = creditCardNumber.sha3(.sha512) // GOOD - _ = passwd.sha3(.sha512) // $ Alert[swift/weak-password-hashing] + _ = passwd.sha3(.sha512) // $ Alert[unified/swift/weak-password-hashing] } + From 951a41d57c22af3e6e489d7efb4cb4835e4f98c1 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Wed, 2 Dec 2026 19:05:49 +0000 Subject: [PATCH 04/14] unified: Fix SHA3 sink kind in legacy Swift models Correct the four CryptoSwift SHA3 sink models in legacy-swift.model.json that mistakenly used weak-password-hash-input-SHA2 instead of weak-password-hash-input-SHA3, and update WeakPasswordHashing.expected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- unified/ql/lib/ext/legacy-swift.model.json | 8 ++++---- .../security/CWE-328/WeakPasswordHashing.expected | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/unified/ql/lib/ext/legacy-swift.model.json b/unified/ql/lib/ext/legacy-swift.model.json index f714f181aee7..83e899c17717 100644 --- a/unified/ql/lib/ext/legacy-swift.model.json +++ b/unified/ql/lib/ext/legacy-swift.model.json @@ -261,10 +261,10 @@ ["", "SHA384", true, "hash(data:)", "", "", "Argument[data:]", "weak-password-hash-input-SHA384", "manual"], ["", "SHA384", true, "update(bufferPointer:)", "", "", "Argument[bufferPointer:]", "weak-password-hash-input-SHA384", "manual"], ["", "SHA384", true, "update(data:)", "", "", "Argument[data:]", "weak-password-hash-input-SHA384", "manual"], - ["", "SHA3", true, "callAsFunction(_:)", "", "", "Argument[0]", "weak-password-hash-input-SHA2", "manual"], - ["", "SHA3", true, "calculate(for:)", "", "", "Argument[for:]", "weak-password-hash-input-SHA2", "manual"], - ["", "SHA3", true, "process(block:currentHash:)", "", "", "Argument[block:]", "weak-password-hash-input-SHA2", "manual"], - ["", "SHA3", true, "update(withBytes:isLast?:)", "", "", "Argument[withBytes:]", "weak-password-hash-input-SHA2", "manual"], + ["", "SHA3", true, "callAsFunction(_:)", "", "", "Argument[0]", "weak-password-hash-input-SHA3", "manual"], + ["", "SHA3", true, "calculate(for:)", "", "", "Argument[for:]", "weak-password-hash-input-SHA3", "manual"], + ["", "SHA3", true, "process(block:currentHash:)", "", "", "Argument[block:]", "weak-password-hash-input-SHA3", "manual"], + ["", "SHA3", true, "update(withBytes:isLast?:)", "", "", "Argument[withBytes:]", "weak-password-hash-input-SHA3", "manual"], ["", "SHA512", true, "hash(bufferPointer:)", "", "", "Argument[bufferPointer:]", "weak-password-hash-input-SHA512", "manual"], ["", "SHA512", true, "hash(data:)", "", "", "Argument[data:]", "weak-password-hash-input-SHA512", "manual"], ["", "SHA512", true, "update(bufferPointer:)", "", "", "Argument[bufferPointer:]", "weak-password-hash-input-SHA512", "manual"], diff --git a/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.expected b/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.expected index 92c988bca886..72f02cc232f8 100644 --- a/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.expected +++ b/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.expected @@ -122,15 +122,19 @@ | testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:154:30:154:40 | passwdArray | password (passwdArray) | | testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:154:30:154:40 | passwdArray | password (passwdArray) | | testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:154:30:154:40 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:154:30:154:40 | passwdArray | password (passwdArray) | | testCryptoSwift.swift:157:31:157:41 | passwdArray | testCryptoSwift.swift:157:31:157:41 | passwdArray | testCryptoSwift.swift:157:31:157:41 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:157:31:157:41 | passwdArray | password (passwdArray) | | testCryptoSwift.swift:157:31:157:41 | passwdArray | testCryptoSwift.swift:157:31:157:41 | passwdArray | testCryptoSwift.swift:157:31:157:41 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:157:31:157:41 | passwdArray | password (passwdArray) | | testCryptoSwift.swift:157:31:157:41 | passwdArray | testCryptoSwift.swift:157:31:157:41 | passwdArray | testCryptoSwift.swift:157:31:157:41 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:157:31:157:41 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:157:31:157:41 | passwdArray | testCryptoSwift.swift:157:31:157:41 | passwdArray | testCryptoSwift.swift:157:31:157:41 | passwdArray | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:157:31:157:41 | passwdArray | password (passwdArray) | | testCryptoSwift.swift:160:47:160:57 | passwdArray | testCryptoSwift.swift:160:47:160:57 | passwdArray | testCryptoSwift.swift:160:47:160:57 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:160:47:160:57 | passwdArray | password (passwdArray) | | testCryptoSwift.swift:160:47:160:57 | passwdArray | testCryptoSwift.swift:160:47:160:57 | passwdArray | testCryptoSwift.swift:160:47:160:57 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:160:47:160:57 | passwdArray | password (passwdArray) | | testCryptoSwift.swift:160:47:160:57 | passwdArray | testCryptoSwift.swift:160:47:160:57 | passwdArray | testCryptoSwift.swift:160:47:160:57 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:160:47:160:57 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:160:47:160:57 | passwdArray | testCryptoSwift.swift:160:47:160:57 | passwdArray | testCryptoSwift.swift:160:47:160:57 | passwdArray | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:160:47:160:57 | passwdArray | password (passwdArray) | | testCryptoSwift.swift:163:47:163:57 | passwdArray | testCryptoSwift.swift:163:47:163:57 | passwdArray | testCryptoSwift.swift:163:47:163:57 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:163:47:163:57 | passwdArray | password (passwdArray) | | testCryptoSwift.swift:163:47:163:57 | passwdArray | testCryptoSwift.swift:163:47:163:57 | passwdArray | testCryptoSwift.swift:163:47:163:57 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:163:47:163:57 | passwdArray | password (passwdArray) | | testCryptoSwift.swift:163:47:163:57 | passwdArray | testCryptoSwift.swift:163:47:163:57 | passwdArray | testCryptoSwift.swift:163:47:163:57 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:163:47:163:57 | passwdArray | password (passwdArray) | +| testCryptoSwift.swift:163:47:163:57 | passwdArray | testCryptoSwift.swift:163:47:163:57 | passwdArray | testCryptoSwift.swift:163:47:163:57 | passwdArray | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:163:47:163:57 | passwdArray | password (passwdArray) | | testCryptoSwift.swift:167:20:167:30 | passwdArray | testCryptoSwift.swift:167:20:167:30 | passwdArray | testCryptoSwift.swift:167:20:167:30 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:167:20:167:30 | passwdArray | password (passwdArray) | | testCryptoSwift.swift:170:21:170:31 | passwdArray | testCryptoSwift.swift:170:21:170:31 | passwdArray | testCryptoSwift.swift:170:21:170:31 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:170:21:170:31 | passwdArray | password (passwdArray) | | testCryptoSwift.swift:173:23:173:33 | passwdArray | testCryptoSwift.swift:173:23:173:33 | passwdArray | testCryptoSwift.swift:173:23:173:33 | passwdArray | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoSwift.swift:173:23:173:33 | passwdArray | password (passwdArray) | From dde9daf8607482ed9a9bd370af82d6b9cdd4ab89 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Wed, 2 Dec 2026 19:06:04 +0000 Subject: [PATCH 05/14] unified: Add barrier and metatype test cases for CWE-328 Add test cases covering the HMAC/PBKDF1/PBKDF2 implementation barrier (both struct and extension declarations, plus a control helper) in testCryptoSwift.swift, and a SHA256.self metatype password-hashing case in testCryptoKit.swift. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../CWE-328/WeakPasswordHashing.expected | 20 ++++++++++++++++ .../security/CWE-328/testCryptoKit.swift | 6 ++++- .../security/CWE-328/testCryptoSwift.swift | 23 +++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.expected b/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.expected index 72f02cc232f8..b0483b35d6ee 100644 --- a/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.expected +++ b/unified/ql/test/query-tests/security/CWE-328/WeakPasswordHashing.expected @@ -119,6 +119,11 @@ | testCryptoKit.swift:224:33:224:57 | Data(...) | testCryptoKit.swift:224:38:224:51 | passwordString | testCryptoKit.swift:224:33:224:57 | Data(...) | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:224:38:224:51 | passwordString | password (passwordString) | | testCryptoKit.swift:224:33:224:57 | Data(...) | testCryptoKit.swift:224:38:224:51 | passwordString | testCryptoKit.swift:224:33:224:57 | Data(...) | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:224:38:224:51 | passwordString | password (passwordString) | | testCryptoKit.swift:224:33:224:57 | Data(...) | testCryptoKit.swift:224:38:224:51 | passwordString | testCryptoKit.swift:224:33:224:57 | Data(...) | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:224:38:224:51 | passwordString | password (passwordString) | +| testCryptoKit.swift:251:39:251:44 | value7 | testCryptoKit.swift:249:23:249:36 | passwordString | testCryptoKit.swift:251:39:251:44 | value7 | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:249:23:249:36 | passwordString | password (passwordString) | +| testCryptoKit.swift:251:39:251:44 | value7 | testCryptoKit.swift:249:23:249:36 | passwordString | testCryptoKit.swift:251:39:251:44 | value7 | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:249:23:249:36 | passwordString | password (passwordString) | +| testCryptoKit.swift:251:39:251:44 | value7 | testCryptoKit.swift:249:23:249:36 | passwordString | testCryptoKit.swift:251:39:251:44 | value7 | Insecure hashing algorithm (SHA256) depends on $@. | testCryptoKit.swift:249:23:249:36 | passwordString | password (passwordString) | +| testCryptoKit.swift:251:39:251:44 | value7 | testCryptoKit.swift:249:23:249:36 | passwordString | testCryptoKit.swift:251:39:251:44 | value7 | Insecure hashing algorithm (SHA384) depends on $@. | testCryptoKit.swift:249:23:249:36 | passwordString | password (passwordString) | +| testCryptoKit.swift:251:39:251:44 | value7 | testCryptoKit.swift:249:23:249:36 | passwordString | testCryptoKit.swift:251:39:251:44 | value7 | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoKit.swift:249:23:249:36 | passwordString | password (passwordString) | | testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:154:30:154:40 | passwdArray | password (passwdArray) | | testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:154:30:154:40 | passwdArray | password (passwdArray) | | testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | testCryptoSwift.swift:154:30:154:40 | passwdArray | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:154:30:154:40 | passwdArray | password (passwdArray) | @@ -155,9 +160,14 @@ | testCryptoSwift.swift:225:9:225:23 | [self arg] ... .sha512(...) | testCryptoSwift.swift:225:9:225:14 | passwd | testCryptoSwift.swift:225:9:225:23 | [self arg] ... .sha512(...) | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoSwift.swift:225:9:225:14 | passwd | password (passwd) | | testCryptoSwift.swift:228:9:228:28 | [self arg] ... .sha2(...) | testCryptoSwift.swift:228:9:228:14 | passwd | testCryptoSwift.swift:228:9:228:28 | [self arg] ... .sha2(...) | Insecure hashing algorithm (SHA2) depends on $@. | testCryptoSwift.swift:228:9:228:14 | passwd | password (passwd) | | testCryptoSwift.swift:231:9:231:28 | [self arg] ... .sha3(...) | testCryptoSwift.swift:231:9:231:14 | passwd | testCryptoSwift.swift:231:9:231:28 | [self arg] ... .sha3(...) | Insecure hashing algorithm (SHA3) depends on $@. | testCryptoSwift.swift:231:9:231:14 | passwd | password (passwd) | +| testCryptoSwift.swift:248:30:248:34 | bytes | testCryptoSwift.swift:255:36:255:46 | passwdArray | testCryptoSwift.swift:248:30:248:34 | bytes | Insecure hashing algorithm (SHA512) depends on $@. | testCryptoSwift.swift:255:36:255:46 | passwdArray | password (passwdArray) | edges | testCryptoKit.swift:224:38:224:51 | passwordString | testCryptoKit.swift:224:38:224:56 | ... .utf8 | provenance | | | testCryptoKit.swift:224:38:224:56 | ... .utf8 | testCryptoKit.swift:224:33:224:57 | Data(...) | provenance | | +| testCryptoKit.swift:249:9:249:14 | value7 | testCryptoKit.swift:251:39:251:44 | value7 | provenance | | +| testCryptoKit.swift:249:18:249:42 | Data(...) | testCryptoKit.swift:249:9:249:14 | value7 | provenance | | +| testCryptoKit.swift:249:23:249:36 | passwordString | testCryptoKit.swift:249:23:249:41 | ... .utf8 | provenance | | +| testCryptoKit.swift:249:23:249:41 | ... .utf8 | testCryptoKit.swift:249:18:249:42 | Data(...) | provenance | | | testCryptoSwift.swift:183:9:183:19 | passwdArray | testCryptoSwift.swift:183:9:183:25 | [self arg] ... .md5(...) | provenance | | | testCryptoSwift.swift:186:9:186:19 | passwdArray | testCryptoSwift.swift:186:9:186:26 | [self arg] ... .sha1(...) | provenance | | | testCryptoSwift.swift:189:9:189:19 | passwdArray | testCryptoSwift.swift:189:9:189:28 | [self arg] ... .sha512(...) | provenance | | @@ -173,6 +183,8 @@ edges | testCryptoSwift.swift:225:9:225:14 | passwd | testCryptoSwift.swift:225:9:225:23 | [self arg] ... .sha512(...) | provenance | | | testCryptoSwift.swift:228:9:228:14 | passwd | testCryptoSwift.swift:228:9:228:28 | [self arg] ... .sha2(...) | provenance | | | testCryptoSwift.swift:231:9:231:14 | passwd | testCryptoSwift.swift:231:9:231:28 | [self arg] ... .sha3(...) | provenance | | +| testCryptoSwift.swift:247:24:247:28 | bytes | testCryptoSwift.swift:248:30:248:34 | bytes | provenance | | +| testCryptoSwift.swift:255:36:255:46 | passwdArray | testCryptoSwift.swift:247:24:247:28 | bytes | provenance | | nodes | testCryptoKit.swift:84:47:84:52 | passwd | semmle.label | passwd | | testCryptoKit.swift:85:52:85:57 | passwd | semmle.label | passwd | @@ -200,6 +212,11 @@ nodes | testCryptoKit.swift:224:33:224:57 | Data(...) | semmle.label | Data(...) | | testCryptoKit.swift:224:38:224:51 | passwordString | semmle.label | passwordString | | testCryptoKit.swift:224:38:224:56 | ... .utf8 | semmle.label | ... .utf8 | +| testCryptoKit.swift:249:9:249:14 | value7 | semmle.label | value7 | +| testCryptoKit.swift:249:18:249:42 | Data(...) | semmle.label | Data(...) | +| testCryptoKit.swift:249:23:249:36 | passwordString | semmle.label | passwordString | +| testCryptoKit.swift:249:23:249:41 | ... .utf8 | semmle.label | ... .utf8 | +| testCryptoKit.swift:251:39:251:44 | value7 | semmle.label | value7 | | testCryptoSwift.swift:154:30:154:40 | passwdArray | semmle.label | passwdArray | | testCryptoSwift.swift:157:31:157:41 | passwdArray | semmle.label | passwdArray | | testCryptoSwift.swift:160:47:160:57 | passwdArray | semmle.label | passwdArray | @@ -239,4 +256,7 @@ nodes | testCryptoSwift.swift:228:9:228:28 | [self arg] ... .sha2(...) | semmle.label | [self arg] ... .sha2(...) | | testCryptoSwift.swift:231:9:231:14 | passwd | semmle.label | passwd | | testCryptoSwift.swift:231:9:231:28 | [self arg] ... .sha3(...) | semmle.label | [self arg] ... .sha3(...) | +| testCryptoSwift.swift:247:24:247:28 | bytes | semmle.label | bytes | +| testCryptoSwift.swift:248:30:248:34 | bytes | semmle.label | bytes | +| testCryptoSwift.swift:255:36:255:46 | passwdArray | semmle.label | passwdArray | subpaths diff --git a/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift b/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift index 6c9410276e35..9a52810b4496 100644 --- a/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift +++ b/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift @@ -226,7 +226,7 @@ func testBadExample(passwordString: String) { } } -func testWithFlowAndMetatypes(cardNumber: String) { +func testWithFlowAndMetatypes(cardNumber: String, passwordString: String) { let value1 = Data(cardNumber.utf8); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] let _digest1 = Insecure.MD5.hash(data: value1); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] @@ -245,6 +245,10 @@ func testWithFlowAndMetatypes(cardNumber: String) { let value6 = Data(cardNumber.utf8); testReceiver3(hasher: Insecure.MD5.self, value: value6); + + let value7 = Data(passwordString.utf8); // $ Source[unified/swift/weak-password-hashing] + let hasher7 = SHA256.self; // metatype + let _digest7 = hasher7.hash(data: value7); // $ Alert[unified/swift/weak-password-hashing] } func testReceiver1(value: Data) { diff --git a/unified/ql/test/query-tests/security/CWE-328/testCryptoSwift.swift b/unified/ql/test/query-tests/security/CWE-328/testCryptoSwift.swift index be3a136b9682..aae91aa07f0b 100644 --- a/unified/ql/test/query-tests/security/CWE-328/testCryptoSwift.swift +++ b/unified/ql/test/query-tests/security/CWE-328/testCryptoSwift.swift @@ -231,3 +231,26 @@ func testStrings(creditCardNumber: String, passwd: String) { _ = passwd.sha3(.sha512) // $ Alert[unified/swift/weak-password-hashing] } +struct PBKDF2 { + static func derive(bytes: Array) -> Array { + return Digest.sha512(bytes) // GOOD (inside PBKDF2 implementation) + } +} + +extension PBKDF2 { + static func deriveInExtension(bytes: Array) -> Array { + return Digest.sha512(bytes) // GOOD (inside PBKDF2 extension) + } +} + +struct CustomHasher { + static func derive(bytes: Array) -> Array { + return Digest.sha512(bytes) // $ Alert[unified/swift/weak-password-hashing] + } +} + +func testImplementationBarrier(passwdArray: Array) { + _ = PBKDF2.derive(bytes: passwdArray) + _ = PBKDF2.deriveInExtension(bytes: passwdArray) + _ = CustomHasher.derive(bytes: passwdArray) // $ Source[unified/swift/weak-password-hashing] +} From da89b66a5f1bca428db5c4ba75909f4f49cf81b5 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Wed, 2 Dec 2026 19:06:06 +0000 Subject: [PATCH 06/14] unified: Fix libsodium anchor link in WeakPasswordHashing.qhelp Update the libsodium bindings anchor from #bindings-programming-languages to #bindings-for-programming-languages in WeakPasswordHashing.qhelp. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../ql/src/queries/security/CWE-328/WeakPasswordHashing.qhelp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.qhelp b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.qhelp index 0e26c11703b1..390c5b12fa64 100644 --- a/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.qhelp +++ b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.qhelp @@ -85,7 +85,7 @@ GitHub: CryptoSwift README - Password-Based Key Derivation Function
  • - libsodium: libsodium bindings for other languages + libsodium: libsodium bindings for other languages
  • GitHub: Argon2Swift From 689a0ee1b80d7572fc2de5ab3416e68bc982be87 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 3 Dec 2026 13:54:32 +0000 Subject: [PATCH 07/14] Refactor barrier predicate for weak password hashing Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../ql/src/queries/security/CWE-328/WeakPasswordHashing.ql | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql index ac0d3bb66915..b68e2210b183 100644 --- a/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql +++ b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql @@ -41,9 +41,8 @@ module WeakPasswordHashingConfig implements DataFlow::ConfigSig { predicate isBarrier(DataFlow::Node node) { // A barrier for weak password hashing, when it occurs inside of // certain cryptographic algorithms as part of their design. - exists(Parameter param, ClassLikeDeclaration cls, string name | - node.asExpr() = param.getPattern() and - param.getParent().getParent+() = cls and + exists(ClassLikeDeclaration cls, string name | + node.asExpr().getParent+() = cls and ( name = cls.resolve().getName() or From 15d8fcaefd6743287861fdad5bbaa006a7337204 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 3 Dec 2026 14:01:00 +0000 Subject: [PATCH 08/14] Unified: Add observeDiffInformedIncrementalMode predicate. --- unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql index b68e2210b183..295708c0c794 100644 --- a/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql +++ b/unified/ql/src/queries/security/CWE-328/WeakPasswordHashing.ql @@ -61,6 +61,8 @@ module WeakPasswordHashingConfig implements DataFlow::ConfigSig { // make sinks barriers so that we only report the closest instance isSink(node) } + + predicate observeDiffInformedIncrementalMode() { any() } } module WeakPasswordHashingFlow = TaintTracking::Global; From c9197b0cf7442afd1fd557c9fc2c2641048c67e9 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 3 Dec 2026 16:51:38 +0000 Subject: [PATCH 09/14] unified: Copy Swift weak sensitive data hashing query and test baseline unchanged Copy the original Swift WeakSensitiveDataHashing query, query help, examples, .qlref, and .expected byte-for-byte into unified/ to establish an unchanged baseline for the unified Swift port (reusing the shared CWE-328 .swift test files). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../CWE-328/WeakSensitiveDataHashing.qhelp | 91 ++++++++++++++ .../CWE-328/WeakSensitiveDataHashing.ql | 27 +++++ .../CWE-328/WeakSensitiveDataHashingBad.swift | 10 ++ .../WeakSensitiveDataHashingGood.swift | 10 ++ .../CWE-328/WeakSensitiveDataHashing.expected | 114 ++++++++++++++++++ .../CWE-328/WeakSensitiveDataHashing.qlref | 2 + 6 files changed, 254 insertions(+) create mode 100755 unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.qhelp create mode 100755 unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.ql create mode 100755 unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashingBad.swift create mode 100755 unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashingGood.swift create mode 100644 unified/ql/test/query-tests/security/CWE-328/WeakSensitiveDataHashing.expected create mode 100644 unified/ql/test/query-tests/security/CWE-328/WeakSensitiveDataHashing.qlref diff --git a/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.qhelp b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.qhelp new file mode 100755 index 000000000000..cda0a74671c4 --- /dev/null +++ b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.qhelp @@ -0,0 +1,91 @@ + + + +

    + Using a broken or weak cryptographic hash function can leave data + vulnerable, and should not be used in security related code. +

    + +

    + A strong cryptographic hash function should be resistant to: +

    +
      +
    • + Pre-image attacks. If you know a hash value h(x), + you should not be able to easily find the input x. +
    • +
    • + Collision attacks. If you know a hash value h(x), + you should not be able to easily find a different input + y + with the same hash value h(x) = h(y). +
    • +
    + +

    + As an example, both MD5 and SHA-1 are known to be vulnerable to collision attacks. +

    + +

    + Since it's OK to use a weak cryptographic hash function in a non-security + context, this query only alerts when these are used to hash sensitive + data (such as passwords, certificates, usernames). +

    + +
    + + +

    + Ensure that you use a strong, modern cryptographic hash function, such as: +

    + +
      +
    • + Argon2, scrypt, bcrypt, or PBKDF2 for passwords and other data with limited input space where + a dictionary-like attack is feasible. +
    • +
    • + SHA-2, or SHA-3 in other cases. +
    • +
    + +

    + Note that special purpose algorithms, which are used to ensure that a message comes from a particular sender, exist for message authentication. These algorithms should be used when appropriate, as they address common vulnerabilities of simple hashing schemes in this context. +

    + +
    + + +

    + The following examples show a function for fetching data from a + URL along with a hash of the data, perhaps to check the data has + not been tampered with. +

    + +

    + In the first case the MD5 hashing algorithm is used that is known to be vulnerable to collision attacks. +

    + + +

    + Here is the same function using SHA-512, which is a strong cryptographic hashing function. +

    + + +
    + +
  • + OWASP: + Password Storage + Cheat Sheet + + and + + Transport Layer Protection Cheat Sheet + +
  • + + + diff --git a/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.ql b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.ql new file mode 100755 index 000000000000..e653d9706611 --- /dev/null +++ b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.ql @@ -0,0 +1,27 @@ +/** + * @name Use of a broken or weak cryptographic hashing algorithm on sensitive data + * @description Using broken or weak cryptographic hashing algorithms can compromise security. + * @kind path-problem + * @problem.severity warning + * @security-severity 7.5 + * @precision high + * @id swift/weak-sensitive-data-hashing + * @tags security + * external/cwe/cwe-327 + * external/cwe/cwe-328 + */ + +import swift +import codeql.swift.security.WeakSensitiveDataHashingQuery +import WeakSensitiveDataHashingFlow::PathGraph + +from + WeakSensitiveDataHashingFlow::PathNode source, WeakSensitiveDataHashingFlow::PathNode sink, + string algorithm, SensitiveExpr expr +where + WeakSensitiveDataHashingFlow::flowPath(source, sink) and + algorithm = sink.getNode().(WeakSensitiveDataHashingSink).getAlgorithm() and + expr = source.getNode().asExpr() +select sink.getNode(), source, sink, + "Insecure hashing algorithm (" + algorithm + ") depends on $@.", source.getNode(), + "sensitive data (" + expr.getSensitiveType() + " " + expr.getLabel() + ")" diff --git a/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashingBad.swift b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashingBad.swift new file mode 100755 index 000000000000..31f655589142 --- /dev/null +++ b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashingBad.swift @@ -0,0 +1,10 @@ +func getContentsAndHash(url: URL) -> (Data, String)? { + guard let data = try? Data(contentsOf: url) else { + return nil + } + + let digest = Insecure.MD5.hash(data: data) // BAD: MD5 is not suitable for hashing sensitive data. + let hash = digest.map { String(format: "%02hhx", $0) }.joined() + + return (data, hash) +} diff --git a/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashingGood.swift b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashingGood.swift new file mode 100755 index 000000000000..38c23a5c0dfe --- /dev/null +++ b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashingGood.swift @@ -0,0 +1,10 @@ +func getContentsAndHash(url: URL) -> (Data, String)? { + guard let data = try? Data(contentsOf: url) else { + return nil + } + + let digest = SHA512.hash(data: data) // GOOD: SHA-512 is suitable for hashing sensitive data. + let hash = digest.map { String(format: "%02hhx", $0) }.joined() + + return (data, hash) +} diff --git a/unified/ql/test/query-tests/security/CWE-328/WeakSensitiveDataHashing.expected b/unified/ql/test/query-tests/security/CWE-328/WeakSensitiveDataHashing.expected new file mode 100644 index 000000000000..ebb8154b0f8e --- /dev/null +++ b/unified/ql/test/query-tests/security/CWE-328/WeakSensitiveDataHashing.expected @@ -0,0 +1,114 @@ +edges +| testCryptoKit.swift:230:18:230:38 | call to Data.init(_:) | testCryptoKit.swift:231:44:231:44 | value1 | provenance | | +| testCryptoKit.swift:230:23:230:23 | cardNumber | testCryptoKit.swift:230:23:230:34 | .utf8 | provenance | | +| testCryptoKit.swift:230:23:230:34 | .utf8 | testCryptoKit.swift:230:18:230:38 | call to Data.init(_:) | provenance | | +| testCryptoKit.swift:233:18:233:38 | call to Data.init(_:) | testCryptoKit.swift:235:39:235:39 | value2 | provenance | | +| testCryptoKit.swift:233:23:233:23 | cardNumber | testCryptoKit.swift:233:23:233:34 | .utf8 | provenance | | +| testCryptoKit.swift:233:23:233:34 | .utf8 | testCryptoKit.swift:233:18:233:38 | call to Data.init(_:) | provenance | | +| testCryptoKit.swift:237:18:237:38 | call to Data.init(_:) | testCryptoKit.swift:238:51:238:51 | value3 | provenance | | +| testCryptoKit.swift:237:23:237:23 | cardNumber | testCryptoKit.swift:237:23:237:34 | .utf8 | provenance | | +| testCryptoKit.swift:237:23:237:34 | .utf8 | testCryptoKit.swift:237:18:237:38 | call to Data.init(_:) | provenance | | +| testCryptoKit.swift:240:18:240:38 | call to Data.init(_:) | testCryptoKit.swift:241:26:241:26 | value4 | provenance | | +| testCryptoKit.swift:240:23:240:23 | cardNumber | testCryptoKit.swift:240:23:240:34 | .utf8 | provenance | | +| testCryptoKit.swift:240:23:240:34 | .utf8 | testCryptoKit.swift:240:18:240:38 | call to Data.init(_:) | provenance | | +| testCryptoKit.swift:241:26:241:26 | value4 | testCryptoKit.swift:250:20:250:27 | value | provenance | | +| testCryptoKit.swift:243:18:243:38 | call to Data.init(_:) | testCryptoKit.swift:244:53:244:53 | value5 | provenance | | +| testCryptoKit.swift:243:23:243:23 | cardNumber | testCryptoKit.swift:243:23:243:34 | .utf8 | provenance | | +| testCryptoKit.swift:243:23:243:34 | .utf8 | testCryptoKit.swift:243:18:243:38 | call to Data.init(_:) | provenance | | +| testCryptoKit.swift:244:53:244:53 | value5 | testCryptoKit.swift:254:47:254:54 | value | provenance | | +| testCryptoKit.swift:250:20:250:27 | value | testCryptoKit.swift:251:43:251:43 | value | provenance | | +| testCryptoKit.swift:254:47:254:54 | value | testCryptoKit.swift:255:37:255:37 | value | provenance | | +nodes +| testCryptoKit.swift:86:43:86:43 | cert | semmle.label | cert | +| testCryptoKit.swift:88:43:88:43 | account_no | semmle.label | account_no | +| testCryptoKit.swift:89:43:89:43 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:93:36:93:36 | cert | semmle.label | cert | +| testCryptoKit.swift:95:36:95:36 | account_no | semmle.label | account_no | +| testCryptoKit.swift:96:36:96:36 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:100:44:100:44 | cert | semmle.label | cert | +| testCryptoKit.swift:102:44:102:44 | account_no | semmle.label | account_no | +| testCryptoKit.swift:103:44:103:44 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:130:23:130:23 | cert | semmle.label | cert | +| testCryptoKit.swift:132:23:132:23 | account_no | semmle.label | account_no | +| testCryptoKit.swift:133:23:133:23 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:139:23:139:23 | cert | semmle.label | cert | +| testCryptoKit.swift:141:23:141:23 | account_no | semmle.label | account_no | +| testCryptoKit.swift:142:23:142:23 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:175:32:175:32 | cert | semmle.label | cert | +| testCryptoKit.swift:177:32:177:32 | account_no | semmle.label | account_no | +| testCryptoKit.swift:178:32:178:32 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:184:32:184:32 | cert | semmle.label | cert | +| testCryptoKit.swift:186:32:186:32 | account_no | semmle.label | account_no | +| testCryptoKit.swift:187:32:187:32 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:230:18:230:38 | call to Data.init(_:) | semmle.label | call to Data.init(_:) | +| testCryptoKit.swift:230:23:230:23 | cardNumber | semmle.label | cardNumber | +| testCryptoKit.swift:230:23:230:34 | .utf8 | semmle.label | .utf8 | +| testCryptoKit.swift:231:44:231:44 | value1 | semmle.label | value1 | +| testCryptoKit.swift:233:18:233:38 | call to Data.init(_:) | semmle.label | call to Data.init(_:) | +| testCryptoKit.swift:233:23:233:23 | cardNumber | semmle.label | cardNumber | +| testCryptoKit.swift:233:23:233:34 | .utf8 | semmle.label | .utf8 | +| testCryptoKit.swift:235:39:235:39 | value2 | semmle.label | value2 | +| testCryptoKit.swift:237:18:237:38 | call to Data.init(_:) | semmle.label | call to Data.init(_:) | +| testCryptoKit.swift:237:23:237:23 | cardNumber | semmle.label | cardNumber | +| testCryptoKit.swift:237:23:237:34 | .utf8 | semmle.label | .utf8 | +| testCryptoKit.swift:238:51:238:51 | value3 | semmle.label | value3 | +| testCryptoKit.swift:240:18:240:38 | call to Data.init(_:) | semmle.label | call to Data.init(_:) | +| testCryptoKit.swift:240:23:240:23 | cardNumber | semmle.label | cardNumber | +| testCryptoKit.swift:240:23:240:34 | .utf8 | semmle.label | .utf8 | +| testCryptoKit.swift:241:26:241:26 | value4 | semmle.label | value4 | +| testCryptoKit.swift:243:18:243:38 | call to Data.init(_:) | semmle.label | call to Data.init(_:) | +| testCryptoKit.swift:243:23:243:23 | cardNumber | semmle.label | cardNumber | +| testCryptoKit.swift:243:23:243:34 | .utf8 | semmle.label | .utf8 | +| testCryptoKit.swift:244:53:244:53 | value5 | semmle.label | value5 | +| testCryptoKit.swift:250:20:250:27 | value | semmle.label | value | +| testCryptoKit.swift:251:43:251:43 | value | semmle.label | value | +| testCryptoKit.swift:254:47:254:54 | value | semmle.label | value | +| testCryptoKit.swift:255:37:255:37 | value | semmle.label | value | +| testCryptoSwift.swift:153:30:153:30 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:156:31:156:31 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:166:20:166:20 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:169:21:169:21 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:182:9:182:9 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:185:9:185:9 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:200:9:200:9 | medicalData | semmle.label | medicalData | +| testCryptoSwift.swift:203:9:203:9 | medicalData | semmle.label | medicalData | +| testCryptoSwift.swift:218:9:218:9 | creditCardNumber | semmle.label | creditCardNumber | +| testCryptoSwift.swift:221:9:221:9 | creditCardNumber | semmle.label | creditCardNumber | +subpaths +#select +| testCryptoKit.swift:86:43:86:43 | cert | testCryptoKit.swift:86:43:86:43 | cert | testCryptoKit.swift:86:43:86:43 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:86:43:86:43 | cert | sensitive data (credential cert) | +| testCryptoKit.swift:88:43:88:43 | account_no | testCryptoKit.swift:88:43:88:43 | account_no | testCryptoKit.swift:88:43:88:43 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:88:43:88:43 | account_no | sensitive data (private information account_no) | +| testCryptoKit.swift:89:43:89:43 | credit_card_no | testCryptoKit.swift:89:43:89:43 | credit_card_no | testCryptoKit.swift:89:43:89:43 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:89:43:89:43 | credit_card_no | sensitive data (private information credit_card_no) | +| testCryptoKit.swift:93:36:93:36 | cert | testCryptoKit.swift:93:36:93:36 | cert | testCryptoKit.swift:93:36:93:36 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:93:36:93:36 | cert | sensitive data (credential cert) | +| testCryptoKit.swift:95:36:95:36 | account_no | testCryptoKit.swift:95:36:95:36 | account_no | testCryptoKit.swift:95:36:95:36 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:95:36:95:36 | account_no | sensitive data (private information account_no) | +| testCryptoKit.swift:96:36:96:36 | credit_card_no | testCryptoKit.swift:96:36:96:36 | credit_card_no | testCryptoKit.swift:96:36:96:36 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:96:36:96:36 | credit_card_no | sensitive data (private information credit_card_no) | +| testCryptoKit.swift:100:44:100:44 | cert | testCryptoKit.swift:100:44:100:44 | cert | testCryptoKit.swift:100:44:100:44 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:100:44:100:44 | cert | sensitive data (credential cert) | +| testCryptoKit.swift:102:44:102:44 | account_no | testCryptoKit.swift:102:44:102:44 | account_no | testCryptoKit.swift:102:44:102:44 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:102:44:102:44 | account_no | sensitive data (private information account_no) | +| testCryptoKit.swift:103:44:103:44 | credit_card_no | testCryptoKit.swift:103:44:103:44 | credit_card_no | testCryptoKit.swift:103:44:103:44 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:103:44:103:44 | credit_card_no | sensitive data (private information credit_card_no) | +| testCryptoKit.swift:130:23:130:23 | cert | testCryptoKit.swift:130:23:130:23 | cert | testCryptoKit.swift:130:23:130:23 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:130:23:130:23 | cert | sensitive data (credential cert) | +| testCryptoKit.swift:132:23:132:23 | account_no | testCryptoKit.swift:132:23:132:23 | account_no | testCryptoKit.swift:132:23:132:23 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:132:23:132:23 | account_no | sensitive data (private information account_no) | +| testCryptoKit.swift:133:23:133:23 | credit_card_no | testCryptoKit.swift:133:23:133:23 | credit_card_no | testCryptoKit.swift:133:23:133:23 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:133:23:133:23 | credit_card_no | sensitive data (private information credit_card_no) | +| testCryptoKit.swift:139:23:139:23 | cert | testCryptoKit.swift:139:23:139:23 | cert | testCryptoKit.swift:139:23:139:23 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:139:23:139:23 | cert | sensitive data (credential cert) | +| testCryptoKit.swift:141:23:141:23 | account_no | testCryptoKit.swift:141:23:141:23 | account_no | testCryptoKit.swift:141:23:141:23 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:141:23:141:23 | account_no | sensitive data (private information account_no) | +| testCryptoKit.swift:142:23:142:23 | credit_card_no | testCryptoKit.swift:142:23:142:23 | credit_card_no | testCryptoKit.swift:142:23:142:23 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:142:23:142:23 | credit_card_no | sensitive data (private information credit_card_no) | +| testCryptoKit.swift:175:32:175:32 | cert | testCryptoKit.swift:175:32:175:32 | cert | testCryptoKit.swift:175:32:175:32 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:175:32:175:32 | cert | sensitive data (credential cert) | +| testCryptoKit.swift:177:32:177:32 | account_no | testCryptoKit.swift:177:32:177:32 | account_no | testCryptoKit.swift:177:32:177:32 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:177:32:177:32 | account_no | sensitive data (private information account_no) | +| testCryptoKit.swift:178:32:178:32 | credit_card_no | testCryptoKit.swift:178:32:178:32 | credit_card_no | testCryptoKit.swift:178:32:178:32 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:178:32:178:32 | credit_card_no | sensitive data (private information credit_card_no) | +| testCryptoKit.swift:184:32:184:32 | cert | testCryptoKit.swift:184:32:184:32 | cert | testCryptoKit.swift:184:32:184:32 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:184:32:184:32 | cert | sensitive data (credential cert) | +| testCryptoKit.swift:186:32:186:32 | account_no | testCryptoKit.swift:186:32:186:32 | account_no | testCryptoKit.swift:186:32:186:32 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:186:32:186:32 | account_no | sensitive data (private information account_no) | +| testCryptoKit.swift:187:32:187:32 | credit_card_no | testCryptoKit.swift:187:32:187:32 | credit_card_no | testCryptoKit.swift:187:32:187:32 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:187:32:187:32 | credit_card_no | sensitive data (private information credit_card_no) | +| testCryptoKit.swift:231:44:231:44 | value1 | testCryptoKit.swift:230:23:230:23 | cardNumber | testCryptoKit.swift:231:44:231:44 | value1 | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:230:23:230:23 | cardNumber | sensitive data (private information cardNumber) | +| testCryptoKit.swift:235:39:235:39 | value2 | testCryptoKit.swift:233:23:233:23 | cardNumber | testCryptoKit.swift:235:39:235:39 | value2 | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:233:23:233:23 | cardNumber | sensitive data (private information cardNumber) | +| testCryptoKit.swift:238:51:238:51 | value3 | testCryptoKit.swift:237:23:237:23 | cardNumber | testCryptoKit.swift:238:51:238:51 | value3 | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:237:23:237:23 | cardNumber | sensitive data (private information cardNumber) | +| testCryptoKit.swift:251:43:251:43 | value | testCryptoKit.swift:240:23:240:23 | cardNumber | testCryptoKit.swift:251:43:251:43 | value | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:240:23:240:23 | cardNumber | sensitive data (private information cardNumber) | +| testCryptoKit.swift:255:37:255:37 | value | testCryptoKit.swift:243:23:243:23 | cardNumber | testCryptoKit.swift:255:37:255:37 | value | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:243:23:243:23 | cardNumber | sensitive data (private information cardNumber) | +| testCryptoSwift.swift:153:30:153:30 | phoneNumberArray | testCryptoSwift.swift:153:30:153:30 | phoneNumberArray | testCryptoSwift.swift:153:30:153:30 | phoneNumberArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:153:30:153:30 | phoneNumberArray | sensitive data (private information phoneNumberArray) | +| testCryptoSwift.swift:156:31:156:31 | phoneNumberArray | testCryptoSwift.swift:156:31:156:31 | phoneNumberArray | testCryptoSwift.swift:156:31:156:31 | phoneNumberArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:156:31:156:31 | phoneNumberArray | sensitive data (private information phoneNumberArray) | +| testCryptoSwift.swift:166:20:166:20 | phoneNumberArray | testCryptoSwift.swift:166:20:166:20 | phoneNumberArray | testCryptoSwift.swift:166:20:166:20 | phoneNumberArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:166:20:166:20 | phoneNumberArray | sensitive data (private information phoneNumberArray) | +| testCryptoSwift.swift:169:21:169:21 | phoneNumberArray | testCryptoSwift.swift:169:21:169:21 | phoneNumberArray | testCryptoSwift.swift:169:21:169:21 | phoneNumberArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:169:21:169:21 | phoneNumberArray | sensitive data (private information phoneNumberArray) | +| testCryptoSwift.swift:182:9:182:9 | phoneNumberArray | testCryptoSwift.swift:182:9:182:9 | phoneNumberArray | testCryptoSwift.swift:182:9:182:9 | phoneNumberArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:182:9:182:9 | phoneNumberArray | sensitive data (private information phoneNumberArray) | +| testCryptoSwift.swift:185:9:185:9 | phoneNumberArray | testCryptoSwift.swift:185:9:185:9 | phoneNumberArray | testCryptoSwift.swift:185:9:185:9 | phoneNumberArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:185:9:185:9 | phoneNumberArray | sensitive data (private information phoneNumberArray) | +| testCryptoSwift.swift:200:9:200:9 | medicalData | testCryptoSwift.swift:200:9:200:9 | medicalData | testCryptoSwift.swift:200:9:200:9 | medicalData | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:200:9:200:9 | medicalData | sensitive data (private information medicalData) | +| testCryptoSwift.swift:203:9:203:9 | medicalData | testCryptoSwift.swift:203:9:203:9 | medicalData | testCryptoSwift.swift:203:9:203:9 | medicalData | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:203:9:203:9 | medicalData | sensitive data (private information medicalData) | +| testCryptoSwift.swift:218:9:218:9 | creditCardNumber | testCryptoSwift.swift:218:9:218:9 | creditCardNumber | testCryptoSwift.swift:218:9:218:9 | creditCardNumber | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:218:9:218:9 | creditCardNumber | sensitive data (private information creditCardNumber) | +| testCryptoSwift.swift:221:9:221:9 | creditCardNumber | testCryptoSwift.swift:221:9:221:9 | creditCardNumber | testCryptoSwift.swift:221:9:221:9 | creditCardNumber | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:221:9:221:9 | creditCardNumber | sensitive data (private information creditCardNumber) | diff --git a/unified/ql/test/query-tests/security/CWE-328/WeakSensitiveDataHashing.qlref b/unified/ql/test/query-tests/security/CWE-328/WeakSensitiveDataHashing.qlref new file mode 100644 index 000000000000..d76eeef6c2f2 --- /dev/null +++ b/unified/ql/test/query-tests/security/CWE-328/WeakSensitiveDataHashing.qlref @@ -0,0 +1,2 @@ +query: queries/Security/CWE-328/WeakSensitiveDataHashing.ql +postprocess: utils/test/InlineExpectationsTestQuery.ql From 01925aaa2216464aee66bf6ec2c505d3988f42de Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 3 Dec 2026 16:54:26 +0000 Subject: [PATCH 10/14] unified: Collect original Swift weak sensitive data hashing configuration and models Inline the data flow configuration and query-specific models unchanged from WeakSensitiveDataHashingQuery.qll and WeakSensitiveDataHashingExtensions.qll, marking their provenance before adapting to unified Swift APIs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../CWE-328/WeakSensitiveDataHashing.ql | 154 +++++++++++++++++- 1 file changed, 153 insertions(+), 1 deletion(-) diff --git a/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.ql b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.ql index e653d9706611..fb51f6301520 100755 --- a/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.ql +++ b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.ql @@ -12,9 +12,161 @@ */ import swift -import codeql.swift.security.WeakSensitiveDataHashingQuery +import codeql.swift.security.SensitiveExprs +import codeql.swift.dataflow.DataFlow +import codeql.swift.dataflow.TaintTracking +import codeql.swift.dataflow.ExternalFlow import WeakSensitiveDataHashingFlow::PathGraph +// Copied from swift/ql/lib/codeql/swift/security/WeakSensitiveDataHashingQuery.qll. +/** + * Provides a taint tracking configuration to find use of broken or weak + * cryptographic hashing algorithms on sensitive data. + */ + +/** + * A taint tracking configuration from sensitive expressions to broken or weak + * hashing sinks. + */ +module WeakSensitiveDataHashingConfig implements DataFlow::ConfigSig { + predicate isSource(DataFlow::Node node) { + exists(SensitiveExpr se | + node.asExpr() = se and + not se.getSensitiveType() instanceof SensitivePassword // responsibility of the weak password hashing query + ) + } + + predicate isSink(DataFlow::Node node) { node instanceof WeakSensitiveDataHashingSink } + + predicate isBarrier(DataFlow::Node node) { node instanceof WeakSensitiveDataHashingBarrier } + + predicate isBarrierIn(DataFlow::Node node) { + // make sources barriers so that we only report the closest instance + isSource(node) + } + + predicate isBarrierOut(DataFlow::Node node) { + // make sinks barriers so that we only report the closest instance + isSink(node) + } + + predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) { + any(WeakSensitiveDataHashingAdditionalFlowStep s).step(nodeFrom, nodeTo) + } + + predicate observeDiffInformedIncrementalMode() { any() } +} + +module WeakSensitiveDataHashingFlow = TaintTracking::Global; + +// Copied from swift/ql/lib/codeql/swift/security/WeakSensitiveDataHashingExtensions.qll. +/** + * Provides classes and predicates for reasoning about use of broken or weak + * cryptographic hashing algorithms on sensitive data. + */ + +/** + * A dataflow sink for weak sensitive data hashing vulnerabilities. That is, + * a `DataFlow::Node` that is passed into a weak hashing function. + */ +abstract class WeakSensitiveDataHashingSink extends DataFlow::Node { + /** + * Gets the name of the hashing algorithm, for display. + */ + abstract string getAlgorithm(); +} + +/** + * A barrier for weak sensitive data hashing vulnerabilities. + */ +abstract class WeakSensitiveDataHashingBarrier extends DataFlow::Node { } + +/** + * A unit class for adding additional flow steps. + */ +class WeakSensitiveDataHashingAdditionalFlowStep extends Unit { + /** + * Holds if the step from `node1` to `node2` should be considered a flow + * step for paths related to weak sensitive data hashing vulnerabilities. + */ + abstract predicate step(DataFlow::Node nodeFrom, DataFlow::Node nodeTo); +} + +private class WeakSensitiveDataHashingSinks extends SinkModelCsv { + override predicate row(string row) { + row = + [ + // CryptoKit + ";Insecure.MD5;true;hash(data:);;;Argument[0];weak-hash-input-MD5", + ";Insecure.MD5;true;hash(bufferPointer:);;;Argument[0];weak-hash-input-MD5", + ";Insecure.MD5;true;update(data:);;;Argument[0];weak-hash-input-MD5", + ";Insecure.MD5;true;update(bufferPointer:);;;Argument[0];weak-hash-input-MD5", + ";Insecure.SHA1;true;hash(data:);;;Argument[0];weak-hash-input-SHA1", + ";Insecure.SHA1;true;hash(bufferPointer:);;;Argument[0];weak-hash-input-SHA1", + ";Insecure.SHA1;true;update(data:);;;Argument[0];weak-hash-input-SHA1", + ";Insecure.SHA1;true;update(bufferPointer:);;;Argument[0];weak-hash-input-SHA1", + // CryptoSwift + ";MD5;true;calculate(for:);;;Argument[0];weak-hash-input-MD5", + ";MD5;true;callAsFunction(_:);;;Argument[0];weak-hash-input-MD5", + ";MD5;true;process(block:currentHash:);;;Argument[0];weak-hash-input-MD5", + ";MD5;true;update(withBytes:isLast:);;;Argument[0];weak-hash-input-MD5", + ";SHA1;true;calculate(for:);;;Argument[0];weak-hash-input-SHA1", + ";SHA1;true;callAsFunction(_:);;;Argument[0];weak-hash-input-SHA1", + ";SHA1;true;process(block:currentHash:);;;Argument[0];weak-hash-input-SHA1", + ";SHA1;true;update(withBytes:isLast:);;;Argument[0];weak-hash-input-SHA1", + ";Digest;true;md5(_:);;;Argument[0];weak-hash-input-MD5", + ";Digest;true;sha1(_:);;;Argument[0];weak-hash-input-SHA1", + ";Array;true;md5();;;Argument[-1];weak-hash-input-MD5", + ";Array;true;sha1();;;Argument[-1];weak-hash-input-SHA1", + ";Data;true;md5();;;Argument[-1];weak-hash-input-MD5", + ";Data;true;sha1();;;Argument[-1];weak-hash-input-SHA1", + ";String;true;md5();;;Argument[-1];weak-hash-input-MD5", + ";String;true;sha1();;;Argument[-1];weak-hash-input-SHA1", + ] + } +} + +/** + * A sink defined in a CSV model. + */ +private class DefaultWeakSensitiveDataHashingSink extends WeakSensitiveDataHashingSink { + string algorithm; + + DefaultWeakSensitiveDataHashingSink() { sinkNode(this, "weak-hash-input-" + algorithm) } + + override string getAlgorithm() { result = algorithm } +} + +/** + * A sink for weak sensitive data hashing through a call with a metatype qualifier. + */ +private class WeakSensitiveDataHashingMetatypeSink extends WeakSensitiveDataHashingSink { + string algorithm; + + WeakSensitiveDataHashingMetatypeSink() { + exists(CallExpr ce, Type t | + // call target + ce.getStaticTarget().getName() = + ["hash(data:)", "hash(bufferPointer:)", "update(data:)", "update(bufferPointer:)"] and + // argument + ce.getAnArgument().getExpr() = this.asExpr() and + // qualifier + t = ce.getQualifier().getType() and + algorithm = ["MD5", "SHA1"] and + ( + t.getFullName() = "Insecure." + algorithm + or + exists(TypeDecl td | + td.getInterfaceType() = t and + td.getFullName() = "Insecure." + algorithm + ) + ) + ) + } + + override string getAlgorithm() { result = algorithm } +} + from WeakSensitiveDataHashingFlow::PathNode source, WeakSensitiveDataHashingFlow::PathNode sink, string algorithm, SensitiveExpr expr From f48e49a3b7f81f9326ff820b746c84395cb5143d Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 3 Dec 2026 17:08:48 +0000 Subject: [PATCH 11/14] unified: Port weak sensitive data hashing query with compiling test baseline Adapt WeakSensitiveDataHashing.ql to unified Swift using SensitiveData sources (excluding passwords, which are handled by unified/swift/weak-password-hashing) and existing weak-hash-input-* models from legacy-swift.model.json. Update the query ID, .qlref, and inline expectations in the shared CWE-328 tests. All 37 expected positive cases (including all 6 metatype/flow cases in testWithFlowAndMetatypes, even the previously missed generic testReceiver3) are detected with 0 testFailures (172 #select rows total). Because LegacyMaD currently ignores receiver types for method calls, SHA256/SHA384/SHA512 hash/update and SHA2/SHA3 calculate calls currently produce SPURIOUS alerts documented via inline expectations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../CWE-328/WeakSensitiveDataHashing.ql | 149 +----- .../CWE-328/WeakSensitiveDataHashing.expected | 456 +++++++++++++----- .../CWE-328/WeakSensitiveDataHashing.qlref | 5 +- .../security/CWE-328/testCryptoKit.swift | 120 ++--- .../security/CWE-328/testCryptoSwift.swift | 44 +- 5 files changed, 447 insertions(+), 327 deletions(-) mode change 100755 => 100644 unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.ql diff --git a/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.ql b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.ql old mode 100755 new mode 100644 index fb51f6301520..effc162b5410 --- a/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.ql +++ b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.ql @@ -5,24 +5,23 @@ * @problem.severity warning * @security-severity 7.5 * @precision high - * @id swift/weak-sensitive-data-hashing + * @id unified/swift/weak-sensitive-data-hashing * @tags security * external/cwe/cwe-327 * external/cwe/cwe-328 */ -import swift -import codeql.swift.security.SensitiveExprs -import codeql.swift.dataflow.DataFlow -import codeql.swift.dataflow.TaintTracking -import codeql.swift.dataflow.ExternalFlow -import WeakSensitiveDataHashingFlow::PathGraph +import unified +import codeql.unified.security.SensitiveData -// Copied from swift/ql/lib/codeql/swift/security/WeakSensitiveDataHashingQuery.qll. /** - * Provides a taint tracking configuration to find use of broken or weak - * cryptographic hashing algorithms on sensitive data. + * Holds if `node` is a sink for weak sensitive data hashing using `algorithm`. */ +private predicate isWeakSensitiveDataHashingSink(DataFlow::Node node, string algorithm) { + exists(string kind | Models::isSink(node, kind) | + algorithm = kind.regexpCapture("weak-hash-input-(.+)", 1) + ) +} /** * A taint tracking configuration from sensitive expressions to broken or weak @@ -30,15 +29,11 @@ import WeakSensitiveDataHashingFlow::PathGraph */ module WeakSensitiveDataHashingConfig implements DataFlow::ConfigSig { predicate isSource(DataFlow::Node node) { - exists(SensitiveExpr se | - node.asExpr() = se and - not se.getSensitiveType() instanceof SensitivePassword // responsibility of the weak password hashing query - ) + node instanceof SensitiveData and + not node.(SensitiveData).getClassification() = SensitiveDataClassification::password() // responsibility of the weak password hashing query } - predicate isSink(DataFlow::Node node) { node instanceof WeakSensitiveDataHashingSink } - - predicate isBarrier(DataFlow::Node node) { node instanceof WeakSensitiveDataHashingBarrier } + predicate isSink(DataFlow::Node node) { isWeakSensitiveDataHashingSink(node, _) } predicate isBarrierIn(DataFlow::Node node) { // make sources barriers so that we only report the closest instance @@ -50,130 +45,20 @@ module WeakSensitiveDataHashingConfig implements DataFlow::ConfigSig { isSink(node) } - predicate isAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) { - any(WeakSensitiveDataHashingAdditionalFlowStep s).step(nodeFrom, nodeTo) - } - predicate observeDiffInformedIncrementalMode() { any() } } module WeakSensitiveDataHashingFlow = TaintTracking::Global; -// Copied from swift/ql/lib/codeql/swift/security/WeakSensitiveDataHashingExtensions.qll. -/** - * Provides classes and predicates for reasoning about use of broken or weak - * cryptographic hashing algorithms on sensitive data. - */ - -/** - * A dataflow sink for weak sensitive data hashing vulnerabilities. That is, - * a `DataFlow::Node` that is passed into a weak hashing function. - */ -abstract class WeakSensitiveDataHashingSink extends DataFlow::Node { - /** - * Gets the name of the hashing algorithm, for display. - */ - abstract string getAlgorithm(); -} - -/** - * A barrier for weak sensitive data hashing vulnerabilities. - */ -abstract class WeakSensitiveDataHashingBarrier extends DataFlow::Node { } - -/** - * A unit class for adding additional flow steps. - */ -class WeakSensitiveDataHashingAdditionalFlowStep extends Unit { - /** - * Holds if the step from `node1` to `node2` should be considered a flow - * step for paths related to weak sensitive data hashing vulnerabilities. - */ - abstract predicate step(DataFlow::Node nodeFrom, DataFlow::Node nodeTo); -} - -private class WeakSensitiveDataHashingSinks extends SinkModelCsv { - override predicate row(string row) { - row = - [ - // CryptoKit - ";Insecure.MD5;true;hash(data:);;;Argument[0];weak-hash-input-MD5", - ";Insecure.MD5;true;hash(bufferPointer:);;;Argument[0];weak-hash-input-MD5", - ";Insecure.MD5;true;update(data:);;;Argument[0];weak-hash-input-MD5", - ";Insecure.MD5;true;update(bufferPointer:);;;Argument[0];weak-hash-input-MD5", - ";Insecure.SHA1;true;hash(data:);;;Argument[0];weak-hash-input-SHA1", - ";Insecure.SHA1;true;hash(bufferPointer:);;;Argument[0];weak-hash-input-SHA1", - ";Insecure.SHA1;true;update(data:);;;Argument[0];weak-hash-input-SHA1", - ";Insecure.SHA1;true;update(bufferPointer:);;;Argument[0];weak-hash-input-SHA1", - // CryptoSwift - ";MD5;true;calculate(for:);;;Argument[0];weak-hash-input-MD5", - ";MD5;true;callAsFunction(_:);;;Argument[0];weak-hash-input-MD5", - ";MD5;true;process(block:currentHash:);;;Argument[0];weak-hash-input-MD5", - ";MD5;true;update(withBytes:isLast:);;;Argument[0];weak-hash-input-MD5", - ";SHA1;true;calculate(for:);;;Argument[0];weak-hash-input-SHA1", - ";SHA1;true;callAsFunction(_:);;;Argument[0];weak-hash-input-SHA1", - ";SHA1;true;process(block:currentHash:);;;Argument[0];weak-hash-input-SHA1", - ";SHA1;true;update(withBytes:isLast:);;;Argument[0];weak-hash-input-SHA1", - ";Digest;true;md5(_:);;;Argument[0];weak-hash-input-MD5", - ";Digest;true;sha1(_:);;;Argument[0];weak-hash-input-SHA1", - ";Array;true;md5();;;Argument[-1];weak-hash-input-MD5", - ";Array;true;sha1();;;Argument[-1];weak-hash-input-SHA1", - ";Data;true;md5();;;Argument[-1];weak-hash-input-MD5", - ";Data;true;sha1();;;Argument[-1];weak-hash-input-SHA1", - ";String;true;md5();;;Argument[-1];weak-hash-input-MD5", - ";String;true;sha1();;;Argument[-1];weak-hash-input-SHA1", - ] - } -} - -/** - * A sink defined in a CSV model. - */ -private class DefaultWeakSensitiveDataHashingSink extends WeakSensitiveDataHashingSink { - string algorithm; - - DefaultWeakSensitiveDataHashingSink() { sinkNode(this, "weak-hash-input-" + algorithm) } - - override string getAlgorithm() { result = algorithm } -} - -/** - * A sink for weak sensitive data hashing through a call with a metatype qualifier. - */ -private class WeakSensitiveDataHashingMetatypeSink extends WeakSensitiveDataHashingSink { - string algorithm; - - WeakSensitiveDataHashingMetatypeSink() { - exists(CallExpr ce, Type t | - // call target - ce.getStaticTarget().getName() = - ["hash(data:)", "hash(bufferPointer:)", "update(data:)", "update(bufferPointer:)"] and - // argument - ce.getAnArgument().getExpr() = this.asExpr() and - // qualifier - t = ce.getQualifier().getType() and - algorithm = ["MD5", "SHA1"] and - ( - t.getFullName() = "Insecure." + algorithm - or - exists(TypeDecl td | - td.getInterfaceType() = t and - td.getFullName() = "Insecure." + algorithm - ) - ) - ) - } - - override string getAlgorithm() { result = algorithm } -} +import WeakSensitiveDataHashingFlow::PathGraph from WeakSensitiveDataHashingFlow::PathNode source, WeakSensitiveDataHashingFlow::PathNode sink, - string algorithm, SensitiveExpr expr + string algorithm, SensitiveData sensitiveData where WeakSensitiveDataHashingFlow::flowPath(source, sink) and - algorithm = sink.getNode().(WeakSensitiveDataHashingSink).getAlgorithm() and - expr = source.getNode().asExpr() + isWeakSensitiveDataHashingSink(sink.getNode(), algorithm) and + sensitiveData = source.getNode() select sink.getNode(), source, sink, "Insecure hashing algorithm (" + algorithm + ") depends on $@.", source.getNode(), - "sensitive data (" + expr.getSensitiveType() + " " + expr.getLabel() + ")" + "sensitive data (" + sensitiveData.getClassification() + " " + sensitiveData.toString() + ")" diff --git a/unified/ql/test/query-tests/security/CWE-328/WeakSensitiveDataHashing.expected b/unified/ql/test/query-tests/security/CWE-328/WeakSensitiveDataHashing.expected index ebb8154b0f8e..0cf4de4515cd 100644 --- a/unified/ql/test/query-tests/security/CWE-328/WeakSensitiveDataHashing.expected +++ b/unified/ql/test/query-tests/security/CWE-328/WeakSensitiveDataHashing.expected @@ -1,114 +1,348 @@ +#select +| testCryptoKit.swift:86:43:86:46 | cert | testCryptoKit.swift:86:43:86:46 | cert | testCryptoKit.swift:86:43:86:46 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:86:43:86:46 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:86:43:86:46 | cert | testCryptoKit.swift:86:43:86:46 | cert | testCryptoKit.swift:86:43:86:46 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:86:43:86:46 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:88:43:88:52 | account_no | testCryptoKit.swift:88:43:88:52 | account_no | testCryptoKit.swift:88:43:88:52 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:88:43:88:52 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:88:43:88:52 | account_no | testCryptoKit.swift:88:43:88:52 | account_no | testCryptoKit.swift:88:43:88:52 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:88:43:88:52 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:88:43:88:52 | account_no | testCryptoKit.swift:88:43:88:52 | account_no | testCryptoKit.swift:88:43:88:52 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:88:43:88:52 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:88:43:88:52 | account_no | testCryptoKit.swift:88:43:88:52 | account_no | testCryptoKit.swift:88:43:88:52 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:88:43:88:52 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:89:43:89:56 | credit_card_no | testCryptoKit.swift:89:43:89:56 | credit_card_no | testCryptoKit.swift:89:43:89:56 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:89:43:89:56 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:89:43:89:56 | credit_card_no | testCryptoKit.swift:89:43:89:56 | credit_card_no | testCryptoKit.swift:89:43:89:56 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:89:43:89:56 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:93:36:93:39 | cert | testCryptoKit.swift:93:36:93:39 | cert | testCryptoKit.swift:93:36:93:39 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:93:36:93:39 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:93:36:93:39 | cert | testCryptoKit.swift:93:36:93:39 | cert | testCryptoKit.swift:93:36:93:39 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:93:36:93:39 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:95:36:95:45 | account_no | testCryptoKit.swift:95:36:95:45 | account_no | testCryptoKit.swift:95:36:95:45 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:95:36:95:45 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:95:36:95:45 | account_no | testCryptoKit.swift:95:36:95:45 | account_no | testCryptoKit.swift:95:36:95:45 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:95:36:95:45 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:95:36:95:45 | account_no | testCryptoKit.swift:95:36:95:45 | account_no | testCryptoKit.swift:95:36:95:45 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:95:36:95:45 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:95:36:95:45 | account_no | testCryptoKit.swift:95:36:95:45 | account_no | testCryptoKit.swift:95:36:95:45 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:95:36:95:45 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:96:36:96:49 | credit_card_no | testCryptoKit.swift:96:36:96:49 | credit_card_no | testCryptoKit.swift:96:36:96:49 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:96:36:96:49 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:96:36:96:49 | credit_card_no | testCryptoKit.swift:96:36:96:49 | credit_card_no | testCryptoKit.swift:96:36:96:49 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:96:36:96:49 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:100:44:100:47 | cert | testCryptoKit.swift:100:44:100:47 | cert | testCryptoKit.swift:100:44:100:47 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:100:44:100:47 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:100:44:100:47 | cert | testCryptoKit.swift:100:44:100:47 | cert | testCryptoKit.swift:100:44:100:47 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:100:44:100:47 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:102:44:102:53 | account_no | testCryptoKit.swift:102:44:102:53 | account_no | testCryptoKit.swift:102:44:102:53 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:102:44:102:53 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:102:44:102:53 | account_no | testCryptoKit.swift:102:44:102:53 | account_no | testCryptoKit.swift:102:44:102:53 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:102:44:102:53 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:102:44:102:53 | account_no | testCryptoKit.swift:102:44:102:53 | account_no | testCryptoKit.swift:102:44:102:53 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:102:44:102:53 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:102:44:102:53 | account_no | testCryptoKit.swift:102:44:102:53 | account_no | testCryptoKit.swift:102:44:102:53 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:102:44:102:53 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:103:44:103:57 | credit_card_no | testCryptoKit.swift:103:44:103:57 | credit_card_no | testCryptoKit.swift:103:44:103:57 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:103:44:103:57 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:103:44:103:57 | credit_card_no | testCryptoKit.swift:103:44:103:57 | credit_card_no | testCryptoKit.swift:103:44:103:57 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:103:44:103:57 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:107:37:107:40 | cert | testCryptoKit.swift:107:37:107:40 | cert | testCryptoKit.swift:107:37:107:40 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:107:37:107:40 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:107:37:107:40 | cert | testCryptoKit.swift:107:37:107:40 | cert | testCryptoKit.swift:107:37:107:40 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:107:37:107:40 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:109:37:109:46 | account_no | testCryptoKit.swift:109:37:109:46 | account_no | testCryptoKit.swift:109:37:109:46 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:109:37:109:46 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:109:37:109:46 | account_no | testCryptoKit.swift:109:37:109:46 | account_no | testCryptoKit.swift:109:37:109:46 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:109:37:109:46 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:109:37:109:46 | account_no | testCryptoKit.swift:109:37:109:46 | account_no | testCryptoKit.swift:109:37:109:46 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:109:37:109:46 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:109:37:109:46 | account_no | testCryptoKit.swift:109:37:109:46 | account_no | testCryptoKit.swift:109:37:109:46 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:109:37:109:46 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:110:37:110:50 | credit_card_no | testCryptoKit.swift:110:37:110:50 | credit_card_no | testCryptoKit.swift:110:37:110:50 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:110:37:110:50 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:110:37:110:50 | credit_card_no | testCryptoKit.swift:110:37:110:50 | credit_card_no | testCryptoKit.swift:110:37:110:50 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:110:37:110:50 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:114:37:114:40 | cert | testCryptoKit.swift:114:37:114:40 | cert | testCryptoKit.swift:114:37:114:40 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:114:37:114:40 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:114:37:114:40 | cert | testCryptoKit.swift:114:37:114:40 | cert | testCryptoKit.swift:114:37:114:40 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:114:37:114:40 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:116:37:116:46 | account_no | testCryptoKit.swift:116:37:116:46 | account_no | testCryptoKit.swift:116:37:116:46 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:116:37:116:46 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:116:37:116:46 | account_no | testCryptoKit.swift:116:37:116:46 | account_no | testCryptoKit.swift:116:37:116:46 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:116:37:116:46 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:116:37:116:46 | account_no | testCryptoKit.swift:116:37:116:46 | account_no | testCryptoKit.swift:116:37:116:46 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:116:37:116:46 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:116:37:116:46 | account_no | testCryptoKit.swift:116:37:116:46 | account_no | testCryptoKit.swift:116:37:116:46 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:116:37:116:46 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:117:37:117:50 | credit_card_no | testCryptoKit.swift:117:37:117:50 | credit_card_no | testCryptoKit.swift:117:37:117:50 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:117:37:117:50 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:117:37:117:50 | credit_card_no | testCryptoKit.swift:117:37:117:50 | credit_card_no | testCryptoKit.swift:117:37:117:50 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:117:37:117:50 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:121:37:121:40 | cert | testCryptoKit.swift:121:37:121:40 | cert | testCryptoKit.swift:121:37:121:40 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:121:37:121:40 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:121:37:121:40 | cert | testCryptoKit.swift:121:37:121:40 | cert | testCryptoKit.swift:121:37:121:40 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:121:37:121:40 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:123:37:123:46 | account_no | testCryptoKit.swift:123:37:123:46 | account_no | testCryptoKit.swift:123:37:123:46 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:123:37:123:46 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:123:37:123:46 | account_no | testCryptoKit.swift:123:37:123:46 | account_no | testCryptoKit.swift:123:37:123:46 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:123:37:123:46 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:123:37:123:46 | account_no | testCryptoKit.swift:123:37:123:46 | account_no | testCryptoKit.swift:123:37:123:46 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:123:37:123:46 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:123:37:123:46 | account_no | testCryptoKit.swift:123:37:123:46 | account_no | testCryptoKit.swift:123:37:123:46 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:123:37:123:46 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:124:37:124:50 | credit_card_no | testCryptoKit.swift:124:37:124:50 | credit_card_no | testCryptoKit.swift:124:37:124:50 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:124:37:124:50 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:124:37:124:50 | credit_card_no | testCryptoKit.swift:124:37:124:50 | credit_card_no | testCryptoKit.swift:124:37:124:50 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:124:37:124:50 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:130:23:130:26 | cert | testCryptoKit.swift:130:23:130:26 | cert | testCryptoKit.swift:130:23:130:26 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:130:23:130:26 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:130:23:130:26 | cert | testCryptoKit.swift:130:23:130:26 | cert | testCryptoKit.swift:130:23:130:26 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:130:23:130:26 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:132:23:132:32 | account_no | testCryptoKit.swift:132:23:132:32 | account_no | testCryptoKit.swift:132:23:132:32 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:132:23:132:32 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:132:23:132:32 | account_no | testCryptoKit.swift:132:23:132:32 | account_no | testCryptoKit.swift:132:23:132:32 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:132:23:132:32 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:132:23:132:32 | account_no | testCryptoKit.swift:132:23:132:32 | account_no | testCryptoKit.swift:132:23:132:32 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:132:23:132:32 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:132:23:132:32 | account_no | testCryptoKit.swift:132:23:132:32 | account_no | testCryptoKit.swift:132:23:132:32 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:132:23:132:32 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:133:23:133:36 | credit_card_no | testCryptoKit.swift:133:23:133:36 | credit_card_no | testCryptoKit.swift:133:23:133:36 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:133:23:133:36 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:133:23:133:36 | credit_card_no | testCryptoKit.swift:133:23:133:36 | credit_card_no | testCryptoKit.swift:133:23:133:36 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:133:23:133:36 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:139:23:139:26 | cert | testCryptoKit.swift:139:23:139:26 | cert | testCryptoKit.swift:139:23:139:26 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:139:23:139:26 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:139:23:139:26 | cert | testCryptoKit.swift:139:23:139:26 | cert | testCryptoKit.swift:139:23:139:26 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:139:23:139:26 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:141:23:141:32 | account_no | testCryptoKit.swift:141:23:141:32 | account_no | testCryptoKit.swift:141:23:141:32 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:141:23:141:32 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:141:23:141:32 | account_no | testCryptoKit.swift:141:23:141:32 | account_no | testCryptoKit.swift:141:23:141:32 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:141:23:141:32 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:141:23:141:32 | account_no | testCryptoKit.swift:141:23:141:32 | account_no | testCryptoKit.swift:141:23:141:32 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:141:23:141:32 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:141:23:141:32 | account_no | testCryptoKit.swift:141:23:141:32 | account_no | testCryptoKit.swift:141:23:141:32 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:141:23:141:32 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:142:23:142:36 | credit_card_no | testCryptoKit.swift:142:23:142:36 | credit_card_no | testCryptoKit.swift:142:23:142:36 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:142:23:142:36 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:142:23:142:36 | credit_card_no | testCryptoKit.swift:142:23:142:36 | credit_card_no | testCryptoKit.swift:142:23:142:36 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:142:23:142:36 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:148:23:148:26 | cert | testCryptoKit.swift:148:23:148:26 | cert | testCryptoKit.swift:148:23:148:26 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:148:23:148:26 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:148:23:148:26 | cert | testCryptoKit.swift:148:23:148:26 | cert | testCryptoKit.swift:148:23:148:26 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:148:23:148:26 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:150:23:150:32 | account_no | testCryptoKit.swift:150:23:150:32 | account_no | testCryptoKit.swift:150:23:150:32 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:150:23:150:32 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:150:23:150:32 | account_no | testCryptoKit.swift:150:23:150:32 | account_no | testCryptoKit.swift:150:23:150:32 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:150:23:150:32 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:150:23:150:32 | account_no | testCryptoKit.swift:150:23:150:32 | account_no | testCryptoKit.swift:150:23:150:32 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:150:23:150:32 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:150:23:150:32 | account_no | testCryptoKit.swift:150:23:150:32 | account_no | testCryptoKit.swift:150:23:150:32 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:150:23:150:32 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:151:23:151:36 | credit_card_no | testCryptoKit.swift:151:23:151:36 | credit_card_no | testCryptoKit.swift:151:23:151:36 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:151:23:151:36 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:151:23:151:36 | credit_card_no | testCryptoKit.swift:151:23:151:36 | credit_card_no | testCryptoKit.swift:151:23:151:36 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:151:23:151:36 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:157:23:157:26 | cert | testCryptoKit.swift:157:23:157:26 | cert | testCryptoKit.swift:157:23:157:26 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:157:23:157:26 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:157:23:157:26 | cert | testCryptoKit.swift:157:23:157:26 | cert | testCryptoKit.swift:157:23:157:26 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:157:23:157:26 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:159:23:159:32 | account_no | testCryptoKit.swift:159:23:159:32 | account_no | testCryptoKit.swift:159:23:159:32 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:159:23:159:32 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:159:23:159:32 | account_no | testCryptoKit.swift:159:23:159:32 | account_no | testCryptoKit.swift:159:23:159:32 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:159:23:159:32 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:159:23:159:32 | account_no | testCryptoKit.swift:159:23:159:32 | account_no | testCryptoKit.swift:159:23:159:32 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:159:23:159:32 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:159:23:159:32 | account_no | testCryptoKit.swift:159:23:159:32 | account_no | testCryptoKit.swift:159:23:159:32 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:159:23:159:32 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:160:23:160:36 | credit_card_no | testCryptoKit.swift:160:23:160:36 | credit_card_no | testCryptoKit.swift:160:23:160:36 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:160:23:160:36 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:160:23:160:36 | credit_card_no | testCryptoKit.swift:160:23:160:36 | credit_card_no | testCryptoKit.swift:160:23:160:36 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:160:23:160:36 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:166:23:166:26 | cert | testCryptoKit.swift:166:23:166:26 | cert | testCryptoKit.swift:166:23:166:26 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:166:23:166:26 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:166:23:166:26 | cert | testCryptoKit.swift:166:23:166:26 | cert | testCryptoKit.swift:166:23:166:26 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:166:23:166:26 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:168:23:168:32 | account_no | testCryptoKit.swift:168:23:168:32 | account_no | testCryptoKit.swift:168:23:168:32 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:168:23:168:32 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:168:23:168:32 | account_no | testCryptoKit.swift:168:23:168:32 | account_no | testCryptoKit.swift:168:23:168:32 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:168:23:168:32 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:168:23:168:32 | account_no | testCryptoKit.swift:168:23:168:32 | account_no | testCryptoKit.swift:168:23:168:32 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:168:23:168:32 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:168:23:168:32 | account_no | testCryptoKit.swift:168:23:168:32 | account_no | testCryptoKit.swift:168:23:168:32 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:168:23:168:32 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:169:23:169:36 | credit_card_no | testCryptoKit.swift:169:23:169:36 | credit_card_no | testCryptoKit.swift:169:23:169:36 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:169:23:169:36 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:169:23:169:36 | credit_card_no | testCryptoKit.swift:169:23:169:36 | credit_card_no | testCryptoKit.swift:169:23:169:36 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:169:23:169:36 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:175:32:175:35 | cert | testCryptoKit.swift:175:32:175:35 | cert | testCryptoKit.swift:175:32:175:35 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:175:32:175:35 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:175:32:175:35 | cert | testCryptoKit.swift:175:32:175:35 | cert | testCryptoKit.swift:175:32:175:35 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:175:32:175:35 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:177:32:177:41 | account_no | testCryptoKit.swift:177:32:177:41 | account_no | testCryptoKit.swift:177:32:177:41 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:177:32:177:41 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:177:32:177:41 | account_no | testCryptoKit.swift:177:32:177:41 | account_no | testCryptoKit.swift:177:32:177:41 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:177:32:177:41 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:177:32:177:41 | account_no | testCryptoKit.swift:177:32:177:41 | account_no | testCryptoKit.swift:177:32:177:41 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:177:32:177:41 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:177:32:177:41 | account_no | testCryptoKit.swift:177:32:177:41 | account_no | testCryptoKit.swift:177:32:177:41 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:177:32:177:41 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:178:32:178:45 | credit_card_no | testCryptoKit.swift:178:32:178:45 | credit_card_no | testCryptoKit.swift:178:32:178:45 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:178:32:178:45 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:178:32:178:45 | credit_card_no | testCryptoKit.swift:178:32:178:45 | credit_card_no | testCryptoKit.swift:178:32:178:45 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:178:32:178:45 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:184:32:184:35 | cert | testCryptoKit.swift:184:32:184:35 | cert | testCryptoKit.swift:184:32:184:35 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:184:32:184:35 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:184:32:184:35 | cert | testCryptoKit.swift:184:32:184:35 | cert | testCryptoKit.swift:184:32:184:35 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:184:32:184:35 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:186:32:186:41 | account_no | testCryptoKit.swift:186:32:186:41 | account_no | testCryptoKit.swift:186:32:186:41 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:186:32:186:41 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:186:32:186:41 | account_no | testCryptoKit.swift:186:32:186:41 | account_no | testCryptoKit.swift:186:32:186:41 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:186:32:186:41 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:186:32:186:41 | account_no | testCryptoKit.swift:186:32:186:41 | account_no | testCryptoKit.swift:186:32:186:41 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:186:32:186:41 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:186:32:186:41 | account_no | testCryptoKit.swift:186:32:186:41 | account_no | testCryptoKit.swift:186:32:186:41 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:186:32:186:41 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:187:32:187:45 | credit_card_no | testCryptoKit.swift:187:32:187:45 | credit_card_no | testCryptoKit.swift:187:32:187:45 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:187:32:187:45 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:187:32:187:45 | credit_card_no | testCryptoKit.swift:187:32:187:45 | credit_card_no | testCryptoKit.swift:187:32:187:45 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:187:32:187:45 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:193:32:193:35 | cert | testCryptoKit.swift:193:32:193:35 | cert | testCryptoKit.swift:193:32:193:35 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:193:32:193:35 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:193:32:193:35 | cert | testCryptoKit.swift:193:32:193:35 | cert | testCryptoKit.swift:193:32:193:35 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:193:32:193:35 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:195:32:195:41 | account_no | testCryptoKit.swift:195:32:195:41 | account_no | testCryptoKit.swift:195:32:195:41 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:195:32:195:41 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:195:32:195:41 | account_no | testCryptoKit.swift:195:32:195:41 | account_no | testCryptoKit.swift:195:32:195:41 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:195:32:195:41 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:195:32:195:41 | account_no | testCryptoKit.swift:195:32:195:41 | account_no | testCryptoKit.swift:195:32:195:41 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:195:32:195:41 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:195:32:195:41 | account_no | testCryptoKit.swift:195:32:195:41 | account_no | testCryptoKit.swift:195:32:195:41 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:195:32:195:41 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:196:32:196:45 | credit_card_no | testCryptoKit.swift:196:32:196:45 | credit_card_no | testCryptoKit.swift:196:32:196:45 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:196:32:196:45 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:196:32:196:45 | credit_card_no | testCryptoKit.swift:196:32:196:45 | credit_card_no | testCryptoKit.swift:196:32:196:45 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:196:32:196:45 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:202:32:202:35 | cert | testCryptoKit.swift:202:32:202:35 | cert | testCryptoKit.swift:202:32:202:35 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:202:32:202:35 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:202:32:202:35 | cert | testCryptoKit.swift:202:32:202:35 | cert | testCryptoKit.swift:202:32:202:35 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:202:32:202:35 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:204:32:204:41 | account_no | testCryptoKit.swift:204:32:204:41 | account_no | testCryptoKit.swift:204:32:204:41 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:204:32:204:41 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:204:32:204:41 | account_no | testCryptoKit.swift:204:32:204:41 | account_no | testCryptoKit.swift:204:32:204:41 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:204:32:204:41 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:204:32:204:41 | account_no | testCryptoKit.swift:204:32:204:41 | account_no | testCryptoKit.swift:204:32:204:41 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:204:32:204:41 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:204:32:204:41 | account_no | testCryptoKit.swift:204:32:204:41 | account_no | testCryptoKit.swift:204:32:204:41 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:204:32:204:41 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:205:32:205:45 | credit_card_no | testCryptoKit.swift:205:32:205:45 | credit_card_no | testCryptoKit.swift:205:32:205:45 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:205:32:205:45 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:205:32:205:45 | credit_card_no | testCryptoKit.swift:205:32:205:45 | credit_card_no | testCryptoKit.swift:205:32:205:45 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:205:32:205:45 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:211:32:211:35 | cert | testCryptoKit.swift:211:32:211:35 | cert | testCryptoKit.swift:211:32:211:35 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:211:32:211:35 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:211:32:211:35 | cert | testCryptoKit.swift:211:32:211:35 | cert | testCryptoKit.swift:211:32:211:35 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:211:32:211:35 | cert | sensitive data (certificate cert) | +| testCryptoKit.swift:213:32:213:41 | account_no | testCryptoKit.swift:213:32:213:41 | account_no | testCryptoKit.swift:213:32:213:41 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:213:32:213:41 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:213:32:213:41 | account_no | testCryptoKit.swift:213:32:213:41 | account_no | testCryptoKit.swift:213:32:213:41 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:213:32:213:41 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:213:32:213:41 | account_no | testCryptoKit.swift:213:32:213:41 | account_no | testCryptoKit.swift:213:32:213:41 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:213:32:213:41 | account_no | sensitive data (id account_no) | +| testCryptoKit.swift:213:32:213:41 | account_no | testCryptoKit.swift:213:32:213:41 | account_no | testCryptoKit.swift:213:32:213:41 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:213:32:213:41 | account_no | sensitive data (private account_no) | +| testCryptoKit.swift:214:32:214:45 | credit_card_no | testCryptoKit.swift:214:32:214:45 | credit_card_no | testCryptoKit.swift:214:32:214:45 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:214:32:214:45 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:214:32:214:45 | credit_card_no | testCryptoKit.swift:214:32:214:45 | credit_card_no | testCryptoKit.swift:214:32:214:45 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:214:32:214:45 | credit_card_no | sensitive data (private credit_card_no) | +| testCryptoKit.swift:231:44:231:49 | value1 | testCryptoKit.swift:230:23:230:32 | cardNumber | testCryptoKit.swift:231:44:231:49 | value1 | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:230:23:230:32 | cardNumber | sensitive data (private cardNumber) | +| testCryptoKit.swift:231:44:231:49 | value1 | testCryptoKit.swift:230:23:230:32 | cardNumber | testCryptoKit.swift:231:44:231:49 | value1 | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:230:23:230:32 | cardNumber | sensitive data (private cardNumber) | +| testCryptoKit.swift:235:39:235:44 | value2 | testCryptoKit.swift:233:23:233:32 | cardNumber | testCryptoKit.swift:235:39:235:44 | value2 | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:233:23:233:32 | cardNumber | sensitive data (private cardNumber) | +| testCryptoKit.swift:235:39:235:44 | value2 | testCryptoKit.swift:233:23:233:32 | cardNumber | testCryptoKit.swift:235:39:235:44 | value2 | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:233:23:233:32 | cardNumber | sensitive data (private cardNumber) | +| testCryptoKit.swift:238:51:238:56 | value3 | testCryptoKit.swift:237:23:237:32 | cardNumber | testCryptoKit.swift:238:51:238:56 | value3 | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:237:23:237:32 | cardNumber | sensitive data (private cardNumber) | +| testCryptoKit.swift:238:51:238:56 | value3 | testCryptoKit.swift:237:23:237:32 | cardNumber | testCryptoKit.swift:238:51:238:56 | value3 | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:237:23:237:32 | cardNumber | sensitive data (private cardNumber) | +| testCryptoKit.swift:255:43:255:47 | value | testCryptoKit.swift:240:23:240:32 | cardNumber | testCryptoKit.swift:255:43:255:47 | value | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:240:23:240:32 | cardNumber | sensitive data (private cardNumber) | +| testCryptoKit.swift:255:43:255:47 | value | testCryptoKit.swift:240:23:240:32 | cardNumber | testCryptoKit.swift:255:43:255:47 | value | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:240:23:240:32 | cardNumber | sensitive data (private cardNumber) | +| testCryptoKit.swift:259:37:259:41 | value | testCryptoKit.swift:243:23:243:32 | cardNumber | testCryptoKit.swift:259:37:259:41 | value | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:243:23:243:32 | cardNumber | sensitive data (private cardNumber) | +| testCryptoKit.swift:259:37:259:41 | value | testCryptoKit.swift:243:23:243:32 | cardNumber | testCryptoKit.swift:259:37:259:41 | value | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:243:23:243:32 | cardNumber | sensitive data (private cardNumber) | +| testCryptoKit.swift:263:37:263:41 | value | testCryptoKit.swift:246:23:246:32 | cardNumber | testCryptoKit.swift:263:37:263:41 | value | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:246:23:246:32 | cardNumber | sensitive data (private cardNumber) | +| testCryptoKit.swift:263:37:263:41 | value | testCryptoKit.swift:246:23:246:32 | cardNumber | testCryptoKit.swift:263:37:263:41 | value | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:246:23:246:32 | cardNumber | sensitive data (private cardNumber) | +| testCryptoSwift.swift:63:54:63:58 | bytes | testCryptoSwift.swift:175:21:175:36 | phoneNumberArray | testCryptoSwift.swift:63:54:63:58 | bytes | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:175:21:175:36 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:63:54:63:58 | bytes | testCryptoSwift.swift:175:21:175:36 | phoneNumberArray | testCryptoSwift.swift:63:54:63:58 | bytes | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:175:21:175:36 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:63:54:63:58 | bytes | testCryptoSwift.swift:191:9:191:24 | phoneNumberArray | testCryptoSwift.swift:63:54:63:58 | bytes | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:191:9:191:24 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:63:54:63:58 | bytes | testCryptoSwift.swift:191:9:191:24 | phoneNumberArray | testCryptoSwift.swift:63:54:63:58 | bytes | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:191:9:191:24 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:63:54:63:58 | bytes | testCryptoSwift.swift:209:9:209:19 | medicalData | testCryptoSwift.swift:63:54:63:58 | bytes | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:209:9:209:19 | medicalData | sensitive data (private medicalData) | +| testCryptoSwift.swift:63:54:63:58 | bytes | testCryptoSwift.swift:209:9:209:19 | medicalData | testCryptoSwift.swift:63:54:63:58 | bytes | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:209:9:209:19 | medicalData | sensitive data (private medicalData) | +| testCryptoSwift.swift:63:54:63:58 | bytes | testCryptoSwift.swift:227:9:227:24 | creditCardNumber | testCryptoSwift.swift:63:54:63:58 | bytes | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:227:9:227:24 | creditCardNumber | sensitive data (private creditCardNumber) | +| testCryptoSwift.swift:63:54:63:58 | bytes | testCryptoSwift.swift:227:9:227:24 | creditCardNumber | testCryptoSwift.swift:63:54:63:58 | bytes | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:227:9:227:24 | creditCardNumber | sensitive data (private creditCardNumber) | +| testCryptoSwift.swift:67:54:67:58 | bytes | testCryptoSwift.swift:178:21:178:36 | phoneNumberArray | testCryptoSwift.swift:67:54:67:58 | bytes | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:178:21:178:36 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:67:54:67:58 | bytes | testCryptoSwift.swift:178:21:178:36 | phoneNumberArray | testCryptoSwift.swift:67:54:67:58 | bytes | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:178:21:178:36 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:67:54:67:58 | bytes | testCryptoSwift.swift:194:9:194:24 | phoneNumberArray | testCryptoSwift.swift:67:54:67:58 | bytes | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:194:9:194:24 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:67:54:67:58 | bytes | testCryptoSwift.swift:194:9:194:24 | phoneNumberArray | testCryptoSwift.swift:67:54:67:58 | bytes | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:194:9:194:24 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:67:54:67:58 | bytes | testCryptoSwift.swift:212:9:212:19 | medicalData | testCryptoSwift.swift:67:54:67:58 | bytes | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:212:9:212:19 | medicalData | sensitive data (private medicalData) | +| testCryptoSwift.swift:67:54:67:58 | bytes | testCryptoSwift.swift:212:9:212:19 | medicalData | testCryptoSwift.swift:67:54:67:58 | bytes | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:212:9:212:19 | medicalData | sensitive data (private medicalData) | +| testCryptoSwift.swift:67:54:67:58 | bytes | testCryptoSwift.swift:230:9:230:24 | creditCardNumber | testCryptoSwift.swift:67:54:67:58 | bytes | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:230:9:230:24 | creditCardNumber | sensitive data (private creditCardNumber) | +| testCryptoSwift.swift:67:54:67:58 | bytes | testCryptoSwift.swift:230:9:230:24 | creditCardNumber | testCryptoSwift.swift:67:54:67:58 | bytes | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:230:9:230:24 | creditCardNumber | sensitive data (private creditCardNumber) | +| testCryptoSwift.swift:153:30:153:45 | phoneNumberArray | testCryptoSwift.swift:153:30:153:45 | phoneNumberArray | testCryptoSwift.swift:153:30:153:45 | phoneNumberArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:153:30:153:45 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:153:30:153:45 | phoneNumberArray | testCryptoSwift.swift:153:30:153:45 | phoneNumberArray | testCryptoSwift.swift:153:30:153:45 | phoneNumberArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:153:30:153:45 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:156:31:156:46 | phoneNumberArray | testCryptoSwift.swift:156:31:156:46 | phoneNumberArray | testCryptoSwift.swift:156:31:156:46 | phoneNumberArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:156:31:156:46 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:156:31:156:46 | phoneNumberArray | testCryptoSwift.swift:156:31:156:46 | phoneNumberArray | testCryptoSwift.swift:156:31:156:46 | phoneNumberArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:156:31:156:46 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:159:47:159:62 | phoneNumberArray | testCryptoSwift.swift:159:47:159:62 | phoneNumberArray | testCryptoSwift.swift:159:47:159:62 | phoneNumberArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:159:47:159:62 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:159:47:159:62 | phoneNumberArray | testCryptoSwift.swift:159:47:159:62 | phoneNumberArray | testCryptoSwift.swift:159:47:159:62 | phoneNumberArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:159:47:159:62 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:162:47:162:62 | phoneNumberArray | testCryptoSwift.swift:162:47:162:62 | phoneNumberArray | testCryptoSwift.swift:162:47:162:62 | phoneNumberArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:162:47:162:62 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:162:47:162:62 | phoneNumberArray | testCryptoSwift.swift:162:47:162:62 | phoneNumberArray | testCryptoSwift.swift:162:47:162:62 | phoneNumberArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:162:47:162:62 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:166:20:166:35 | phoneNumberArray | testCryptoSwift.swift:166:20:166:35 | phoneNumberArray | testCryptoSwift.swift:166:20:166:35 | phoneNumberArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:166:20:166:35 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:169:21:169:36 | phoneNumberArray | testCryptoSwift.swift:169:21:169:36 | phoneNumberArray | testCryptoSwift.swift:169:21:169:36 | phoneNumberArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:169:21:169:36 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:182:9:182:30 | [self arg] ... .md5(...) | testCryptoSwift.swift:182:9:182:24 | phoneNumberArray | testCryptoSwift.swift:182:9:182:30 | [self arg] ... .md5(...) | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:182:9:182:24 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:185:9:185:31 | [self arg] ... .sha1(...) | testCryptoSwift.swift:185:9:185:24 | phoneNumberArray | testCryptoSwift.swift:185:9:185:31 | [self arg] ... .sha1(...) | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:185:9:185:24 | phoneNumberArray | sensitive data (private phoneNumberArray) | +| testCryptoSwift.swift:200:9:200:25 | [self arg] ... .md5(...) | testCryptoSwift.swift:200:9:200:19 | medicalData | testCryptoSwift.swift:200:9:200:25 | [self arg] ... .md5(...) | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:200:9:200:19 | medicalData | sensitive data (private medicalData) | +| testCryptoSwift.swift:203:9:203:26 | [self arg] ... .sha1(...) | testCryptoSwift.swift:203:9:203:19 | medicalData | testCryptoSwift.swift:203:9:203:26 | [self arg] ... .sha1(...) | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:203:9:203:19 | medicalData | sensitive data (private medicalData) | +| testCryptoSwift.swift:218:9:218:30 | [self arg] ... .md5(...) | testCryptoSwift.swift:218:9:218:24 | creditCardNumber | testCryptoSwift.swift:218:9:218:30 | [self arg] ... .md5(...) | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:218:9:218:24 | creditCardNumber | sensitive data (private creditCardNumber) | +| testCryptoSwift.swift:221:9:221:31 | [self arg] ... .sha1(...) | testCryptoSwift.swift:221:9:221:24 | creditCardNumber | testCryptoSwift.swift:221:9:221:31 | [self arg] ... .sha1(...) | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:221:9:221:24 | creditCardNumber | sensitive data (private creditCardNumber) | edges -| testCryptoKit.swift:230:18:230:38 | call to Data.init(_:) | testCryptoKit.swift:231:44:231:44 | value1 | provenance | | -| testCryptoKit.swift:230:23:230:23 | cardNumber | testCryptoKit.swift:230:23:230:34 | .utf8 | provenance | | -| testCryptoKit.swift:230:23:230:34 | .utf8 | testCryptoKit.swift:230:18:230:38 | call to Data.init(_:) | provenance | | -| testCryptoKit.swift:233:18:233:38 | call to Data.init(_:) | testCryptoKit.swift:235:39:235:39 | value2 | provenance | | -| testCryptoKit.swift:233:23:233:23 | cardNumber | testCryptoKit.swift:233:23:233:34 | .utf8 | provenance | | -| testCryptoKit.swift:233:23:233:34 | .utf8 | testCryptoKit.swift:233:18:233:38 | call to Data.init(_:) | provenance | | -| testCryptoKit.swift:237:18:237:38 | call to Data.init(_:) | testCryptoKit.swift:238:51:238:51 | value3 | provenance | | -| testCryptoKit.swift:237:23:237:23 | cardNumber | testCryptoKit.swift:237:23:237:34 | .utf8 | provenance | | -| testCryptoKit.swift:237:23:237:34 | .utf8 | testCryptoKit.swift:237:18:237:38 | call to Data.init(_:) | provenance | | -| testCryptoKit.swift:240:18:240:38 | call to Data.init(_:) | testCryptoKit.swift:241:26:241:26 | value4 | provenance | | -| testCryptoKit.swift:240:23:240:23 | cardNumber | testCryptoKit.swift:240:23:240:34 | .utf8 | provenance | | -| testCryptoKit.swift:240:23:240:34 | .utf8 | testCryptoKit.swift:240:18:240:38 | call to Data.init(_:) | provenance | | -| testCryptoKit.swift:241:26:241:26 | value4 | testCryptoKit.swift:250:20:250:27 | value | provenance | | -| testCryptoKit.swift:243:18:243:38 | call to Data.init(_:) | testCryptoKit.swift:244:53:244:53 | value5 | provenance | | -| testCryptoKit.swift:243:23:243:23 | cardNumber | testCryptoKit.swift:243:23:243:34 | .utf8 | provenance | | -| testCryptoKit.swift:243:23:243:34 | .utf8 | testCryptoKit.swift:243:18:243:38 | call to Data.init(_:) | provenance | | -| testCryptoKit.swift:244:53:244:53 | value5 | testCryptoKit.swift:254:47:254:54 | value | provenance | | -| testCryptoKit.swift:250:20:250:27 | value | testCryptoKit.swift:251:43:251:43 | value | provenance | | -| testCryptoKit.swift:254:47:254:54 | value | testCryptoKit.swift:255:37:255:37 | value | provenance | | +| testCryptoKit.swift:230:9:230:14 | value1 | testCryptoKit.swift:231:44:231:49 | value1 | provenance | | +| testCryptoKit.swift:230:18:230:38 | Data(...) | testCryptoKit.swift:230:9:230:14 | value1 | provenance | | +| testCryptoKit.swift:230:23:230:32 | cardNumber | testCryptoKit.swift:230:23:230:37 | ... .utf8 | provenance | | +| testCryptoKit.swift:230:23:230:37 | ... .utf8 | testCryptoKit.swift:230:18:230:38 | Data(...) | provenance | | +| testCryptoKit.swift:233:9:233:14 | value2 | testCryptoKit.swift:235:39:235:44 | value2 | provenance | | +| testCryptoKit.swift:233:18:233:38 | Data(...) | testCryptoKit.swift:233:9:233:14 | value2 | provenance | | +| testCryptoKit.swift:233:23:233:32 | cardNumber | testCryptoKit.swift:233:23:233:37 | ... .utf8 | provenance | | +| testCryptoKit.swift:233:23:233:37 | ... .utf8 | testCryptoKit.swift:233:18:233:38 | Data(...) | provenance | | +| testCryptoKit.swift:237:9:237:14 | value3 | testCryptoKit.swift:238:51:238:56 | value3 | provenance | | +| testCryptoKit.swift:237:18:237:38 | Data(...) | testCryptoKit.swift:237:9:237:14 | value3 | provenance | | +| testCryptoKit.swift:237:23:237:32 | cardNumber | testCryptoKit.swift:237:23:237:37 | ... .utf8 | provenance | | +| testCryptoKit.swift:237:23:237:37 | ... .utf8 | testCryptoKit.swift:237:18:237:38 | Data(...) | provenance | | +| testCryptoKit.swift:240:9:240:14 | value4 | testCryptoKit.swift:241:26:241:31 | value4 | provenance | | +| testCryptoKit.swift:240:18:240:38 | Data(...) | testCryptoKit.swift:240:9:240:14 | value4 | provenance | | +| testCryptoKit.swift:240:23:240:32 | cardNumber | testCryptoKit.swift:240:23:240:37 | ... .utf8 | provenance | | +| testCryptoKit.swift:240:23:240:37 | ... .utf8 | testCryptoKit.swift:240:18:240:38 | Data(...) | provenance | | +| testCryptoKit.swift:241:26:241:31 | value4 | testCryptoKit.swift:254:20:254:24 | value | provenance | | +| testCryptoKit.swift:243:9:243:14 | value5 | testCryptoKit.swift:244:53:244:58 | value5 | provenance | | +| testCryptoKit.swift:243:18:243:38 | Data(...) | testCryptoKit.swift:243:9:243:14 | value5 | provenance | | +| testCryptoKit.swift:243:23:243:32 | cardNumber | testCryptoKit.swift:243:23:243:37 | ... .utf8 | provenance | | +| testCryptoKit.swift:243:23:243:37 | ... .utf8 | testCryptoKit.swift:243:18:243:38 | Data(...) | provenance | | +| testCryptoKit.swift:244:53:244:58 | value5 | testCryptoKit.swift:258:47:258:51 | value | provenance | | +| testCryptoKit.swift:246:9:246:14 | value6 | testCryptoKit.swift:247:53:247:58 | value6 | provenance | | +| testCryptoKit.swift:246:18:246:38 | Data(...) | testCryptoKit.swift:246:9:246:14 | value6 | provenance | | +| testCryptoKit.swift:246:23:246:32 | cardNumber | testCryptoKit.swift:246:23:246:37 | ... .utf8 | provenance | | +| testCryptoKit.swift:246:23:246:37 | ... .utf8 | testCryptoKit.swift:246:18:246:38 | Data(...) | provenance | | +| testCryptoKit.swift:247:53:247:58 | value6 | testCryptoKit.swift:262:53:262:57 | value | provenance | | +| testCryptoKit.swift:254:20:254:24 | value | testCryptoKit.swift:255:43:255:47 | value | provenance | | +| testCryptoKit.swift:258:47:258:51 | value | testCryptoKit.swift:259:37:259:41 | value | provenance | | +| testCryptoKit.swift:262:53:262:57 | value | testCryptoKit.swift:263:37:263:41 | value | provenance | | +| testCryptoSwift.swift:62:24:62:28 | bytes | testCryptoSwift.swift:63:54:63:58 | bytes | provenance | | +| testCryptoSwift.swift:66:24:66:28 | bytes | testCryptoSwift.swift:67:54:67:58 | bytes | provenance | | +| testCryptoSwift.swift:89:28:89:31 | self | testCryptoSwift.swift:62:24:62:28 | bytes | provenance | | +| testCryptoSwift.swift:93:28:93:31 | self | testCryptoSwift.swift:66:24:66:28 | bytes | provenance | | +| testCryptoSwift.swift:115:33:115:37 | bytes | testCryptoSwift.swift:62:24:62:28 | bytes | provenance | | +| testCryptoSwift.swift:119:33:119:37 | bytes | testCryptoSwift.swift:66:24:66:28 | bytes | provenance | | +| testCryptoSwift.swift:141:16:141:19 | self | testCryptoSwift.swift:89:28:89:31 | self | provenance | | +| testCryptoSwift.swift:145:16:145:19 | self | testCryptoSwift.swift:93:28:93:31 | self | provenance | | +| testCryptoSwift.swift:175:21:175:36 | phoneNumberArray | testCryptoSwift.swift:62:24:62:28 | bytes | provenance | | +| testCryptoSwift.swift:178:21:178:36 | phoneNumberArray | testCryptoSwift.swift:66:24:66:28 | bytes | provenance | | +| testCryptoSwift.swift:182:9:182:24 | phoneNumberArray | testCryptoSwift.swift:182:9:182:30 | [self arg] ... .md5(...) | provenance | | +| testCryptoSwift.swift:185:9:185:24 | phoneNumberArray | testCryptoSwift.swift:185:9:185:31 | [self arg] ... .sha1(...) | provenance | | +| testCryptoSwift.swift:191:9:191:24 | phoneNumberArray | testCryptoSwift.swift:89:28:89:31 | self | provenance | | +| testCryptoSwift.swift:194:9:194:24 | phoneNumberArray | testCryptoSwift.swift:93:28:93:31 | self | provenance | | +| testCryptoSwift.swift:200:9:200:19 | medicalData | testCryptoSwift.swift:200:9:200:25 | [self arg] ... .md5(...) | provenance | | +| testCryptoSwift.swift:203:9:203:19 | medicalData | testCryptoSwift.swift:203:9:203:26 | [self arg] ... .sha1(...) | provenance | | +| testCryptoSwift.swift:209:9:209:19 | medicalData | testCryptoSwift.swift:115:33:115:37 | bytes | provenance | | +| testCryptoSwift.swift:212:9:212:19 | medicalData | testCryptoSwift.swift:119:33:119:37 | bytes | provenance | | +| testCryptoSwift.swift:218:9:218:24 | creditCardNumber | testCryptoSwift.swift:218:9:218:30 | [self arg] ... .md5(...) | provenance | | +| testCryptoSwift.swift:221:9:221:24 | creditCardNumber | testCryptoSwift.swift:221:9:221:31 | [self arg] ... .sha1(...) | provenance | | +| testCryptoSwift.swift:227:9:227:24 | creditCardNumber | testCryptoSwift.swift:141:16:141:19 | self | provenance | | +| testCryptoSwift.swift:230:9:230:24 | creditCardNumber | testCryptoSwift.swift:145:16:145:19 | self | provenance | | nodes -| testCryptoKit.swift:86:43:86:43 | cert | semmle.label | cert | -| testCryptoKit.swift:88:43:88:43 | account_no | semmle.label | account_no | -| testCryptoKit.swift:89:43:89:43 | credit_card_no | semmle.label | credit_card_no | -| testCryptoKit.swift:93:36:93:36 | cert | semmle.label | cert | -| testCryptoKit.swift:95:36:95:36 | account_no | semmle.label | account_no | -| testCryptoKit.swift:96:36:96:36 | credit_card_no | semmle.label | credit_card_no | -| testCryptoKit.swift:100:44:100:44 | cert | semmle.label | cert | -| testCryptoKit.swift:102:44:102:44 | account_no | semmle.label | account_no | -| testCryptoKit.swift:103:44:103:44 | credit_card_no | semmle.label | credit_card_no | -| testCryptoKit.swift:130:23:130:23 | cert | semmle.label | cert | -| testCryptoKit.swift:132:23:132:23 | account_no | semmle.label | account_no | -| testCryptoKit.swift:133:23:133:23 | credit_card_no | semmle.label | credit_card_no | -| testCryptoKit.swift:139:23:139:23 | cert | semmle.label | cert | -| testCryptoKit.swift:141:23:141:23 | account_no | semmle.label | account_no | -| testCryptoKit.swift:142:23:142:23 | credit_card_no | semmle.label | credit_card_no | -| testCryptoKit.swift:175:32:175:32 | cert | semmle.label | cert | -| testCryptoKit.swift:177:32:177:32 | account_no | semmle.label | account_no | -| testCryptoKit.swift:178:32:178:32 | credit_card_no | semmle.label | credit_card_no | -| testCryptoKit.swift:184:32:184:32 | cert | semmle.label | cert | -| testCryptoKit.swift:186:32:186:32 | account_no | semmle.label | account_no | -| testCryptoKit.swift:187:32:187:32 | credit_card_no | semmle.label | credit_card_no | -| testCryptoKit.swift:230:18:230:38 | call to Data.init(_:) | semmle.label | call to Data.init(_:) | -| testCryptoKit.swift:230:23:230:23 | cardNumber | semmle.label | cardNumber | -| testCryptoKit.swift:230:23:230:34 | .utf8 | semmle.label | .utf8 | -| testCryptoKit.swift:231:44:231:44 | value1 | semmle.label | value1 | -| testCryptoKit.swift:233:18:233:38 | call to Data.init(_:) | semmle.label | call to Data.init(_:) | -| testCryptoKit.swift:233:23:233:23 | cardNumber | semmle.label | cardNumber | -| testCryptoKit.swift:233:23:233:34 | .utf8 | semmle.label | .utf8 | -| testCryptoKit.swift:235:39:235:39 | value2 | semmle.label | value2 | -| testCryptoKit.swift:237:18:237:38 | call to Data.init(_:) | semmle.label | call to Data.init(_:) | -| testCryptoKit.swift:237:23:237:23 | cardNumber | semmle.label | cardNumber | -| testCryptoKit.swift:237:23:237:34 | .utf8 | semmle.label | .utf8 | -| testCryptoKit.swift:238:51:238:51 | value3 | semmle.label | value3 | -| testCryptoKit.swift:240:18:240:38 | call to Data.init(_:) | semmle.label | call to Data.init(_:) | -| testCryptoKit.swift:240:23:240:23 | cardNumber | semmle.label | cardNumber | -| testCryptoKit.swift:240:23:240:34 | .utf8 | semmle.label | .utf8 | -| testCryptoKit.swift:241:26:241:26 | value4 | semmle.label | value4 | -| testCryptoKit.swift:243:18:243:38 | call to Data.init(_:) | semmle.label | call to Data.init(_:) | -| testCryptoKit.swift:243:23:243:23 | cardNumber | semmle.label | cardNumber | -| testCryptoKit.swift:243:23:243:34 | .utf8 | semmle.label | .utf8 | -| testCryptoKit.swift:244:53:244:53 | value5 | semmle.label | value5 | -| testCryptoKit.swift:250:20:250:27 | value | semmle.label | value | -| testCryptoKit.swift:251:43:251:43 | value | semmle.label | value | -| testCryptoKit.swift:254:47:254:54 | value | semmle.label | value | -| testCryptoKit.swift:255:37:255:37 | value | semmle.label | value | -| testCryptoSwift.swift:153:30:153:30 | phoneNumberArray | semmle.label | phoneNumberArray | -| testCryptoSwift.swift:156:31:156:31 | phoneNumberArray | semmle.label | phoneNumberArray | -| testCryptoSwift.swift:166:20:166:20 | phoneNumberArray | semmle.label | phoneNumberArray | -| testCryptoSwift.swift:169:21:169:21 | phoneNumberArray | semmle.label | phoneNumberArray | -| testCryptoSwift.swift:182:9:182:9 | phoneNumberArray | semmle.label | phoneNumberArray | -| testCryptoSwift.swift:185:9:185:9 | phoneNumberArray | semmle.label | phoneNumberArray | -| testCryptoSwift.swift:200:9:200:9 | medicalData | semmle.label | medicalData | -| testCryptoSwift.swift:203:9:203:9 | medicalData | semmle.label | medicalData | -| testCryptoSwift.swift:218:9:218:9 | creditCardNumber | semmle.label | creditCardNumber | -| testCryptoSwift.swift:221:9:221:9 | creditCardNumber | semmle.label | creditCardNumber | +| testCryptoKit.swift:86:43:86:46 | cert | semmle.label | cert | +| testCryptoKit.swift:88:43:88:52 | account_no | semmle.label | account_no | +| testCryptoKit.swift:89:43:89:56 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:93:36:93:39 | cert | semmle.label | cert | +| testCryptoKit.swift:95:36:95:45 | account_no | semmle.label | account_no | +| testCryptoKit.swift:96:36:96:49 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:100:44:100:47 | cert | semmle.label | cert | +| testCryptoKit.swift:102:44:102:53 | account_no | semmle.label | account_no | +| testCryptoKit.swift:103:44:103:57 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:107:37:107:40 | cert | semmle.label | cert | +| testCryptoKit.swift:109:37:109:46 | account_no | semmle.label | account_no | +| testCryptoKit.swift:110:37:110:50 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:114:37:114:40 | cert | semmle.label | cert | +| testCryptoKit.swift:116:37:116:46 | account_no | semmle.label | account_no | +| testCryptoKit.swift:117:37:117:50 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:121:37:121:40 | cert | semmle.label | cert | +| testCryptoKit.swift:123:37:123:46 | account_no | semmle.label | account_no | +| testCryptoKit.swift:124:37:124:50 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:130:23:130:26 | cert | semmle.label | cert | +| testCryptoKit.swift:132:23:132:32 | account_no | semmle.label | account_no | +| testCryptoKit.swift:133:23:133:36 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:139:23:139:26 | cert | semmle.label | cert | +| testCryptoKit.swift:141:23:141:32 | account_no | semmle.label | account_no | +| testCryptoKit.swift:142:23:142:36 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:148:23:148:26 | cert | semmle.label | cert | +| testCryptoKit.swift:150:23:150:32 | account_no | semmle.label | account_no | +| testCryptoKit.swift:151:23:151:36 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:157:23:157:26 | cert | semmle.label | cert | +| testCryptoKit.swift:159:23:159:32 | account_no | semmle.label | account_no | +| testCryptoKit.swift:160:23:160:36 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:166:23:166:26 | cert | semmle.label | cert | +| testCryptoKit.swift:168:23:168:32 | account_no | semmle.label | account_no | +| testCryptoKit.swift:169:23:169:36 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:175:32:175:35 | cert | semmle.label | cert | +| testCryptoKit.swift:177:32:177:41 | account_no | semmle.label | account_no | +| testCryptoKit.swift:178:32:178:45 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:184:32:184:35 | cert | semmle.label | cert | +| testCryptoKit.swift:186:32:186:41 | account_no | semmle.label | account_no | +| testCryptoKit.swift:187:32:187:45 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:193:32:193:35 | cert | semmle.label | cert | +| testCryptoKit.swift:195:32:195:41 | account_no | semmle.label | account_no | +| testCryptoKit.swift:196:32:196:45 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:202:32:202:35 | cert | semmle.label | cert | +| testCryptoKit.swift:204:32:204:41 | account_no | semmle.label | account_no | +| testCryptoKit.swift:205:32:205:45 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:211:32:211:35 | cert | semmle.label | cert | +| testCryptoKit.swift:213:32:213:41 | account_no | semmle.label | account_no | +| testCryptoKit.swift:214:32:214:45 | credit_card_no | semmle.label | credit_card_no | +| testCryptoKit.swift:230:9:230:14 | value1 | semmle.label | value1 | +| testCryptoKit.swift:230:18:230:38 | Data(...) | semmle.label | Data(...) | +| testCryptoKit.swift:230:23:230:32 | cardNumber | semmle.label | cardNumber | +| testCryptoKit.swift:230:23:230:37 | ... .utf8 | semmle.label | ... .utf8 | +| testCryptoKit.swift:231:44:231:49 | value1 | semmle.label | value1 | +| testCryptoKit.swift:233:9:233:14 | value2 | semmle.label | value2 | +| testCryptoKit.swift:233:18:233:38 | Data(...) | semmle.label | Data(...) | +| testCryptoKit.swift:233:23:233:32 | cardNumber | semmle.label | cardNumber | +| testCryptoKit.swift:233:23:233:37 | ... .utf8 | semmle.label | ... .utf8 | +| testCryptoKit.swift:235:39:235:44 | value2 | semmle.label | value2 | +| testCryptoKit.swift:237:9:237:14 | value3 | semmle.label | value3 | +| testCryptoKit.swift:237:18:237:38 | Data(...) | semmle.label | Data(...) | +| testCryptoKit.swift:237:23:237:32 | cardNumber | semmle.label | cardNumber | +| testCryptoKit.swift:237:23:237:37 | ... .utf8 | semmle.label | ... .utf8 | +| testCryptoKit.swift:238:51:238:56 | value3 | semmle.label | value3 | +| testCryptoKit.swift:240:9:240:14 | value4 | semmle.label | value4 | +| testCryptoKit.swift:240:18:240:38 | Data(...) | semmle.label | Data(...) | +| testCryptoKit.swift:240:23:240:32 | cardNumber | semmle.label | cardNumber | +| testCryptoKit.swift:240:23:240:37 | ... .utf8 | semmle.label | ... .utf8 | +| testCryptoKit.swift:241:26:241:31 | value4 | semmle.label | value4 | +| testCryptoKit.swift:243:9:243:14 | value5 | semmle.label | value5 | +| testCryptoKit.swift:243:18:243:38 | Data(...) | semmle.label | Data(...) | +| testCryptoKit.swift:243:23:243:32 | cardNumber | semmle.label | cardNumber | +| testCryptoKit.swift:243:23:243:37 | ... .utf8 | semmle.label | ... .utf8 | +| testCryptoKit.swift:244:53:244:58 | value5 | semmle.label | value5 | +| testCryptoKit.swift:246:9:246:14 | value6 | semmle.label | value6 | +| testCryptoKit.swift:246:18:246:38 | Data(...) | semmle.label | Data(...) | +| testCryptoKit.swift:246:23:246:32 | cardNumber | semmle.label | cardNumber | +| testCryptoKit.swift:246:23:246:37 | ... .utf8 | semmle.label | ... .utf8 | +| testCryptoKit.swift:247:53:247:58 | value6 | semmle.label | value6 | +| testCryptoKit.swift:254:20:254:24 | value | semmle.label | value | +| testCryptoKit.swift:255:43:255:47 | value | semmle.label | value | +| testCryptoKit.swift:258:47:258:51 | value | semmle.label | value | +| testCryptoKit.swift:259:37:259:41 | value | semmle.label | value | +| testCryptoKit.swift:262:53:262:57 | value | semmle.label | value | +| testCryptoKit.swift:263:37:263:41 | value | semmle.label | value | +| testCryptoSwift.swift:62:24:62:28 | bytes | semmle.label | bytes | +| testCryptoSwift.swift:63:54:63:58 | bytes | semmle.label | bytes | +| testCryptoSwift.swift:66:24:66:28 | bytes | semmle.label | bytes | +| testCryptoSwift.swift:67:54:67:58 | bytes | semmle.label | bytes | +| testCryptoSwift.swift:89:28:89:31 | self | semmle.label | self | +| testCryptoSwift.swift:93:28:93:31 | self | semmle.label | self | +| testCryptoSwift.swift:115:33:115:37 | bytes | semmle.label | bytes | +| testCryptoSwift.swift:119:33:119:37 | bytes | semmle.label | bytes | +| testCryptoSwift.swift:141:16:141:19 | self | semmle.label | self | +| testCryptoSwift.swift:145:16:145:19 | self | semmle.label | self | +| testCryptoSwift.swift:153:30:153:45 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:156:31:156:46 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:159:47:159:62 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:162:47:162:62 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:166:20:166:35 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:169:21:169:36 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:175:21:175:36 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:178:21:178:36 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:182:9:182:24 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:182:9:182:30 | [self arg] ... .md5(...) | semmle.label | [self arg] ... .md5(...) | +| testCryptoSwift.swift:185:9:185:24 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:185:9:185:31 | [self arg] ... .sha1(...) | semmle.label | [self arg] ... .sha1(...) | +| testCryptoSwift.swift:191:9:191:24 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:194:9:194:24 | phoneNumberArray | semmle.label | phoneNumberArray | +| testCryptoSwift.swift:200:9:200:19 | medicalData | semmle.label | medicalData | +| testCryptoSwift.swift:200:9:200:25 | [self arg] ... .md5(...) | semmle.label | [self arg] ... .md5(...) | +| testCryptoSwift.swift:203:9:203:19 | medicalData | semmle.label | medicalData | +| testCryptoSwift.swift:203:9:203:26 | [self arg] ... .sha1(...) | semmle.label | [self arg] ... .sha1(...) | +| testCryptoSwift.swift:209:9:209:19 | medicalData | semmle.label | medicalData | +| testCryptoSwift.swift:212:9:212:19 | medicalData | semmle.label | medicalData | +| testCryptoSwift.swift:218:9:218:24 | creditCardNumber | semmle.label | creditCardNumber | +| testCryptoSwift.swift:218:9:218:30 | [self arg] ... .md5(...) | semmle.label | [self arg] ... .md5(...) | +| testCryptoSwift.swift:221:9:221:24 | creditCardNumber | semmle.label | creditCardNumber | +| testCryptoSwift.swift:221:9:221:31 | [self arg] ... .sha1(...) | semmle.label | [self arg] ... .sha1(...) | +| testCryptoSwift.swift:227:9:227:24 | creditCardNumber | semmle.label | creditCardNumber | +| testCryptoSwift.swift:230:9:230:24 | creditCardNumber | semmle.label | creditCardNumber | subpaths -#select -| testCryptoKit.swift:86:43:86:43 | cert | testCryptoKit.swift:86:43:86:43 | cert | testCryptoKit.swift:86:43:86:43 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:86:43:86:43 | cert | sensitive data (credential cert) | -| testCryptoKit.swift:88:43:88:43 | account_no | testCryptoKit.swift:88:43:88:43 | account_no | testCryptoKit.swift:88:43:88:43 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:88:43:88:43 | account_no | sensitive data (private information account_no) | -| testCryptoKit.swift:89:43:89:43 | credit_card_no | testCryptoKit.swift:89:43:89:43 | credit_card_no | testCryptoKit.swift:89:43:89:43 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:89:43:89:43 | credit_card_no | sensitive data (private information credit_card_no) | -| testCryptoKit.swift:93:36:93:36 | cert | testCryptoKit.swift:93:36:93:36 | cert | testCryptoKit.swift:93:36:93:36 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:93:36:93:36 | cert | sensitive data (credential cert) | -| testCryptoKit.swift:95:36:95:36 | account_no | testCryptoKit.swift:95:36:95:36 | account_no | testCryptoKit.swift:95:36:95:36 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:95:36:95:36 | account_no | sensitive data (private information account_no) | -| testCryptoKit.swift:96:36:96:36 | credit_card_no | testCryptoKit.swift:96:36:96:36 | credit_card_no | testCryptoKit.swift:96:36:96:36 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:96:36:96:36 | credit_card_no | sensitive data (private information credit_card_no) | -| testCryptoKit.swift:100:44:100:44 | cert | testCryptoKit.swift:100:44:100:44 | cert | testCryptoKit.swift:100:44:100:44 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:100:44:100:44 | cert | sensitive data (credential cert) | -| testCryptoKit.swift:102:44:102:44 | account_no | testCryptoKit.swift:102:44:102:44 | account_no | testCryptoKit.swift:102:44:102:44 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:102:44:102:44 | account_no | sensitive data (private information account_no) | -| testCryptoKit.swift:103:44:103:44 | credit_card_no | testCryptoKit.swift:103:44:103:44 | credit_card_no | testCryptoKit.swift:103:44:103:44 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:103:44:103:44 | credit_card_no | sensitive data (private information credit_card_no) | -| testCryptoKit.swift:130:23:130:23 | cert | testCryptoKit.swift:130:23:130:23 | cert | testCryptoKit.swift:130:23:130:23 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:130:23:130:23 | cert | sensitive data (credential cert) | -| testCryptoKit.swift:132:23:132:23 | account_no | testCryptoKit.swift:132:23:132:23 | account_no | testCryptoKit.swift:132:23:132:23 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:132:23:132:23 | account_no | sensitive data (private information account_no) | -| testCryptoKit.swift:133:23:133:23 | credit_card_no | testCryptoKit.swift:133:23:133:23 | credit_card_no | testCryptoKit.swift:133:23:133:23 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:133:23:133:23 | credit_card_no | sensitive data (private information credit_card_no) | -| testCryptoKit.swift:139:23:139:23 | cert | testCryptoKit.swift:139:23:139:23 | cert | testCryptoKit.swift:139:23:139:23 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:139:23:139:23 | cert | sensitive data (credential cert) | -| testCryptoKit.swift:141:23:141:23 | account_no | testCryptoKit.swift:141:23:141:23 | account_no | testCryptoKit.swift:141:23:141:23 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:141:23:141:23 | account_no | sensitive data (private information account_no) | -| testCryptoKit.swift:142:23:142:23 | credit_card_no | testCryptoKit.swift:142:23:142:23 | credit_card_no | testCryptoKit.swift:142:23:142:23 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:142:23:142:23 | credit_card_no | sensitive data (private information credit_card_no) | -| testCryptoKit.swift:175:32:175:32 | cert | testCryptoKit.swift:175:32:175:32 | cert | testCryptoKit.swift:175:32:175:32 | cert | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:175:32:175:32 | cert | sensitive data (credential cert) | -| testCryptoKit.swift:177:32:177:32 | account_no | testCryptoKit.swift:177:32:177:32 | account_no | testCryptoKit.swift:177:32:177:32 | account_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:177:32:177:32 | account_no | sensitive data (private information account_no) | -| testCryptoKit.swift:178:32:178:32 | credit_card_no | testCryptoKit.swift:178:32:178:32 | credit_card_no | testCryptoKit.swift:178:32:178:32 | credit_card_no | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:178:32:178:32 | credit_card_no | sensitive data (private information credit_card_no) | -| testCryptoKit.swift:184:32:184:32 | cert | testCryptoKit.swift:184:32:184:32 | cert | testCryptoKit.swift:184:32:184:32 | cert | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:184:32:184:32 | cert | sensitive data (credential cert) | -| testCryptoKit.swift:186:32:186:32 | account_no | testCryptoKit.swift:186:32:186:32 | account_no | testCryptoKit.swift:186:32:186:32 | account_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:186:32:186:32 | account_no | sensitive data (private information account_no) | -| testCryptoKit.swift:187:32:187:32 | credit_card_no | testCryptoKit.swift:187:32:187:32 | credit_card_no | testCryptoKit.swift:187:32:187:32 | credit_card_no | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoKit.swift:187:32:187:32 | credit_card_no | sensitive data (private information credit_card_no) | -| testCryptoKit.swift:231:44:231:44 | value1 | testCryptoKit.swift:230:23:230:23 | cardNumber | testCryptoKit.swift:231:44:231:44 | value1 | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:230:23:230:23 | cardNumber | sensitive data (private information cardNumber) | -| testCryptoKit.swift:235:39:235:39 | value2 | testCryptoKit.swift:233:23:233:23 | cardNumber | testCryptoKit.swift:235:39:235:39 | value2 | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:233:23:233:23 | cardNumber | sensitive data (private information cardNumber) | -| testCryptoKit.swift:238:51:238:51 | value3 | testCryptoKit.swift:237:23:237:23 | cardNumber | testCryptoKit.swift:238:51:238:51 | value3 | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:237:23:237:23 | cardNumber | sensitive data (private information cardNumber) | -| testCryptoKit.swift:251:43:251:43 | value | testCryptoKit.swift:240:23:240:23 | cardNumber | testCryptoKit.swift:251:43:251:43 | value | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:240:23:240:23 | cardNumber | sensitive data (private information cardNumber) | -| testCryptoKit.swift:255:37:255:37 | value | testCryptoKit.swift:243:23:243:23 | cardNumber | testCryptoKit.swift:255:37:255:37 | value | Insecure hashing algorithm (MD5) depends on $@. | testCryptoKit.swift:243:23:243:23 | cardNumber | sensitive data (private information cardNumber) | -| testCryptoSwift.swift:153:30:153:30 | phoneNumberArray | testCryptoSwift.swift:153:30:153:30 | phoneNumberArray | testCryptoSwift.swift:153:30:153:30 | phoneNumberArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:153:30:153:30 | phoneNumberArray | sensitive data (private information phoneNumberArray) | -| testCryptoSwift.swift:156:31:156:31 | phoneNumberArray | testCryptoSwift.swift:156:31:156:31 | phoneNumberArray | testCryptoSwift.swift:156:31:156:31 | phoneNumberArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:156:31:156:31 | phoneNumberArray | sensitive data (private information phoneNumberArray) | -| testCryptoSwift.swift:166:20:166:20 | phoneNumberArray | testCryptoSwift.swift:166:20:166:20 | phoneNumberArray | testCryptoSwift.swift:166:20:166:20 | phoneNumberArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:166:20:166:20 | phoneNumberArray | sensitive data (private information phoneNumberArray) | -| testCryptoSwift.swift:169:21:169:21 | phoneNumberArray | testCryptoSwift.swift:169:21:169:21 | phoneNumberArray | testCryptoSwift.swift:169:21:169:21 | phoneNumberArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:169:21:169:21 | phoneNumberArray | sensitive data (private information phoneNumberArray) | -| testCryptoSwift.swift:182:9:182:9 | phoneNumberArray | testCryptoSwift.swift:182:9:182:9 | phoneNumberArray | testCryptoSwift.swift:182:9:182:9 | phoneNumberArray | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:182:9:182:9 | phoneNumberArray | sensitive data (private information phoneNumberArray) | -| testCryptoSwift.swift:185:9:185:9 | phoneNumberArray | testCryptoSwift.swift:185:9:185:9 | phoneNumberArray | testCryptoSwift.swift:185:9:185:9 | phoneNumberArray | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:185:9:185:9 | phoneNumberArray | sensitive data (private information phoneNumberArray) | -| testCryptoSwift.swift:200:9:200:9 | medicalData | testCryptoSwift.swift:200:9:200:9 | medicalData | testCryptoSwift.swift:200:9:200:9 | medicalData | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:200:9:200:9 | medicalData | sensitive data (private information medicalData) | -| testCryptoSwift.swift:203:9:203:9 | medicalData | testCryptoSwift.swift:203:9:203:9 | medicalData | testCryptoSwift.swift:203:9:203:9 | medicalData | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:203:9:203:9 | medicalData | sensitive data (private information medicalData) | -| testCryptoSwift.swift:218:9:218:9 | creditCardNumber | testCryptoSwift.swift:218:9:218:9 | creditCardNumber | testCryptoSwift.swift:218:9:218:9 | creditCardNumber | Insecure hashing algorithm (MD5) depends on $@. | testCryptoSwift.swift:218:9:218:9 | creditCardNumber | sensitive data (private information creditCardNumber) | -| testCryptoSwift.swift:221:9:221:9 | creditCardNumber | testCryptoSwift.swift:221:9:221:9 | creditCardNumber | testCryptoSwift.swift:221:9:221:9 | creditCardNumber | Insecure hashing algorithm (SHA1) depends on $@. | testCryptoSwift.swift:221:9:221:9 | creditCardNumber | sensitive data (private information creditCardNumber) | diff --git a/unified/ql/test/query-tests/security/CWE-328/WeakSensitiveDataHashing.qlref b/unified/ql/test/query-tests/security/CWE-328/WeakSensitiveDataHashing.qlref index d76eeef6c2f2..64c2211dbd07 100644 --- a/unified/ql/test/query-tests/security/CWE-328/WeakSensitiveDataHashing.qlref +++ b/unified/ql/test/query-tests/security/CWE-328/WeakSensitiveDataHashing.qlref @@ -1,2 +1,3 @@ -query: queries/Security/CWE-328/WeakSensitiveDataHashing.ql -postprocess: utils/test/InlineExpectationsTestQuery.ql +query: queries/security/CWE-328/WeakSensitiveDataHashing.ql +postprocess: + - utils/test/InlineExpectationsTestQuery.ql diff --git a/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift b/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift index 9a52810b4496..8177d36c20bf 100644 --- a/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift +++ b/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift @@ -83,135 +83,135 @@ enum Insecure { func testHashMethods(passwd : UnsafeRawBufferPointer, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { var hash = Crypto.Insecure.MD5.hash(data: passwd) // $ Alert[unified/swift/weak-password-hashing] hash = Crypto.Insecure.MD5.hash(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] - hash = Crypto.Insecure.MD5.hash(data: cert) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash = Crypto.Insecure.MD5.hash(data: cert) // $ Alert[unified/swift/weak-sensitive-data-hashing] hash = Crypto.Insecure.MD5.hash(data: encrypted_passwd) // GOOD (not sensitive) - hash = Crypto.Insecure.MD5.hash(data: account_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] - hash = Crypto.Insecure.MD5.hash(data: credit_card_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash = Crypto.Insecure.MD5.hash(data: account_no) // $ Alert[unified/swift/weak-sensitive-data-hashing] + hash = Crypto.Insecure.MD5.hash(data: credit_card_no) // $ Alert[unified/swift/weak-sensitive-data-hashing] hash = Insecure.MD5.hash(data: passwd) // $ Alert[unified/swift/weak-password-hashing] hash = Insecure.MD5.hash(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] - hash = Insecure.MD5.hash(data: cert) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash = Insecure.MD5.hash(data: cert) // $ Alert[unified/swift/weak-sensitive-data-hashing] hash = Insecure.MD5.hash(data: encrypted_passwd) // GOOD (not sensitive) - hash = Insecure.MD5.hash(data: account_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] - hash = Insecure.MD5.hash(data: credit_card_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash = Insecure.MD5.hash(data: account_no) // $ Alert[unified/swift/weak-sensitive-data-hashing] + hash = Insecure.MD5.hash(data: credit_card_no) // $ Alert[unified/swift/weak-sensitive-data-hashing] hash = Crypto.Insecure.SHA1.hash(data: passwd) // $ Alert[unified/swift/weak-password-hashing] hash = Crypto.Insecure.SHA1.hash(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] - hash = Crypto.Insecure.SHA1.hash(data: cert) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash = Crypto.Insecure.SHA1.hash(data: cert) // $ Alert[unified/swift/weak-sensitive-data-hashing] hash = Crypto.Insecure.SHA1.hash(data: encrypted_passwd) // GOOD (not sensitive) - hash = Crypto.Insecure.SHA1.hash(data: account_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] - hash = Crypto.Insecure.SHA1.hash(data: credit_card_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash = Crypto.Insecure.SHA1.hash(data: account_no) // $ Alert[unified/swift/weak-sensitive-data-hashing] + hash = Crypto.Insecure.SHA1.hash(data: credit_card_no) // $ Alert[unified/swift/weak-sensitive-data-hashing] hash = Crypto.SHA256.hash(data: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) hash = Crypto.SHA256.hash(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) - hash = Crypto.SHA256.hash(data: cert) // GOOD, computationally expensive hash not required + hash = Crypto.SHA256.hash(data: cert) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD, computationally expensive hash not required hash = Crypto.SHA256.hash(data: encrypted_passwd) // GOOD, not sensitive - hash = Crypto.SHA256.hash(data: account_no) // GOOD, computationally expensive hash not required - hash = Crypto.SHA256.hash(data: credit_card_no) // GOOD, computationally expensive hash not required + hash = Crypto.SHA256.hash(data: account_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD, computationally expensive hash not required + hash = Crypto.SHA256.hash(data: credit_card_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD, computationally expensive hash not required hash = Crypto.SHA384.hash(data: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) hash = Crypto.SHA384.hash(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) - hash = Crypto.SHA384.hash(data: cert) // GOOD, computationally expensive hash not required + hash = Crypto.SHA384.hash(data: cert) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD, computationally expensive hash not required hash = Crypto.SHA384.hash(data: encrypted_passwd) // GOOD, not sensitive - hash = Crypto.SHA384.hash(data: account_no) // GOOD, computationally expensive hash not required - hash = Crypto.SHA384.hash(data: credit_card_no) // GOOD, computationally expensive hash not required + hash = Crypto.SHA384.hash(data: account_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD, computationally expensive hash not required + hash = Crypto.SHA384.hash(data: credit_card_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD, computationally expensive hash not required hash = Crypto.SHA512.hash(data: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) hash = Crypto.SHA512.hash(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) - hash = Crypto.SHA512.hash(data: cert) // GOOD, computationally expensive hash not required + hash = Crypto.SHA512.hash(data: cert) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD, computationally expensive hash not required hash = Crypto.SHA512.hash(data: encrypted_passwd) // GOOD, not sensitive - hash = Crypto.SHA512.hash(data: account_no) // GOOD, computationally expensive hash not required - hash = Crypto.SHA512.hash(data: credit_card_no) // GOOD, computationally expensive hash not required + hash = Crypto.SHA512.hash(data: account_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD, computationally expensive hash not required + hash = Crypto.SHA512.hash(data: credit_card_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD, computationally expensive hash not required } func testMD5UpdateWithData(passwd : String, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { var hash = Crypto.Insecure.MD5() hash.update(data: passwd) // $ Alert[unified/swift/weak-password-hashing] - hash.update(data: cert) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(data: cert) // $ Alert[unified/swift/weak-sensitive-data-hashing] hash.update(data: encrypted_passwd) // GOOD (not sensitive) - hash.update(data: account_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] - hash.update(data: credit_card_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(data: account_no) // $ Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(data: credit_card_no) // $ Alert[unified/swift/weak-sensitive-data-hashing] } func testSHA1UpdateWithData(passwd : String, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { var hash = Crypto.Insecure.SHA1() hash.update(data: passwd) // $ Alert[unified/swift/weak-password-hashing] - hash.update(data: cert) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(data: cert) // $ Alert[unified/swift/weak-sensitive-data-hashing] hash.update(data: encrypted_passwd) // GOOD (not sensitive) - hash.update(data: account_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] - hash.update(data: credit_card_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(data: account_no) // $ Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(data: credit_card_no) // $ Alert[unified/swift/weak-sensitive-data-hashing] } func testSHA256UpdateWithData(passwd : String, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { var hash = Crypto.SHA256() hash.update(data: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) - hash.update(data: cert) // GOOD + hash.update(data: cert) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD hash.update(data: encrypted_passwd) // GOOD (not sensitive) - hash.update(data: account_no) // GOOD - hash.update(data: credit_card_no) // GOOD + hash.update(data: account_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD + hash.update(data: credit_card_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD } func testSHA384UpdateWithData(passwd : String, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { var hash = Crypto.SHA384() hash.update(data: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) - hash.update(data: cert) // GOOD + hash.update(data: cert) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD hash.update(data: encrypted_passwd) // GOOD (not sensitive) - hash.update(data: account_no) // GOOD - hash.update(data: credit_card_no) // GOOD + hash.update(data: account_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD + hash.update(data: credit_card_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD } func testSHA512UpdateWithData(passwd : String, cert: String, encrypted_passwd : String, account_no : String, credit_card_no : String) { var hash = Crypto.SHA512() hash.update(data: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) - hash.update(data: cert) // GOOD + hash.update(data: cert) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD hash.update(data: encrypted_passwd) // GOOD (not sensitive) - hash.update(data: account_no) // GOOD - hash.update(data: credit_card_no) // GOOD + hash.update(data: account_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD + hash.update(data: credit_card_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD } func testMD5UpdateWithUnsafeRawBufferPointer(passwd : UnsafeRawBufferPointer, cert: UnsafeRawBufferPointer, encrypted_passwd : UnsafeRawBufferPointer, account_no : UnsafeRawBufferPointer, credit_card_no : UnsafeRawBufferPointer) { var hash = Crypto.Insecure.MD5() hash.update(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] - hash.update(bufferPointer: cert) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(bufferPointer: cert) // $ Alert[unified/swift/weak-sensitive-data-hashing] hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) - hash.update(bufferPointer: account_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] - hash.update(bufferPointer: credit_card_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(bufferPointer: account_no) // $ Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(bufferPointer: credit_card_no) // $ Alert[unified/swift/weak-sensitive-data-hashing] } func testSHA1UpdateWithUnsafeRawBufferPointer(passwd : UnsafeRawBufferPointer, cert: UnsafeRawBufferPointer, encrypted_passwd : UnsafeRawBufferPointer, account_no : UnsafeRawBufferPointer, credit_card_no : UnsafeRawBufferPointer) { var hash = Crypto.Insecure.SHA1() hash.update(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] - hash.update(bufferPointer: cert) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(bufferPointer: cert) // $ Alert[unified/swift/weak-sensitive-data-hashing] hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) - hash.update(bufferPointer: account_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] - hash.update(bufferPointer: credit_card_no) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(bufferPointer: account_no) // $ Alert[unified/swift/weak-sensitive-data-hashing] + hash.update(bufferPointer: credit_card_no) // $ Alert[unified/swift/weak-sensitive-data-hashing] } func testSHA256UpdateWithUnsafeRawBufferPointer(passwd : UnsafeRawBufferPointer, cert: UnsafeRawBufferPointer, encrypted_passwd : UnsafeRawBufferPointer, account_no : UnsafeRawBufferPointer, credit_card_no : UnsafeRawBufferPointer) { var hash = Crypto.SHA256() hash.update(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) - hash.update(bufferPointer: cert) // GOOD + hash.update(bufferPointer: cert) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) - hash.update(bufferPointer: account_no) // GOOD - hash.update(bufferPointer: credit_card_no) // GOOD + hash.update(bufferPointer: account_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD + hash.update(bufferPointer: credit_card_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD } func testSHA384UpdateWithUnsafeRawBufferPointer(passwd : UnsafeRawBufferPointer, cert: UnsafeRawBufferPointer, encrypted_passwd : UnsafeRawBufferPointer, account_no : UnsafeRawBufferPointer, credit_card_no : UnsafeRawBufferPointer) { var hash = Crypto.SHA384() hash.update(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) - hash.update(bufferPointer: cert) // GOOD + hash.update(bufferPointer: cert) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) - hash.update(bufferPointer: account_no) // GOOD - hash.update(bufferPointer: credit_card_no) // GOOD + hash.update(bufferPointer: account_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD + hash.update(bufferPointer: credit_card_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD } func testSHA512UpdateWithUnsafeRawBufferPointer(passwd : UnsafeRawBufferPointer, cert: UnsafeRawBufferPointer, encrypted_passwd : UnsafeRawBufferPointer, account_no : UnsafeRawBufferPointer, credit_card_no : UnsafeRawBufferPointer) { var hash = Crypto.SHA512() hash.update(bufferPointer: passwd) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) - hash.update(bufferPointer: cert) // GOOD + hash.update(bufferPointer: cert) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD hash.update(bufferPointer: encrypted_passwd) // GOOD (not sensitive) - hash.update(bufferPointer: account_no) // GOOD - hash.update(bufferPointer: credit_card_no) // GOOD + hash.update(bufferPointer: account_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD + hash.update(bufferPointer: credit_card_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD } func testBadExample(passwordString: String) { @@ -227,23 +227,23 @@ func testBadExample(passwordString: String) { } func testWithFlowAndMetatypes(cardNumber: String, passwordString: String) { - let value1 = Data(cardNumber.utf8); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] - let _digest1 = Insecure.MD5.hash(data: value1); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + let value1 = Data(cardNumber.utf8); // $ Source[unified/swift/weak-sensitive-data-hashing] + let _digest1 = Insecure.MD5.hash(data: value1); // $ Alert[unified/swift/weak-sensitive-data-hashing] - let value2 = Data(cardNumber.utf8); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + let value2 = Data(cardNumber.utf8); // $ Source[unified/swift/weak-sensitive-data-hashing] let hasher2 = Insecure.MD5.self; // metatype - let _digest2 = hasher2.hash(data: value2); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + let _digest2 = hasher2.hash(data: value2); // $ Alert[unified/swift/weak-sensitive-data-hashing] - let value3 = Data(cardNumber.utf8); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] - let _digest3 = (Insecure.MD5.self).hash(data: value3); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + let value3 = Data(cardNumber.utf8); // $ Source[unified/swift/weak-sensitive-data-hashing] + let _digest3 = (Insecure.MD5.self).hash(data: value3); // $ Alert[unified/swift/weak-sensitive-data-hashing] - let value4 = Data(cardNumber.utf8); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + let value4 = Data(cardNumber.utf8); // $ Source[unified/swift/weak-sensitive-data-hashing] testReceiver1(value: value4); - let value5 = Data(cardNumber.utf8); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + let value5 = Data(cardNumber.utf8); // $ Source[unified/swift/weak-sensitive-data-hashing] testReceiver2(hasher: Insecure.MD5.self, value: value5); - let value6 = Data(cardNumber.utf8); + let value6 = Data(cardNumber.utf8); // $ Source[unified/swift/weak-sensitive-data-hashing] testReceiver3(hasher: Insecure.MD5.self, value: value6); let value7 = Data(passwordString.utf8); // $ Source[unified/swift/weak-password-hashing] @@ -252,13 +252,13 @@ func testWithFlowAndMetatypes(cardNumber: String, passwordString: String) { } func testReceiver1(value: Data) { - let _digest = Insecure.MD5.hash(data: value); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + let _digest = Insecure.MD5.hash(data: value); // $ Alert[unified/swift/weak-sensitive-data-hashing] } func testReceiver2(hasher: Insecure.MD5.Type, value: Data) { - let _digest = hasher.hash(data: value); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + let _digest = hasher.hash(data: value); // $ Alert[unified/swift/weak-sensitive-data-hashing] } func testReceiver3(hasher: H.Type, value: Data) { - let _digest = hasher.hash(data: value); // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + let _digest = hasher.hash(data: value); // $ Alert[unified/swift/weak-sensitive-data-hashing] } diff --git a/unified/ql/test/query-tests/security/CWE-328/testCryptoSwift.swift b/unified/ql/test/query-tests/security/CWE-328/testCryptoSwift.swift index aae91aa07f0b..814616d3d547 100644 --- a/unified/ql/test/query-tests/security/CWE-328/testCryptoSwift.swift +++ b/unified/ql/test/query-tests/security/CWE-328/testCryptoSwift.swift @@ -60,11 +60,11 @@ struct Digest { } static func sha2(_ bytes: Array, variant: SHA2.Variant) -> Array { - return SHA2(variant: variant).calculate(for: bytes) + return SHA2(variant: variant).calculate(for: bytes) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] } static func sha3(_ bytes: Array, variant: SHA3.Variant) -> Array { - return SHA3(variant: variant).calculate(for: bytes) + return SHA3(variant: variant).calculate(for: bytes) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] } } @@ -150,84 +150,84 @@ extension String { func testArrays(harmlessArray: Array, phoneNumberArray: Array, passwdArray: Array) { _ = MD5().calculate(for: harmlessArray) // GOOD (not sensitive) - _ = MD5().calculate(for: phoneNumberArray) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = MD5().calculate(for: phoneNumberArray) // $ Alert[unified/swift/weak-sensitive-data-hashing] _ = MD5().calculate(for: passwdArray) // $ Alert[unified/swift/weak-password-hashing] _ = SHA1().calculate(for: harmlessArray) // GOOD (not sensitive) - _ = SHA1().calculate(for: phoneNumberArray) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = SHA1().calculate(for: phoneNumberArray) // $ Alert[unified/swift/weak-sensitive-data-hashing] _ = SHA1().calculate(for: passwdArray) // $ Alert[unified/swift/weak-password-hashing] _ = SHA2(variant: .sha512).calculate(for: harmlessArray) // GOOD - _ = SHA2(variant: .sha512).calculate(for: phoneNumberArray) // GOOD + _ = SHA2(variant: .sha512).calculate(for: phoneNumberArray) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD _ = SHA2(variant: .sha512).calculate(for: passwdArray) // $ Alert[unified/swift/weak-password-hashing] _ = SHA3(variant: .sha512).calculate(for: harmlessArray) // GOOD - _ = SHA3(variant: .sha512).calculate(for: phoneNumberArray) // GOOD + _ = SHA3(variant: .sha512).calculate(for: phoneNumberArray) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD _ = SHA3(variant: .sha512).calculate(for: passwdArray) // $ Alert[unified/swift/weak-password-hashing] _ = Digest.md5(harmlessArray) // GOOD (not sensitive) - _ = Digest.md5(phoneNumberArray) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = Digest.md5(phoneNumberArray) // $ Alert[unified/swift/weak-sensitive-data-hashing] _ = Digest.md5(passwdArray) // $ Alert[unified/swift/weak-password-hashing] _ = Digest.sha1(harmlessArray) // GOOD (not sensitive) - _ = Digest.sha1(phoneNumberArray) // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = Digest.sha1(phoneNumberArray) // $ Alert[unified/swift/weak-sensitive-data-hashing] _ = Digest.sha1(passwdArray) // $ Alert[unified/swift/weak-password-hashing] _ = Digest.sha512(harmlessArray) // GOOD (not sensitive) _ = Digest.sha512(phoneNumberArray) // GOOD _ = Digest.sha512(passwdArray) // $ Alert[unified/swift/weak-password-hashing] _ = Digest.sha2(harmlessArray, variant: .sha512) // GOOD (not sensitive) - _ = Digest.sha2(phoneNumberArray, variant: .sha512) // GOOD + _ = Digest.sha2(phoneNumberArray, variant: .sha512) // $ SPURIOUS: Source[unified/swift/weak-sensitive-data-hashing] // GOOD _ = Digest.sha2(passwdArray, variant: .sha512) // $ Alert[unified/swift/weak-password-hashing] _ = Digest.sha3(harmlessArray, variant: .sha512) // GOOD (not sensitive) - _ = Digest.sha3(phoneNumberArray, variant: .sha512) // GOOD + _ = Digest.sha3(phoneNumberArray, variant: .sha512) // $ SPURIOUS: Source[unified/swift/weak-sensitive-data-hashing] // GOOD _ = Digest.sha3(passwdArray, variant: .sha512) // $ Alert[unified/swift/weak-password-hashing] _ = harmlessArray.md5() // GOOD (not sensitive) - _ = phoneNumberArray.md5() // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = phoneNumberArray.md5() // $ Alert[unified/swift/weak-sensitive-data-hashing] _ = passwdArray.md5() // $ Alert[unified/swift/weak-password-hashing] _ = harmlessArray.sha1() // GOOD (not sensitive) - _ = phoneNumberArray.sha1() // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = phoneNumberArray.sha1() // $ Alert[unified/swift/weak-sensitive-data-hashing] _ = passwdArray.sha1() // $ Alert[unified/swift/weak-password-hashing] _ = harmlessArray.sha512() // GOOD _ = phoneNumberArray.sha512() // GOOD _ = passwdArray.sha512() // $ Alert[unified/swift/weak-password-hashing] _ = harmlessArray.sha2(.sha512) // GOOD - _ = phoneNumberArray.sha2(.sha512) // GOOD + _ = phoneNumberArray.sha2(.sha512) // $ SPURIOUS: Source[unified/swift/weak-sensitive-data-hashing] // GOOD _ = passwdArray.sha2(.sha512) // $ Alert[unified/swift/weak-password-hashing] _ = harmlessArray.sha3(.sha512) // GOOD - _ = phoneNumberArray.sha3(.sha512) // GOOD + _ = phoneNumberArray.sha3(.sha512) // $ SPURIOUS: Source[unified/swift/weak-sensitive-data-hashing] // GOOD _ = passwdArray.sha3(.sha512) // $ Alert[unified/swift/weak-password-hashing] } func testData(harmlessData: Data, medicalData: Data, passwdData: Data) { _ = harmlessData.md5() // GOOD (not sensitive) - _ = medicalData.md5() // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = medicalData.md5() // $ Alert[unified/swift/weak-sensitive-data-hashing] _ = passwdData.md5() // $ Alert[unified/swift/weak-password-hashing] _ = harmlessData.sha1() // GOOD (not sensitive) - _ = medicalData.sha1() // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = medicalData.sha1() // $ Alert[unified/swift/weak-sensitive-data-hashing] _ = passwdData.sha1() // $ Alert[unified/swift/weak-password-hashing] _ = harmlessData.sha512() // GOOD _ = medicalData.sha512() // GOOD _ = passwdData.sha512() // $ Alert[unified/swift/weak-password-hashing] _ = harmlessData.sha2(.sha512) // GOOD - _ = medicalData.sha2(.sha512) // GOOD + _ = medicalData.sha2(.sha512) // $ SPURIOUS: Source[unified/swift/weak-sensitive-data-hashing] // GOOD _ = passwdData.sha2(.sha512) // $ Alert[unified/swift/weak-password-hashing] _ = harmlessData.sha3(.sha512) // GOOD - _ = medicalData.sha3(.sha512) // GOOD + _ = medicalData.sha3(.sha512) // $ SPURIOUS: Source[unified/swift/weak-sensitive-data-hashing] // GOOD _ = passwdData.sha3(.sha512) // $ Alert[unified/swift/weak-password-hashing] } func testStrings(creditCardNumber: String, passwd: String) { _ = "harmless".md5() // GOOD (not sensitive) - _ = creditCardNumber.md5() // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = creditCardNumber.md5() // $ Alert[unified/swift/weak-sensitive-data-hashing] _ = passwd.md5() // $ Alert[unified/swift/weak-password-hashing] _ = "harmless".sha1() // GOOD (not sensitive) - _ = creditCardNumber.sha1() // $ MISSING: Alert[unified/swift/weak-sensitive-data-hashing] + _ = creditCardNumber.sha1() // $ Alert[unified/swift/weak-sensitive-data-hashing] _ = passwd.sha1() // $ Alert[unified/swift/weak-password-hashing] _ = "harmless".sha512() // GOOD _ = creditCardNumber.sha512() // GOOD _ = passwd.sha512() // $ Alert[unified/swift/weak-password-hashing] _ = "harmless".sha2(.sha512) // GOOD - _ = creditCardNumber.sha2(.sha512) // GOOD + _ = creditCardNumber.sha2(.sha512) // $ SPURIOUS: Source[unified/swift/weak-sensitive-data-hashing] // GOOD _ = passwd.sha2(.sha512) // $ Alert[unified/swift/weak-password-hashing] _ = "harmless".sha3(.sha512) // GOOD - _ = creditCardNumber.sha3(.sha512) // GOOD + _ = creditCardNumber.sha3(.sha512) // $ SPURIOUS: Source[unified/swift/weak-sensitive-data-hashing] // GOOD _ = passwd.sha3(.sha512) // $ Alert[unified/swift/weak-password-hashing] } From 01863f31522a8d979ca284bb2949ad6c3c36ba8d Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 3 Dec 2026 17:16:25 +0000 Subject: [PATCH 12/14] unified: Update OWASP TLS cheat sheet link in WeakSensitiveDataHashing.qhelp Update the renamed OWASP Transport Layer Protection Cheat Sheet URL and label to Transport Layer Security Cheat Sheet in WeakSensitiveDataHashing.qhelp, and remove the stray executable bit inherited from the original Swift files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../queries/security/CWE-328/WeakSensitiveDataHashing.qhelp | 4 ++-- .../security/CWE-328/WeakSensitiveDataHashingBad.swift | 0 .../security/CWE-328/WeakSensitiveDataHashingGood.swift | 0 3 files changed, 2 insertions(+), 2 deletions(-) mode change 100755 => 100644 unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.qhelp mode change 100755 => 100644 unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashingBad.swift mode change 100755 => 100644 unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashingGood.swift diff --git a/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.qhelp b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.qhelp old mode 100755 new mode 100644 index cda0a74671c4..72899f1c5a91 --- a/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.qhelp +++ b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.qhelp @@ -82,8 +82,8 @@ Cheat Sheet and - - Transport Layer Protection Cheat Sheet + + Transport Layer Security Cheat Sheet diff --git a/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashingBad.swift b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashingBad.swift old mode 100755 new mode 100644 diff --git a/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashingGood.swift b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashingGood.swift old mode 100755 new mode 100644 From b7103089592f4e2b300720e6fe205f709cecf068 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 3 Dec 2026 18:10:11 +0000 Subject: [PATCH 13/14] Unified: Rename the weak password hashing test cases for clarity, since the test is shared. --- .../ql/test/query-tests/security/CWE-328/testArgon2Swift.swift | 2 +- .../ql/test/query-tests/security/CWE-328/testCryptoKit.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unified/ql/test/query-tests/security/CWE-328/testArgon2Swift.swift b/unified/ql/test/query-tests/security/CWE-328/testArgon2Swift.swift index c0a02ef8b4e1..c75b32055a23 100644 --- a/unified/ql/test/query-tests/security/CWE-328/testArgon2Swift.swift +++ b/unified/ql/test/query-tests/security/CWE-328/testArgon2Swift.swift @@ -35,7 +35,7 @@ class Argon2Swift { // --- tests --- -func testGoodExample(passwordString: String) { +func testGoodPasswordHashingExample(passwordString: String) { // this is the "good" example from the `.qhelp` let salt = Salt.newSalt() let result = try! Argon2Swift.hashPasswordString(password: passwordString, salt: salt) // GOOD (suitable password hash) diff --git a/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift b/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift index 8177d36c20bf..eb6f236faa8d 100644 --- a/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift +++ b/unified/ql/test/query-tests/security/CWE-328/testCryptoKit.swift @@ -214,7 +214,7 @@ func testSHA512UpdateWithUnsafeRawBufferPointer(passwd : UnsafeRawBufferPointer, hash.update(bufferPointer: credit_card_no) // $ SPURIOUS: Alert[unified/swift/weak-sensitive-data-hashing] // GOOD } -func testBadExample(passwordString: String) { +func testBadPasswordHashingExample(passwordString: String) { // this is the "bad" example from the `.qhelp` let passwordData = Data(passwordString.utf8) let passwordHash = Crypto.SHA512.hash(data: passwordData) // $ Alert[unified/swift/weak-password-hashing] (not a computationally expensive hash) From d7141949ea98a35e05a3c1a07e6026b9bb80b7c5 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 3 Dec 2026 18:16:22 +0000 Subject: [PATCH 14/14] Unified: Minor correction and clarification in the .qhelp. --- .../queries/security/CWE-328/WeakSensitiveDataHashing.qhelp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.qhelp b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.qhelp index 72899f1c5a91..54a16ed29405 100644 --- a/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.qhelp +++ b/unified/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.qhelp @@ -31,7 +31,7 @@

    Since it's OK to use a weak cryptographic hash function in a non-security context, this query only alerts when these are used to hash sensitive - data (such as passwords, certificates, usernames). + data (such as usernames, identifying information and private data).

    @@ -60,7 +60,7 @@

    The following examples show a function for fetching data from a - URL along with a hash of the data, perhaps to check the data has + URL and computing a hash of the data, perhaps to check the data has not been tampered with.