<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Matasano Chargen - Latest Comments in Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://matasanochargen.disqus.com/</link><description></description><atom:link href="http://matasanochargen.disqus.com/typing_the_letters_a_e_s_into_your_code_you8217re_doing_it_wrong/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 03 Nov 2011 08:11:06 -0000</lastBuildDate><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-354657918</link><description>&lt;p&gt;hicago. “My band is playing” notices line the wall. A hipster in a tight t-shirt hands &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">kamagra kaufen</dc:creator><pubDate>Thu, 03 Nov 2011 08:11:06 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-354527016</link><description>&lt;p&gt;I'm sure you're right. But I'm not writing about SSO. I'm writing about web crypto. &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Propecia</dc:creator><pubDate>Thu, 03 Nov 2011 04:53:55 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-12619220</link><description>&lt;p&gt;I don't think Coding Horror wants the attribution.&lt;/p&gt;

&lt;p&gt;___________________&lt;br&gt;Smarry&lt;br&gt;&lt;a href="http://www.directstartv.com/jump.html?referID=oa-0-173189" rel="nofollow"&gt;Get 28 movie channals for 3 months free&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">smarry</dc:creator><pubDate>Tue, 14 Jul 2009 01:21:59 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10830299</link><description>&lt;p&gt;Regarding this:&lt;br&gt;"You could tell how many bytes of the MAC matched by watching how long the function took."&lt;/p&gt;

&lt;p&gt;It seems like I have two options:&lt;br&gt;1. discard invalid data in the minimal amount of time, thereby mitigating potential DOS attacks.&lt;br&gt;2. discard data in the maximal amount of time, thereby eliminating a "timeable function" attack.&lt;/p&gt;

&lt;p&gt;Is there any middle ground here?  Because, given the two options, I think I'd go with #1.  Seems better to minimize the attack surface to millions of script kiddies at the cost of presenting a (small?) attack surface to hardened pros.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nobody Nohow</dc:creator><pubDate>Sat, 13 Jun 2009 02:01:58 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10816079</link><description>&lt;p&gt;Hey, I'm trying to improve my understanding of security related issues, and I can't tell if you are meaning that the example you gave would be a good, or a bad implementation.  I would like it if you could comment on which it is, and why.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dan</dc:creator><pubDate>Fri, 12 Jun 2009 17:33:18 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10815877</link><description>&lt;p&gt;that was informative and entertaining&lt;/p&gt;

&lt;p&gt;always know were your towel is!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Seth</dc:creator><pubDate>Fri, 12 Jun 2009 17:25:58 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10636260</link><description>&lt;p&gt;You can come up with all sorts of interesting ideas, but at the end of the day the problems have been solved already: use the existing primitives.&lt;/p&gt;

&lt;p&gt;If you want authenticity, use a HMAC or a signature.  If you want privacy, use encryption.  If you want both, use both.  With different keys.  Trying to make the encryption step do both is setting yourself up for a failure.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">caf</dc:creator><pubDate>Mon, 08 Jun 2009 23:15:44 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10585402</link><description>&lt;p&gt;I've never had to use encrypted session cookies, but I can see why they could be useful, and I've been thinking about how you could secure them. My first idea was to put a hash in there, such that:&lt;/p&gt;

&lt;p&gt;  cookie = ENCRYPT(plaintext + HASH(plaintext))&lt;/p&gt;

&lt;p&gt;When the server receives the cookie, it decrypts it, separates the plaintext from the hash, and checks the plaintext against the hash.  That would stop attackers from feeding you modified cookies, because the plaintext wouldn't even get parsed if the hash didn't match.&lt;/p&gt;

&lt;p&gt;Then I got to thinking that you can assume that the attacker can guess at least some of the plaintext, so I wondered if prepending it all with some randomness to get the started EBC would fix that.  Say the blocksize is 16 bytes, so add 16 bytes of randomness to the start of the plaintext:&lt;/p&gt;

&lt;p&gt;  cookie = ENCRYPT(random_bytes + plaintext + HASH(random_bytes + plaintext))&lt;/p&gt;

