Skip to content

Commit

Permalink
Random timer to avoid timing oracles and simple bruteforce attacks
Browse files Browse the repository at this point in the history
Important note: this is a security fix.
  • Loading branch information
liZe committed Apr 19, 2017
1 parent 78e0bfd commit 059ba8d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions radicale/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
import functools
import hashlib
import os
import random
import time
from importlib import import_module


Expand Down Expand Up @@ -192,6 +194,8 @@ def is_authenticated(self, user, password):
line = line.strip()
if line:
login, hash_value = line.split(":")
if login == user:
return self.verify(hash_value, password)
if login == user and self.verify(hash_value, password):
return True
# Random timer to avoid timing oracles and simple bruteforce attacks
time.sleep(1 + random.random())
return False

0 comments on commit 059ba8d

Please # to comment.