Skip to content

Commit cf83b07

Browse files
Add more source of crypto call
1 parent daff777 commit cf83b07

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

python/ql/src/experimental/semmle/python/security/TimingAttack.qll

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ private import semmle.python.frameworks.Django
1010

1111
/** A method call that produces cryptographic result. */
1212
abstract class ProduceCryptoCall extends API::CallNode {
13-
/** Gets a type of cryptographic operation such as HMAC, signature or Hash. */
13+
/** Gets a type of cryptographic operation such as MAC, signature, Hash or ciphertext. */
1414
abstract string getResultType();
1515
}
1616

@@ -113,6 +113,21 @@ private class ProduceHashCall extends ProduceCryptoCall {
113113
override string getResultType() { result = "Hash" }
114114
}
115115

116+
/** A method call that produces a ciphertext. */
117+
private class ProduceCiphertextCall extends ProduceCryptoCall {
118+
ProduceCiphertextCall() {
119+
this =
120+
cryptodome()
121+
.getMember("Cipher")
122+
.getMember(["DES", "DES3", "ARC2", "ARC4", "Blowfish", "PKCS1_v1_5"])
123+
.getMember(["ARC4Cipher", "new", "PKCS115_Cipher"])
124+
.getMember("encrypt")
125+
.getACall()
126+
}
127+
128+
override string getResultType() { result = "ciphertext" }
129+
}
130+
116131
/** A data flow sink for comparison. */
117132
private predicate existsFailFastCheck(Expr firstInput, Expr secondInput) {
118133
exists(Compare compare |

0 commit comments

Comments
 (0)