a a a c i a o Actual password for Alice Fail ! Time difference between two (otherwise identical) replies Attacker’s guess return input_pwd == secret_pwd input_pwd: secret_pwd:
string equality (==) operator? q It should be avoided in web apps q Don’t use to compare user input to private info q The Python implementation is insecure q The execution time is not constant 9
string equality (==) operator? ✘ It should be avoided in web apps Don’t use to compare user input to private info ✘ The Python implementation is insecure The execution time is not constant 10
info] • Attacker controls [pub input] • Computation takes time • Time = f(length of common prefix) ⇢ f() analyzed and leaks info to attacker 11 ⇠ side channel side ⇠ effect
hashes (where salt is kept secret from attacker) 12 hmac.compare_digest(a,b) • f() = k ⇢ Use a constant-time algorithm django.utils.crypto.constant_time_compare(a,b)
Bortz, D. Boneh, P. Nandy, Exposing Private Information by Timing Web Applications, WWW 2007 • What can be measured on an inet connection ⇢ S. Crosby, D. Wallach, R. Riedi, Opportunities and Limits of Remote Timing Attacks, TISSEC 12(3), 2009 14