[Python-Dev] Counting collisions for the win

Antoine Pitrou solipsis at pitrou.net
Fri Jan 20 14:51:59 CET 2012


On Fri, 20 Jan 2012 13:50:18 +0100
Victor Stinner <victor.stinner at haypocalc.com> wrote:

> > The main issue with that approach is that it allows a new kind of attack.
> >
> > An attacker now needs to find 1000 colliding keys, and submit them
> > one-by-one into a database. The limit will not trigger, as those are
> > just database insertions.
> >
> > Now, if the applications also as a need to read the entire database
> > table into a dictionary, that will suddenly break, and not for the
> > attacker (which would be ok), but for the regular user of the
> > application or the site administrator.
> 
> Oh, good catch. But it would not call it a new kind of attack, it is
> just a particular case of the hash collision vulnerability.
> 
> Counting collision doesn't solve this case, but it doesn't make the
> situation worse than before. Raising quickly an exception is better
> than stalling for minutes, even if I agree than it is not the best
> behaviour.

Actually, it *is* worse because stalling for seconds or minutes may not
be a problem in some cases (e.g. some batch script that gets run
overnight).

Regards

Antoine.




More information about the Python-Dev mailing list