&lt;p&gt;Would that protect against known plaintext?  I don't really know my stuff here, so this could be the ramblings of an idiot, but I'm interested to know what flaws are in here :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">gbensn</dc:creator><pubDate>Sun, 07 Jun 2009 06:39:32 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10530397</link><description>&lt;p&gt;Now you have a zero-day in any system you've seen that does that.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nate</dc:creator><pubDate>Fri, 05 Jun 2009 15:14:33 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10530361</link><description>&lt;p&gt;I'm Nate Lawson, and I disavow any association with any modifications to the post since I read it.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nate</dc:creator><pubDate>Fri, 05 Jun 2009 15:13:18 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10530298</link><description>&lt;p&gt;Well, the question is valid. You could just zero-pad the password string and use it as a key instead of hashing it. Hashing never adds entropy, merely discards a little and shuffles it around equally.&lt;/p&gt;

&lt;p&gt;But, it feels wrong, doesn't it? Your password sitting at the left side of the buffer, a bunch of zeros on the right... Could this be a problem? In some cases, YES.&lt;/p&gt;

&lt;p&gt;If you were using AES, you'd be fine. Its key scheduling algorithm is good at handling all manner of keys. But if this was RC4, you just recreated the same problem as WEP.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nate</dc:creator><pubDate>Fri, 05 Jun 2009 15:11:18 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10525703</link><description>&lt;p&gt;Thanks for the article.  &lt;/p&gt;

&lt;p&gt;I've been coding for a very long time and I didn't understand anything but the math, which was quite clearly presented.&lt;/p&gt;

&lt;p&gt;From your article, I learned something about crypto, but more importantly I learned that I have no safe understanding of how to implement crypto whatsoever.  &lt;/p&gt;

&lt;p&gt;That's a very good thing to know.  &lt;/p&gt;

&lt;p&gt;You may have saved lives and fortunes with this post.&lt;/p&gt;

&lt;p&gt;(Overkill?  I don't know, maybe I'm just pumped up on laser unicorns in space)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">socrates</dc:creator><pubDate>Fri, 05 Jun 2009 13:02:57 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10523210</link><description>&lt;p&gt;It's assumed that a lot of SSO tokens are encrypted and are therefore a good excuse to talk about why generalist programmers shouldn't be directly working with AES.&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Thomas Ptacek</dc:creator><pubDate>Fri, 05 Jun 2009 11:56:14 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10521803</link><description>&lt;p&gt;Why is any more than a digital signature necessary here? All that's required is that the session data can't be tampered with and that the source of the data is a trusted server. The payload encryption seems to be unnecessary and seems to have distracted from the problem of authenticating the messages contents and origin.&lt;/p&gt;

&lt;p&gt;Or is it assumed that there's something confidential in the payload?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bell</dc:creator><pubDate>Fri, 05 Jun 2009 11:15:23 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10517277</link><description>&lt;p&gt;Yeah, like I said, once seen it written out in my comment the length extension attack was immediately apparent.&lt;/p&gt;

