Skip to content

Instantly share code, notes, and snippets.

@artem-smotrakov
Created August 15, 2021 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artem-smotrakov/4e804592e671fa2207e5af1bc058f68a to your computer and use it in GitHub Desktop.
Save artem-smotrakov/4e804592e671fa2207e5af1bc058f68a to your computer and use it in GitHub Desktop.
CodeQL query for detecting timing attacks in Java code
from DataFlow::PathNode source, DataFlow::PathNode sink, NonConstantTimeCryptoComparisonConfig conf
where
conf.hasFlowPath(source, sink) and
(
source.getNode().(CryptoOperationSource).includesUserInput() and
sink.getNode().(NonConstantTimeComparisonSink).includesUserInput()
)
select sink.getNode(), source, sink, "Timing attack against $@ validation.", source,
source.getNode().(CryptoOperationSource).getCall().getResultType()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment