@@ -17,21 +17,22 @@ import python
17
17
import semmle.python.dataflow.new.DataFlow
18
18
import semmle.python.dataflow.new.TaintTracking
19
19
import experimental.semmle.python.security.TimingAttack
20
- import DataFlow:: PathGraph
21
20
22
21
/**
23
22
* A configuration that tracks data flow from cryptographic operations
24
23
* to equality test
25
24
*/
26
- class PossibleTimingAttackAgainstHash extends TaintTracking :: Configuration {
27
- PossibleTimingAttackAgainstHash ( ) { this = "PossibleTimingAttackAgainstHash" }
25
+ private module PossibleTimingAttackAgainstHash implements DataFlow :: ConfigSig {
26
+ predicate isSource ( DataFlow :: Node source ) { source instanceof ProduceCryptoCall }
28
27
29
- override predicate isSource ( DataFlow:: Node source ) { source instanceof ProduceCryptoCall }
30
-
31
- override predicate isSink ( DataFlow:: Node sink ) { sink instanceof NonConstantTimeComparisonSink }
28
+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof NonConstantTimeComparisonSink }
32
29
}
33
30
34
- from PossibleTimingAttackAgainstHash config , DataFlow:: PathNode source , DataFlow:: PathNode sink
35
- where config .hasFlowPath ( source , sink )
31
+ module PossibleTimingAttackAgainstHashFlow = TaintTracking:: Global< PossibleTimingAttackAgainstHash > ;
32
+
33
+ import PossibleTimingAttackAgainstHashFlow:: PathGraph
34
+
35
+ from PossibleTimingAttackAgainstHashFlow:: PathNode source , PossibleTimingAttackAgainstHashFlow:: PathNode sink
36
+ where PossibleTimingAttackAgainstHashFlow:: flowPath ( source , sink )
36
37
select sink .getNode ( ) , source , sink , "Possible Timing attack against $@ validation." ,
37
38
source .getNode ( ) .( ProduceCryptoCall ) .getResultType ( ) , "message"
0 commit comments