&lt;p&gt;(and I certainly wouldn't have ever done it that way myself, mainly because I remember rule #1 - don't do it yourself, call the damn library function you fool.  Just something I've seen)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">caf</dc:creator><pubDate>Fri, 05 Jun 2009 08:41:59 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10505579</link><description>&lt;p&gt;No, go directly to Jail, do not pass Go.&lt;/p&gt;

&lt;p&gt;Assuming by "MAC" you mean "HASH" (e.g., SHA), there is a length extension attack where you can append data and calculate the updated hash once you've seen one hash result. That's the reason HMAC has two layers (hash message w/ key, then hash the hash w/ key).&lt;/p&gt;

&lt;p&gt;For %!$&amp;amp;^%$!! sake, even WIKIPEDIA gets this one right:&lt;br&gt;   &lt;a href="http://en.wikipedia.org/wiki/HMAC" rel="nofollow"&gt;http://en.wikipedia.org/wiki/H...&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Seriously, I love the work but please stop creating new work via old mistakes.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nate</dc:creator><pubDate>Thu, 04 Jun 2009 22:32:50 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10505125</link><description>&lt;p&gt;You would never use a straight ASCII string as a crypto key. The hash gives you 128 bits of key material to use.&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Thomas Ptacek</dc:creator><pubDate>Thu, 04 Jun 2009 22:20:50 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10504546</link><description>&lt;p&gt;Never mind, once I see it written down, it's actually obvious why it's not.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">caf</dc:creator><pubDate>Thu, 04 Jun 2009 21:53:45 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10504477</link><description>&lt;p&gt;OMG, so many comments. Probably one of them says this:&lt;br&gt;"Wait, you're using crypto? Fool! Generate 128 bits of random data, stuff it in a CGI parameter, then have the second web server make a SOAP call to the first one to validate that the data is valid, fresh, and has only been used once."&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jeremiah Blatz</dc:creator><pubDate>Thu, 04 Jun 2009 21:49:46 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10501308</link><description>&lt;p&gt;This brings to mind a question I've had for a while.&lt;/p&gt;

&lt;p&gt;It's reasonably common to see people implementing their own HMAC as:&lt;/p&gt;

&lt;p&gt;HMAC(M, K) = MAC( K | M )&lt;/p&gt;

&lt;p&gt;(Where K is a block-sized key).&lt;/p&gt;

&lt;p&gt;Is that actually OK?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">caf</dc:creator><pubDate>Thu, 04 Jun 2009 19:16:48 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10498600</link><description>&lt;p&gt;I have the same question. No idea why that helps.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Daniel</dc:creator><pubDate>Thu, 04 Jun 2009 17:32:56 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10491248</link><description>&lt;p&gt;You can easily get much worse. See the PHP manual pages for proof. &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Thom</dc:creator><pubDate>Thu, 04 Jun 2009 13:55:42 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10480835</link><description>&lt;p&gt;I'm sure you're right. But I'm not writing about SSO. I'm writing about web crypto.&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Thomas H. Ptacek</dc:creator><pubDate>Thu, 04 Jun 2009 08:37:41 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10480823</link><description>&lt;p&gt;You are missing the point. I really could care less how you choose to implement SSO. This isn't an article about SSO.&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Thomas H. Ptacek</dc:creator><pubDate>Thu, 04 Jun 2009 08:37:07 -0000</pubDate></item><item><title>Re: Typing The Letters A-E-S Into Your Code? You&amp;#8217;re Doing It Wrong!</title><link>http://www.matasano.com/log/1749/typing-the-letters-a-e-s-into-your-code-youre-doing-it-wrong/#comment-10479777</link><description>&lt;p&gt;Thanks for the morning laughs.&lt;/p&gt;

&lt;p&gt;But I'm still having trouble with the premise here, so believability suffers a bit. Crypto should be a last resort. Not sharing the information is a much better solution. Why is it necessary to give the client this kind of information in the first place? Maybe the two servers are in different parallel universes, and only the client can pass between them? Otherwise I'd expect the client just to have a cookie that validates that server A is sending him/her/it to server B, which is at best just a random number generated by a sufficiently good PRNG.&lt;/p&gt;

&lt;p&gt;Why does an attacker get unlimited tries? That seems like a problem in and of itself. Maybe, through the use of a botnet, they can get "enough" tries, but "unlimited" seems like a stretch. And without a botnet, that shouldn't be an assumption at all.&lt;/p&gt;

&lt;p&gt;Also, the cookie contains an encrypted password? Really? I guess it's inevitable once you assume that the two servers aren't talking, but it's a bit obvious. It's like the old guy telling the teenage couple that they're going to get it, then watching a zombie werewolf toaster picking the teenagers out of their teeth a few scenes later. Yeah, we saw that coming.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">chandler</dc:creator><pubDate>Thu, 04 Jun 2009 07:45:12 -0000</pubDate></item></channel></rss>
