<div class="gmail_quote">On Fri, Jan 20, 2012 at 1:34 AM, "Martin v. Löwis" <span dir="ltr"><<a href="mailto:martin@v.loewis.de">martin@v.loewis.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">> The last solution is very simple: count collision and raise an<br>
> exception if it hits a limit. The path is something like 10 lines<br>
> whereas the randomized hash is more close to 500 lines, add a new<br>
> file, change Visual Studio project file, etc. First I thaught that it<br>
> would break more applications than the randomized hash<br>
<br>
</div>The main issue with that approach is that it allows a new kind of attack.<br>
<br>
An attacker now needs to find 1000 colliding keys, and submit them<br>
one-by-one into a database. The limit will not trigger, as those are<br>
just database insertions.<br>
<br>
Now, if the applications also as a need to read the entire database<br>
table into a dictionary, that will suddenly break, and not for the<br>
attacker (which would be ok), but for the regular user of the<br>
application or the site administrator.<br>
<br>
So it may be that this approach actually simplifies the attack, making<br>
the cure worse than the disease.<br></blockquote><div><br></div><div>It would be a pretty lousy app that tried to load the contents of an entire database into a dict. It seems that this would require much more knowledge of what the app is trying to do before a successful attack can be mounted. So I don't think this is worse than the original attack -- I think it requires much more ingenuity of an attacker. (I'm thinking that the original attack is trivial once the set of 65000 colliding keys is public knowledge, which must be only a matter of time.)</div>
<div><br></div></div>-- <br>--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)<br>