[issue14621] Hash function is not randomized properly

Vlado Boza report at bugs.python.org
Thu Apr 19 19:58:09 CEST 2012


New submission from Vlado Boza <usama at ksp.sk>:

Fix of this http://bugs.python.org/issue13703 is broken.

tl;dr: There only 256 different hash functions (compare it to size of _Py_HashSecret prefix and suffix). And whether keys collide or not depends only on the last 8 bits of prefix. 

Problem with current randomization of hash function is following:
Suffix does not influence whether two keys have some hash or not (it is xor-ed after everything). 
Everything except last 8 bits in prefix does not influence it also. Try adding 0x474200 to prefix and see what happens (it will add 0x474200 to resulting hash). 

To make a DoS attack, attacker must do the following:
Generate sets of colliding keys for every 256 possible combinations of last 8 bits. Try each one of these sets - one will have significantly bigger response time, and then repeat this one.

----------
messages: 158736
nosy: Vlado.Boza
priority: normal
severity: normal
status: open
title: Hash function is not randomized properly
type: security

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14621>
_______________________________________


More information about the Python-bugs-list mailing list