mirror of
https://github.com/Kozea/Radicale.git
synced 2025-06-26 16:45:52 +00:00
Random timer to avoid timing oracles and simple bruteforce attacks
Important note: this is a security fix.
This commit is contained in:
parent
aef652fbe2
commit
190b1dd795
1 changed files with 7 additions and 3 deletions
|
@ -56,7 +56,8 @@ following significantly more secure schemes are parsable by Radicale:
|
|||
import base64
|
||||
import hashlib
|
||||
import os
|
||||
|
||||
import random
|
||||
import time
|
||||
|
||||
from .. import config
|
||||
|
||||
|
@ -161,7 +162,10 @@ def is_authenticated(user, password):
|
|||
if strippedline:
|
||||
login, hash_value = strippedline.split(":")
|
||||
if login == user:
|
||||
if _verifuncs[ENCRYPTION](hash_value, password):
|
||||
# Allow encryption method to be overridden at runtime.
|
||||
return _verifuncs[ENCRYPTION](hash_value, password)
|
||||
return True
|
||||
# Random timer to avoid timing oracles and simple bruteforce attacks
|
||||
time.sleep(1 + random.random())
|
||||
return False
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue