11/**
2- * @name Timing attack against headers value
3- * @description A constant-time algorithm should be used for checking the value of headers.
4- * In other words, the comparison time should not depend on the content of the input
5- * Otherwise, an attacker may be able to implement a timing attacks that may reveal the value of sensitive headers
2+ * @name Timing attack against header value
3+ * @description Use of a non-constant-time verification routine to check the value of an HTTP header,
4+ * possibly allowing a timing attack to infer the header's expected value.
65 * @kind path-problem
76 * @problem.severity error
87 * @precision high
@@ -24,19 +23,15 @@ private class NonConstantTimeEqualsCall extends MethodAccess {
2423 }
2524}
2625
27- private predicate isNonConstantTimeEqualsCall ( Expr firstObject , Expr secondObject ) {
26+ private predicate isNonConstantEqualsCallArgument ( Expr e ) {
2827 exists ( NonConstantTimeEqualsCall call |
29- firstObject = call .getQualifier ( ) and
30- secondObject = call .getAnArgument ( )
31- or
32- firstObject = call .getAnArgument ( ) and
33- secondObject = call .getQualifier ( )
34- )
28+ e = [ call .getQualifier ( ) , call .getAnArgument ( ) ]
3529}
30+
31+
3632class NonConstantTimeComparisonSink extends DataFlow:: Node {
37- Expr anotherParameter ;
3833 NonConstantTimeComparisonSink ( ) {
39- isNonConstantTimeEqualsCall ( this .asExpr ( ) , anotherParameter )
34+ isNonConstantEqualsCallArgument ( this .asExpr ( ) )
4035 }
4136}
4237class ClientSuppliedIpTokenCheck extends DataFlow:: Node {
0 commit comments