<div>On Fri, Jul 16, 2010 at 2:02 PM, Phillip Hallam-Baker <span dir="ltr">&lt;<a href="mailto:hallam@gmail.com">hallam@gmail.com</a>&gt;</span> wrote:<br></div><div>&gt;<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "> insert a delay before returning an error condition.</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">&gt; This has the additional benefit of<br>&gt; slowing down the attacker.</span><br><br></div><div>
+1</div><div><br></div><div>bob wyman</div><div><br><div class="gmail_quote">On Fri, Jul 16, 2010 at 2:02 PM, Phillip Hallam-Baker <span dir="ltr">&lt;<a href="mailto:hallam@gmail.com">hallam@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">That would seem to me to point to a more general fix.<br>
<br>
I don&#39;t like fixes that depend on the skill and intelligence of the<br>
implementer. They tend to come unstuck. Fixing this timing bug is<br>
good, but how many others are there?<br>
<br>
A much easier fix to implement and one that would have general<br>
applicability against timing attacks would be to insert a delay before<br>
returning an error condition. This has the additional benefit of<br>
slowing down the attacker.<br>
<br>
I record the time I receive a packet as a matter of course. It would<br>
not be difficult to write some code that ensures that the time take to<br>
return an error is quantized at a pretty coarse level (10ms or so).<br>
<div><div></div><div class="h5"><br>
<br>
On Fri, Jul 16, 2010 at 12:41 PM, Breno de Medeiros &lt;<a href="mailto:breno@google.com">breno@google.com</a>&gt; wrote:<br>
&gt; On Fri, Jul 16, 2010 at 08:02, Pádraic Brady &lt;<a href="mailto:padraic.brady@yahoo.com">padraic.brady@yahoo.com</a>&gt; wrote:<br>
&gt;&gt; I can only speak for PHP, but the function is also multiples slower than a<br>
&gt;&gt; native comparison from when I was implementing it last year. Not all that<br>
&gt;&gt; surprising given PHP is also built on C (to the point it practically copies<br>
&gt;&gt; functions) so it should resolve similarly.<br>
&gt;<br>
&gt; The only fair comparison here is when the two inputs are equal.<br>
&gt; Lengthening the time of computation when the inputs are different is<br>
&gt; the goal of this fix.<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; Just on implementations - have you notified these directly? Not all of them<br>
&gt;&gt; may be paying attention to this list since it&#39;s not necessarily<br>
&gt;&gt; implementation specific.<br>
&gt;&gt;<br>
&gt;&gt; Paddy<br>
&gt;&gt;<br>
&gt;&gt; Pádraic Brady<br>
&gt;&gt;<br>
&gt;&gt; <a href="http://blog.astrumfutura.com" target="_blank">http://blog.astrumfutura.com</a><br>
&gt;&gt; <a href="http://www.survivethedeepend.com" target="_blank">http://www.survivethedeepend.com</a><br>
&gt;&gt; Zend Framework Community Review Team<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; ________________________________<br>
&gt;&gt; From: Nate Lawson &lt;<a href="mailto:nate@rootlabs.com">nate@rootlabs.com</a>&gt;<br>
&gt;&gt; To: Andrew Arnott &lt;<a href="mailto:andrewarnott@gmail.com">andrewarnott@gmail.com</a>&gt;<br>
&gt;&gt; Cc: openid-security &lt;<a href="mailto:openid-security@lists.openid.net">openid-security@lists.openid.net</a>&gt;<br>
&gt;&gt; Sent: Fri, July 16, 2010 12:20:36 AM<br>
&gt;&gt; Subject: Re: [security] Widespread Timing Vulnerabilities in OpenID<br>
&gt;&gt; implementations<br>
&gt;&gt;<br>
&gt;&gt; Andrew Arnott wrote:<br>
&gt;&gt;&gt; These six lines of code turn out to be ~*100 times slower* than the<br>
&gt;&gt;&gt; built-in<br>
&gt;&gt;&gt; .NET String.Equals function.  I don&#39;t know why there is such a perf<br>
&gt;&gt;&gt; difference, but apparently .NET has some serious string equality check<br>
&gt;&gt;&gt; optimizations in their native code.  Has anyone else compared the<br>
&gt;&gt;&gt; performance of their language&#39;s native string equality check function and<br>
&gt;&gt;&gt; this hand-written alternative?<br>
&gt;&gt;<br>
&gt;&gt; We&#39;re doing that as part of our talk. Did you compare 100% correct<br>
&gt;&gt; strings or were they different? Obviously, a compare that terminates<br>
&gt;&gt; early will be faster for non-matching input.<br>
&gt;&gt;<br>
&gt;&gt; When you say 100x slower, what are your actual numbers in terms of<br>
&gt;&gt; nanoseconds per byte for each version?<br>
&gt;&gt;<br>
&gt;&gt; In Python, a string compare with == devolves to a call to C memcmp(). I<br>
&gt;&gt; suspect .NET does the same thing. For Java and Ruby, it doesn&#39;t and so<br>
&gt;&gt; the routine Taylor posted is nearly identical in performance to the<br>
&gt;&gt; naive compare.<br>
&gt;&gt;<br>
&gt;&gt; I&#39;m sure the secret_cmp() function could be subject to some<br>
&gt;&gt; language-specific optimizations for non-native environments. It&#39;s worth<br>
&gt;&gt; looking into.<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Nate Lawson<br>
&gt;&gt; Root Labs :: <a href="http://www.rootlabs.com" target="_blank">www.rootlabs.com</a><br>
&gt;&gt; +1 (510) 595-9505 / (415) 305-5638 mobile<br>
&gt;&gt; Solving embedded security, kernel and crypto challenges<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; security mailing list<br>
&gt;&gt; <a href="mailto:security@lists.openid.net">security@lists.openid.net</a><br>
&gt;&gt; <a href="http://lists.openid.net/mailman/listinfo/openid-security" target="_blank">http://lists.openid.net/mailman/listinfo/openid-security</a><br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; security mailing list<br>
&gt;&gt; <a href="mailto:security@lists.openid.net">security@lists.openid.net</a><br>
&gt;&gt; <a href="http://lists.openid.net/mailman/listinfo/openid-security" target="_blank">http://lists.openid.net/mailman/listinfo/openid-security</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; --Breno<br>
&gt;<br>
&gt; +1 (650) 214-1007 desk<br>
&gt; +1 (408) 212-0135 (Grand Central)<br>
&gt; MTV-41-3 : 383-A<br>
&gt; PST (GMT-8) / PDT(GMT-7)<br>
&gt; _______________________________________________<br>
&gt; security mailing list<br>
&gt; <a href="mailto:security@lists.openid.net">security@lists.openid.net</a><br>
&gt; <a href="http://lists.openid.net/mailman/listinfo/openid-security" target="_blank">http://lists.openid.net/mailman/listinfo/openid-security</a><br>
&gt;<br>
<br>
<br>
<br>
</div></div><font color="#888888">--<br>
Website: <a href="http://hallambaker.com/" target="_blank">http://hallambaker.com/</a><br>
</font><div><div></div><div class="h5">_______________________________________________<br>
security mailing list<br>
<a href="mailto:security@lists.openid.net">security@lists.openid.net</a><br>
<a href="http://lists.openid.net/mailman/listinfo/openid-security" target="_blank">http://lists.openid.net/mailman/listinfo/openid-security</a><br>
</div></div></blockquote></div><br></div>