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 base64
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
|
import random
|
||||||
|
import time
|
||||||
|
|
||||||
from .. import config
|
from .. import config
|
||||||
|
|
||||||
|
@ -161,7 +162,10 @@ def is_authenticated(user, password):
|
||||||
if strippedline:
|
if strippedline:
|
||||||
login, hash_value = strippedline.split(":")
|
login, hash_value = strippedline.split(":")
|
||||||
if login == user:
|
if login == user:
|
||||||
# Allow encryption method to be overridden at runtime.
|
if _verifuncs[ENCRYPTION](hash_value, password):
|
||||||
return _verifuncs[ENCRYPTION](hash_value, password)
|
# Allow encryption method to be overridden at runtime.
|
||||||
|
return True
|
||||||
|
# Random timer to avoid timing oracles and simple bruteforce attacks
|
||||||
|
time.sleep(1 + random.random())
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue