Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 98b06d3

Browse files
ahmed-farid-devsmowton
authored andcommitted
Update TimingAttackAgainstHeader.ql
1 parent bf95e59 commit 98b06d3

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

java/ql/src/experimental/Security/CWE/CWE-208/TimingAttackAgainstHeader.ql

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
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+
3632
class NonConstantTimeComparisonSink extends DataFlow::Node {
37-
Expr anotherParameter;
3833
NonConstantTimeComparisonSink() {
39-
isNonConstantTimeEqualsCall(this.asExpr(), anotherParameter)
34+
isNonConstantEqualsCallArgument(this.asExpr())
4035
}
4136
}
4237
class ClientSuppliedIpTokenCheck extends DataFlow::Node {

0 commit comments

Comments
 (0)