<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DUUHRX08fyp7ImA9WhBaEU4.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649</id><updated>2013-05-21T04:53:54.377-07:00</updated><category term="dictionary attacks" /><category term="passwords" /><category term="CAPTCHAs" /><title>A Few Thoughts on Cryptographic Engineering</title><subtitle type="html">Some random thoughts about crypto.  Notes from a course I teach.  Pictures of my dachshunds.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://blog.cryptographyengineering.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>98</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/AFewThoughtsOnCryptographicEngineering" /><feedburner:info uri="afewthoughtsoncryptographicengineering" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;DEcCRH4_fip7ImA9WhBbFk4.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-1241178465825836894</id><published>2013-05-13T21:19:00.004-07:00</published><updated>2013-05-15T09:41:05.046-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-15T09:41:05.046-07:00</app:edited><title>On cellular encryption</title><content type="html">&lt;div&gt;
&lt;a href="http://static.guim.co.uk/sys-images/Guardian/Pix/pictures/2013/5/4/1367669166312/cnn.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="177" src="http://static.guim.co.uk/sys-images/Guardian/Pix/pictures/2013/5/4/1367669166312/cnn.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
If you're interested in technology/privacy issues then you probably heard&amp;nbsp;&lt;a href="http://www.guardian.co.uk/commentisfree/2013/may/04/telephone-calls-recorded-fbi-boston"&gt;last week's big news&lt;/a&gt; out of the Boston Marathon case. It comes by way of former FBI agent Tim Clemente, who insists that our government routinely records all domestic phone calls.&lt;br /&gt;
&lt;br /&gt;
Clemente's claim generated lots of healthy skepticism. This isn't because the project is technically infeasible (&lt;a href="http://www.schneier.com/blog/archives/2013/05/is_the_us_gover.html"&gt;the numbers mostly add up&lt;/a&gt;), or because there's no &lt;a href="https://www.eff.org/files/filenode/att/presskit/ATT_onepager.pdf"&gt;precedent for warrantless wiretapping&lt;/a&gt;. To me the most convincing objection was simple:&amp;nbsp;&lt;i&gt;it'd be hard to keep secret.* &lt;/i&gt;Mostly for boring phone company reasons.&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;
But this led to another interesting discussion. What if we forget local phone eavesdropping and focus on an 'easier' problem: tapping only&amp;nbsp;&lt;u&gt;cellular&lt;/u&gt;&amp;nbsp;phone calls.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Cellular eavesdropping seems a lot more tractable, if only because mobile calls are conducted on a broadcast channel. That means you can wiretap with almost no carrier involvement. In fact there's circumstancial evidence that this already happening -- just by different parties than you'd think.&amp;nbsp;According to a&amp;nbsp;&lt;a href="http://www.amazon.com/Deep-State-Government-Secrecy-Industry/dp/1118146689"&gt;new book&lt;/a&gt; by reporters Marc Ambinder and Dave Brown:&lt;/div&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;The FBI has quietly removed from several Washington, D.C.–area cell phone towers, transmitters that fed all data to wire rooms at foreign embassies.&lt;/i&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;
This raises a few questions: once you've tapped someone's cellular signals, what do you do with the data? Isn't it all encrypted? And how easy would it be for the US or some foreign government to lay their hands on the plaintext?&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
All of this which serves as a wonderful excuse to noodle about the state of modern cellular encryption. Be warned that this is not going to be a short post! For those who don't like long articles, here's the TL;DR:&amp;nbsp;&lt;i&gt;cellular encryption is a whole lot worse than you think&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;GSM&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
GSM is the granddaddy of all digital cellular protocols, and it remains of the most popular protocols in the world. One thing that makes GSM special is its call encryption capability: the protocol is designed to encrypt all calls in between the handset and the local tower.&lt;br /&gt;
&lt;br /&gt;
Call encryption is facilitated by a long-term secret key (call it&amp;nbsp;&lt;i&gt;K)&lt;/i&gt;&amp;nbsp;that's stored&amp;nbsp;within the tamper-resistant&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Subscriber_identity_module"&gt;SIM&lt;/a&gt;&amp;nbsp;card in your GSM phone. Your carrier also has a copy of this key. When&amp;nbsp;your GSM phone connects to a tower, the parties execute the following authentication and key agreement protocol:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-QHc2Guk_Crs/UY_HLMviJTI/AAAAAAAAAYU/lyWoomtsnkM/s1600/gsmauth.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="169" src="http://3.bp.blogspot.com/-QHc2Guk_Crs/UY_HLMviJTI/AAAAAAAAAYU/lyWoomtsnkM/s320/gsmauth.gif" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;GSM authentication and key agreement protocol (&lt;a href="http://www.sciencedirect.com/science/article/pii/S0140366404001963"&gt;source&lt;/a&gt;). MS represents the 'mobile station' (phone) and &lt;br /&gt;
HLR is the 'home location register', a central database. The MS and HLR combine a long-term secret &lt;i&gt;Ki&lt;/i&gt;&lt;br /&gt;
with a random nonce &lt;i&gt;RAND&lt;/i&gt; to create the shared communication key&amp;nbsp;&lt;i&gt;Kc. &lt;/i&gt;A3 and A8 are &lt;br /&gt;
typically implemented&amp;nbsp;using the &lt;a href="http://en.wikipedia.org/wiki/COMP128"&gt;COMP128 function&lt;/a&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
The interaction above serves two purposes: first, both the phone and carrier (HLR) derive a pair of values that will be used for authentication and key agreement. This includes a session key&amp;nbsp;&lt;i&gt;Kc&lt;/i&gt; as well as a short authentication token &lt;i&gt;SRES&lt;/i&gt; that the phone will use to authenticate itself to the tower. Derivation is performed using two functions (A3 and A8) that accept the long-term secret&amp;nbsp;&lt;i&gt;K&lt;/i&gt;&amp;nbsp;and with a random nonce &lt;i&gt;RAND&lt;/i&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
There are a handful of well-known problems with the GSM security protocols. In no particular order, they are:&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;Lack of tower authentication. &lt;/b&gt;GSM phones authenticate to the tower, but the tower doesn't authenticate back.&amp;nbsp;This means that anyone can create a 'fake' tower that your phone will connect to. The major problem here is that in GSM,&amp;nbsp;&lt;i&gt;the tower gets to pick the encryption algorithm! &lt;/i&gt;That means your attacker can simply turn encryption off&amp;nbsp;(by setting encryption 'algorithm' A5/0) and simply route the cleartext data itself.&lt;br /&gt;&lt;br /&gt;In theory your phone is supposed to alert you to this kind of attack, but the SIM chip contains a bit that can de-active the warning. And&amp;nbsp;(as researcher Chris Paget discovered)&amp;nbsp;&lt;a href="http://www.youtube.com/watch?v=DU8hg4FTm0g"&gt;carriers often set this bit.&lt;/a&gt;&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Bad key derivation algorithms.&lt;/b&gt;&amp;nbsp;The GSM ciphers were developed using the '&lt;i&gt;make stuff up and pray nobody sees it&lt;/i&gt;' school of cryptographic algorithm design. This is a bad approach, since it's incredibly hard to keep algorithms secret -- and when they do leak, they tend to break badly. This was the case for the original &lt;i&gt;A3/A8&lt;/i&gt; algorithms, which are both implemented using single function called&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/COMP128"&gt;COMP128-1&lt;/a&gt;. Unfortunately COMP128&amp;nbsp;turns out to be&amp;nbsp;&lt;a href="http://www.isaac.cs.berkeley.edu/isaac/gsm-faq.html"&gt;seriously broken&lt;/a&gt; -- to the point where you can clone a user's SIM key in&amp;nbsp;&lt;a href="http://www.cs.washington.edu/research/projects/poirot3/Oakland/sp/PAPERS/02_01_03.PDF"&gt;as few as 8 queries.&lt;/a&gt;&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Bad encryption algorithms.&amp;nbsp;&lt;/b&gt;Fortunately it's easy to replace COMP128-1 by swapping out your SIM card. Unfortunately the situation is much worse for GSM's A5/1 call encryption cipher, which is embedded in the hardware of most handsets and tower equipment. A5/1 was leaked around the same time as COMP128 and rapidly succumbed to a series of&amp;nbsp;&lt;a href="http://cryptome.org/a51-bsw.htm"&gt;increasingly&lt;/a&gt; &lt;a href="http://link.springer.com/chapter/10.1007%2F3-540-44495-5_5"&gt;powerful&lt;/a&gt; &lt;a href="http://cs.ioc.ee/~tarmo/tday-viinistu/kasper-slides.pdf"&gt;attacks.&lt;/a&gt;&amp;nbsp;Today it's possible to conduct an efficient &lt;a href="http://www.schneier.com/blog/archives/2008/02/cryptanalysis_o_1.html"&gt;known-plaintext attack&lt;/a&gt; on A5/1 using a series of&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Rainbow_table"&gt;rainbow tables&lt;/a&gt;&amp;nbsp;you can obtain from &lt;a href="https://opensource.srlabs.de/projects/a51-decrypt/files"&gt;BitTorrent&lt;/a&gt;. The upshot is that most A5/1 calls can now be decrypted on a &lt;a href="https://srlabs.de/decrypting_gsm/"&gt;high-end PC.&lt;/a&gt;&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Terrible encryption algorithms. &lt;/b&gt;But it's actually worse than that. GSM phones support an '&lt;i&gt;export weakened&lt;/i&gt;' variant called &lt;a href="http://en.wikipedia.org/wiki/A5/2"&gt;A5/2&lt;/a&gt;, which is so weak you can &lt;a href="http://cryptome.org/gsm-crack-bbk.pdf"&gt;break it in real time&lt;/a&gt;. The worst part is that A5/2 uses the same key as A5/1 -- which means an active attacker (see #1 above) can briefly activate the A5/2 mode, crack to recover the encryption key, then switch back to A5/1 with a known key. This is much faster than attacking A5/1 directly, and allows eavesdroppers to intercept &lt;i&gt;incoming&lt;/i&gt;&amp;nbsp;phone calls from a legitimate (A5/1 supporting) tower.&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-SVtmeAni_NY/UZEQ4gHai1I/AAAAAAAAAYk/Tj7jWfc64JE/s1600/stingray.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="98" src="http://1.bp.blogspot.com/-SVtmeAni_NY/UZEQ4gHai1I/AAAAAAAAAYk/Tj7jWfc64JE/s200/stingray.jpg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Alleged 'Stingray' tracking device&lt;br /&gt;
mounted on an SUV (&lt;a href="http://www.pgsup.com/wp-content/uploads/2010/06/P4230059.jpg"&gt;source&lt;/a&gt;).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
Another unfortunate aspect of the GSM protocol is that you don't need to attack the crypto to do useful things. For example, if all you want to do is determine&amp;nbsp;&lt;i&gt;which&lt;/i&gt; devices area in an area, you simply present yourself as a valid tower -- and see which phones connect to you (by sending their IMSI values). This is the approach taken by&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/IMSI-catcher"&gt;IMSI-catchers&lt;/a&gt; like Stingray.&lt;br /&gt;
&lt;br /&gt;
Now the 'good news' here is that attacks &lt;i&gt;(1),&lt;/i&gt;&amp;nbsp;&lt;i&gt;(2) &lt;/i&gt;and&lt;i&gt; (4)&lt;/i&gt;&amp;nbsp;require active involvement by the attacker. This means they have to be after you specifically and -- at least in principal -- they're detectable if you know what to look for. (You don't.) However, the weaknesses in A5/1 are a whole different kettle of fish. They permit decryption of even passively recorded A5/1 GSM calls (in real time, or after the fact)&amp;nbsp;&lt;i&gt;even to an attacker with modest resources&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3G/4G/LTE&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A valid response to the points above is to note that GSM is nearly 30 years old. You probably wouldn't blame today's Ford execs for the crash performance of a &lt;a href="http://www.youtube.com/watch?v=igNqkb64I1c"&gt;1982 Ford Escort&lt;/a&gt;, and similarly you shouldn't hold the GSM designers responsible for a 1980s protocol -- even if&amp;nbsp;&lt;a href="http://www.blackhat.com/presentations/bh-dc-08/Steve-DHulton/Whitepaper/bh-dc-08-steve-dhulton-WP.pdf"&gt;billions of people&lt;/a&gt;&amp;nbsp;still rely on it.&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-aeCKiJVWgQg/UZEs88mC1MI/AAAAAAAAAZs/ST7ETOWZ8qM/s1600/3gAKA.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="212" src="http://4.bp.blogspot.com/-aeCKiJVWgQg/UZEs88mC1MI/AAAAAAAAAZs/ST7ETOWZ8qM/s320/3gAKA.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Overview of the 3G AKA protocol. Look familiar?&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;div&gt;
The great news is that modern phones often support the improved '3G' (&lt;i&gt;e.g.,&amp;nbsp;&lt;/i&gt;UMTS) or LTE standards. These offer a bundle of improvements that substantially improve security over the original GSM. These can be summed up as follows:&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;Mutual authentication&lt;/b&gt;. The 3G protocols use a new '&lt;a href="http://en.wikipedia.org/wiki/AKA_(security)"&gt;Authentication and Key Agreement&lt;/a&gt;' (AKA) protocol, which adds &lt;i&gt;mutual&lt;/i&gt;&amp;nbsp;authentication to the tower connection. To validate that the phone is speaking to a legitimate tower, the carrier now computes a &lt;a href="http://en.wikipedia.org/wiki/Message_authentication_code"&gt;MAC&lt;/a&gt; that the phone can verify before initiating a connection. This prevents many of the uglier protocol attacks that plagued GSM.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Better authentication algorithms&lt;/b&gt;. The session keys and authentication tags are still computed using proprietary algorithms -- now called&amp;nbsp;&lt;i&gt;f1-f5, f5* --&lt;/i&gt;&amp;nbsp;but the algorithms are purportedly much stronger. Since their design is carrier-specific it's not easy to say exactly &lt;i&gt;how&lt;/i&gt;&amp;nbsp;they work. However&amp;nbsp;&lt;a href="http://www.etsi.org/deliver/etsi_ts/135200_135299/135205/10.00.00_60/ts_135205v100000p.pdf"&gt;this 3GPP recommendation&lt;/a&gt; indicates that they might be based on a block cipher like AES.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Better encryption&lt;/b&gt;.&lt;b&gt;&amp;nbsp;&lt;/b&gt;Call encryption in 3G uses a proprietary block cipher called &lt;a href="http://en.wikipedia.org/wiki/KASUMI"&gt;KASUMI&lt;/a&gt;. KASUMI is based off of a Mitsubishi proposal called &lt;a href="http://en.wikipedia.org/wiki/MISTY1"&gt;MISTY1&lt;/a&gt;, which was heavy customized to make it faster in cellular hardware.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
The biggest source of concern for 3G/LTE is that you may not be using it. Most phones are programmed to gracefully '&lt;i&gt;fail over'&lt;/i&gt; to GSM when a 3G/4G connection seems unavailable. Active attackers exploit this feature to implement a &lt;i&gt;rollback attack&lt;/i&gt; -- jamming 3G/4G connections, and thus re-activating all of the GSM attacks described above.&lt;br /&gt;
&lt;br /&gt;
A more subtle concern is the weakness of the KASUMI cipher. Unfortunately KASUMI seems &lt;i&gt;much&lt;/i&gt;&amp;nbsp;weaker than the original MISTY1 algorithm -- so much weaker that in 2010 &lt;a href="http://eprint.iacr.org/2010/013.pdf"&gt;Dunkelman, Keller and Shamir&lt;/a&gt;&amp;nbsp;were able to implement&amp;nbsp;a related-key attack that recovered a full 128 bit call key in just under two hours!&lt;br /&gt;
&lt;br /&gt;
Now before you panic, you should know that executing this attack requires a substantial amount of data, all of which must all be encrypted under highly unrealistic attack conditions. Still, it's interesting to note that the same attack fails completely when applied to the original MISTY1 design.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-ss7Fd_bWGIk/UZEsErXc8wI/AAAAAAAAAZg/SnVGQb46yXI/s1600/3gproposal.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="300" src="http://4.bp.blogspot.com/-ss7Fd_bWGIk/UZEsErXc8wI/AAAAAAAAAZg/SnVGQb46yXI/s320/3gproposal.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Top: generation of keys (CK, IK) and authentication tags AUTN, XRES using the functions &lt;i&gt;f1-f5. &lt;/i&gt;Bottom: one proposed implementation of those functions using a 128-bit block cipher &lt;i&gt;Ek. &lt;/i&gt;This could be AES (&lt;a href="http://www.etsi.org/deliver/etsi_ts/135200_135299/135205/10.00.00_60/ts_135205v100000p.pdf"&gt;source&lt;/a&gt;).&lt;br /&gt;
And yes, it looks complicated to me, too.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
&lt;b&gt;What if you have already the keys?&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
The encryption flaws above seem pretty significant, and they really are -- if you're a private eavesdropper or a foreign government. For US national security organizations they're probably beside the point. It seems unlikely that the NSA would have to 'break' any crypto at all.&lt;br /&gt;
&lt;br /&gt;
This is because both the GSM and AKA protocols lack an important property known as&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Perfect_forward_secrecy"&gt;forward secrecy&lt;/a&gt;. What this means is that if I can record an encrypted call, and later obtain the long-term key &lt;i&gt;K&lt;/i&gt;&amp;nbsp;for that phone, then I can still reliably decrypt the whole communication -- even months or years later. (Protocols such as Diffie-Hellman or ECMQV prevent this.) Worse, for cellular conversations I can do it even if I only have&amp;nbsp;&lt;i&gt;one half&lt;/i&gt;&amp;nbsp;(the tower side) of the communication channel.&lt;br /&gt;
&lt;br /&gt;
Unfortunately I don't think you have to be a conspiracy theorist to suppose that the carriers' key databases are probably stored somewhere in Ft. Meade. Thus to the truly paranoid: stop talking on cellphones.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;In conclusion&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Sometimes conspiracy theories can be fun. Sometimes they're downright creepy.&lt;br /&gt;
&lt;br /&gt;
For me this discussion veers towards the 'creepy'. Not so much because I think the NSA really is tapping all our cellphones (I suspect they just read our Facebook). Rather, the creepiness is in seeing just how vulnerable our privacy infrastructure is, even to people who are &lt;i&gt;far less capable&amp;nbsp;than the NSA.&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
As a result, your data isn't just available to nation states: it's also potentially available to that goofball neighbor who bought an &lt;a href="http://www.alibaba.com/industry-promotion/imsi-catcher-industry-promotion.html"&gt;IMSI-catcher off the Internet&lt;/a&gt;. Or to your business competitor. Or even to that one girl who finally got &lt;a href="http://gnuradio.org/redmine/projects/gnuradio/wiki"&gt;GnuRadio&lt;/a&gt; to compile.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
We're rapidly approaching a technological crossroads, one where we need to decide if we're going to keep trusting others to protect our data -- or if we're going to take charge of it and treat carriers as the dumb and insecure pipes that they are. I suspect that we're well on our way towards this world -- and sadly,&amp;nbsp;&lt;a href="http://motherboard.vice.com/blog/fbi-data-wiretap-trevor-timm-interview"&gt;so does the FBI&lt;/a&gt;. It'll be interesting to see how things play out.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Notes:&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;*&amp;nbsp;&lt;/i&gt;The argument is that recording&amp;nbsp;&lt;i&gt;all&lt;/i&gt;&amp;nbsp;local calls in real time is a bigger job than just&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/NSA_warrantless_surveillance_controversy"&gt;splitting major trunks&lt;/a&gt;&amp;nbsp;or re-routing a few&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Communications_Assistance_for_Law_Enforcement_Act"&gt;specific&lt;/a&gt;&amp;nbsp;targets. It would seem to require significant changes to the US phone infrastructure. This is particularly true at the local&amp;nbsp;&lt;a href="https://en.wikipedia.org/wiki/Telephone_exchange"&gt;office&lt;/a&gt;, where you'd need to upgrade and provision thousands of devices to record all calls passing through them. Building this capability is possible, but would require a lot of effort -- not to mention the complicity of hundreds (or thousands) of collaborators at the local telcos. And that means&amp;nbsp;&lt;i&gt;a whole lot&lt;/i&gt;&amp;nbsp;of people keeping a very big secret. People aren't so good at that.&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/f7QFwQhCeC8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/1241178465825836894/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2013/05/a-few-thoughts-on-cellular-encryption.html#comment-form" title="8 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/1241178465825836894?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/1241178465825836894?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/f7QFwQhCeC8/a-few-thoughts-on-cellular-encryption.html" title="On cellular encryption" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-QHc2Guk_Crs/UY_HLMviJTI/AAAAAAAAAYU/lyWoomtsnkM/s72-c/gsmauth.gif" height="72" width="72" /><thr:total>8</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2013/05/a-few-thoughts-on-cellular-encryption.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkMMSHg5eip7ImA9WhBUGU4.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-6600044364345980543</id><published>2013-05-07T06:44:00.000-07:00</published><updated>2013-05-07T06:48:09.622-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-07T06:48:09.622-07:00</app:edited><title>We're still alive</title><content type="html">&lt;a href="http://blog.port3101.org/si/attachments/1d1242384332-eu-blackberry-service-outage-technical_support_outage_advisory.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="144" src="http://blog.port3101.org/si/attachments/1d1242384332-eu-blackberry-service-outage-technical_support_outage_advisory.jpg" width="200" /&gt;&lt;/a&gt;It's been a busy couple of weeks chock full of deadlines, all of which have had a direct and negative impact on blogging productivity.&lt;br /&gt;
&lt;br /&gt;
Still: things are happening in the world! In the next few weeks I hope to have posts up on exciting topics like &lt;a href="http://en.wikipedia.org/wiki/Convergent_encryption"&gt;convergent encryption&lt;/a&gt;, IBM's exciting &lt;a href="http://it.slashdot.org/story/13/05/02/175249/ibm-researchers-open-source-homomorphic-crypto-library"&gt;open source Fully Homomorphic Encryption library&lt;/a&gt; (AES in less than 30 hours!), &lt;a href="https://password-hashing.net/"&gt;password hashing&lt;/a&gt;, cellular wiretapping... and plenty more on the hot mess that is the field of &lt;a href="http://eprint.iacr.org/2012/074"&gt;practice-oriented provable security&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Please hang in there. Normal service &lt;i&gt;will&lt;/i&gt; resume shortly.&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/a5D2M8kTB3M" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/6600044364345980543/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2013/05/were-still-alive.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/6600044364345980543?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/6600044364345980543?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/a5D2M8kTB3M/were-still-alive.html" title="We're still alive" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2013/05/were-still-alive.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0QHRHs4cSp7ImA9WhBWGUs.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-2416761623474678762</id><published>2013-04-11T13:55:00.000-07:00</published><updated>2013-04-14T12:55:35.539-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-14T12:55:35.539-07:00</app:edited><title>Zerocoin: making Bitcoin anonymous</title><content type="html">&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-R5563vo82Ws/UWXP3txJtuI/AAAAAAAAAXQ/htCVKFrYV5k/s1600/bitcoinpress.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="172" src="http://4.bp.blogspot.com/-R5563vo82Ws/UWXP3txJtuI/AAAAAAAAAXQ/htCVKFrYV5k/s320/bitcoinpress.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;This is what it's like to die of stupid.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Wow, what the heck is &lt;a href="http://bitcoincharts.com/charts/mtgoxUSD"&gt;going on&lt;/a&gt; with Bitcoin?&lt;br /&gt;
&lt;br /&gt;
When I started this post, the value of a single bitcoin had surged upwards of $250. It's corrected a bit since then (down $100 or so), but it's pretty clear that we live in a very different world than we did two weeks ago.&lt;br /&gt;
&lt;br /&gt;
And I'm not sure I really &lt;i&gt;like&lt;/i&gt; this world. It's a world where I have to listen to &lt;a href="http://video.cnbc.com/gallery/?play=1&amp;amp;video=3000158264"&gt;CNBC reporters try to understand Bitcoin&lt;/a&gt;. Ouch. I think we can all agree that we were better off before this happened.&lt;br /&gt;
&lt;br /&gt;
The explosion of interest in Bitcoin is both wonderful and terrible. It's wonderful because Bitcoin is an amazing technical innovation -- the first decentralized electronic currency to actually make something of itself&lt;i&gt;.&lt;/i&gt;&amp;nbsp;It's terrible because Bitcoin has some&amp;nbsp;&lt;a href="https://en.bitcoin.it/wiki/Common_Vulnerabilities_and_Exposures"&gt;technical&lt;/a&gt; &lt;a href="https://en.bitcoin.it/wiki/Scalability"&gt;rough&lt;/a&gt; &lt;a href="http://anonymity-in-bitcoin.blogspot.com/2011/07/bitcoin-is-not-anonymous.html"&gt;edges&lt;/a&gt; &lt;a href="http://bitcoin.org/chainfork.html"&gt;that&lt;/a&gt;&amp;nbsp;really need to be filed off before we start &lt;i&gt;using&lt;/i&gt; it for anything.&lt;br /&gt;
&lt;br /&gt;
The rough edge that particularly interests me is user&amp;nbsp;&lt;i&gt;privacy. &lt;/i&gt;Or rather,&amp;nbsp;Bitcoin's troubling&amp;nbsp;&lt;a href="http://anonymity-in-bitcoin.blogspot.com/2011/07/bitcoin-is-not-anonymous.html"&gt;lack of&amp;nbsp;it&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
In this post I'm going to describe a &lt;a href="http://spar.isi.jhu.edu/~mgreen/ZerocoinOakland.pdf"&gt;new piece of research&lt;/a&gt; out of my&amp;nbsp;lab at Johns Hopkins that provides one potential solution to this problem. This is joint work led by my hardworking students Ian Miers and Christina Garman, along with my colleague Avi Rubin. Our proposal is called &lt;a href="http://spar.isi.jhu.edu/~mgreen/ZerocoinOakland.pdf"&gt;Zerocoin&lt;/a&gt;, and we'll be presenting it at this year's &lt;a href="http://www.ieee-security.org/TC/SP2013/"&gt;IEEE S&amp;amp;P&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
For those who just want the TL;DR, here it is:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;Zerocoin is a new cryptographic extension to Bitcoin that (if adopted) would bring true cryptographic anonymity to Bitcoin. It works at the protocol level and doesn't require new trusted parties or services. With some engineering, it might (someday) turn Bitcoin into a completely untraceable, anonymous electronic currency.&lt;/i&gt;&lt;/blockquote&gt;
In the rest of the post I'm going to explain Zerocoin, what it can do for Bitcoin, and how far away that '&lt;i&gt;someday&lt;/i&gt;' might be. This is going to be a &lt;i&gt;long,&amp;nbsp;&lt;/i&gt;wonky post, so I won't be offended if you stop here and take my word that it's all true.&lt;br /&gt;
&lt;br /&gt;
For everyone else, strap in. I need to start with some background.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Bitcoin in 300 words&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Before I get to Zerocoin I need to give the world's shortest explanation of how Bitcoin works. (&lt;a href="http://blog.cryptographyengineering.com/p/in-order-to-explain-zerocoin-i-first.html"&gt;See here&lt;/a&gt; for a slightly less terrible explanation.)&lt;br /&gt;
&lt;br /&gt;
At its heart, Bitcoin is a transaction network with a distributed public ledger. Transactions are files&amp;nbsp;that contains messages like "&lt;i&gt;User X transfers 3 bitcoins to user Y"&lt;/i&gt;&amp;nbsp;and "&lt;i&gt;User Y transfers 2.5 of those bitcoins to user Z"&lt;/i&gt;. Users aren't identified by name. Instead, their identities are public keys for a &lt;a href="http://en.wikipedia.org/wiki/Digital_signature"&gt;digital signature scheme&lt;/a&gt;.* This allows users to&amp;nbsp;&lt;i&gt;sign&lt;/i&gt;&amp;nbsp;their transactions, and makes it very difficult to forge them.&lt;br /&gt;
&lt;br /&gt;
Now none of this stuff is &lt;a href="http://www.weidai.com/bmoney.txt"&gt;really new&lt;/a&gt;. What makes Bitcoin special is the way it maintains the transaction ledger. Rather than storing the whole thing on a single computer, the ledger -- called a &lt;a href="http://blockchain.info/"&gt;block chain&lt;/a&gt; -- is massively replicated and updated by a swarm of mutually distrustful parties running in a peer-to-peer network.&lt;br /&gt;
&lt;br /&gt;
To make this work, nodes pull transactions off of a peer-to-peer broadcast network, then compete for the opportunity to tack them on the end of the chain. To keep one party from dominating this process (and posting bad transations), competition is enforced by making the parties solve hard mathematical problems called '&lt;a href="http://en.wikipedia.org/wiki/Proof-of-work_system"&gt;proofs of work&lt;/a&gt;'. The integrity of the block chain is enforced using &lt;a href="http://en.wikipedia.org/wiki/Hash_chain"&gt;hash chaining&lt;/a&gt;, which makes it very difficult to change history.&lt;br /&gt;
&lt;br /&gt;
Now the block chain is fascinating, and if you're interested in the gory details you should by all means see&amp;nbsp;&lt;a href="https://en.bitcoin.it/wiki/How_bitcoin_works"&gt;here&lt;/a&gt;. This post mostly isn't going to get into it. For now all you need to know is that the block chain works like a global ledger. It's easy to add (valid) transactions at the end, but it's astonishingly difficult to tamper with the transactions that are already there.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;So what's the problem?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The block chain is Bitcoin's greatest strength. Unfortunately from a &lt;i&gt;privacy &lt;/i&gt;perspective,&amp;nbsp;it's also the currency's greatest weakness.&lt;br /&gt;
&lt;br /&gt;
This is because the block chain contains a record of &lt;i&gt;every single Bitcoin transaction &lt;/i&gt;that's ever been conducted. Due to the way Bitcoin works, this information can't be limited to just a few trustworthy parties, since there &lt;i&gt;are&lt;/i&gt;&amp;nbsp;no trusted parties. This means&lt;i&gt;&amp;nbsp;&lt;/i&gt;all of your transactions are conducted in public.&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-RP27VvCVr4k/UWRQUKJugOI/AAAAAAAAAWo/uSMREyYbHso/s1600/bitcoinchain.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="82" src="http://3.bp.blogspot.com/-RP27VvCVr4k/UWRQUKJugOI/AAAAAAAAAWo/uSMREyYbHso/s400/bitcoinchain.png" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Illustration of a Bitcoin block chain. Each transaction is tied to the one that precedes it. &lt;br /&gt;
The transaction at far left is almost certainly a drug deal.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
In a sense this makes Bitcoin&amp;nbsp;less private than cash, and even worse than credit cards. If you choose to engage in sensitive transactions on Bitcoin, you should be aware that a record will be preserved for all eternity. Spend with care.&lt;br /&gt;
&lt;br /&gt;
Now some will say this is unfair, since Bitcoin users are &lt;i&gt;not &lt;/i&gt;identified by name -- the only identifier associated with your transactions is your&amp;nbsp;public key. Moreover, you can make as many public keys as you'd like. In other words, Bitcoin offers privacy through&amp;nbsp;&lt;i&gt;&lt;a href="http://en.wikipedia.org/wiki/Pseudonymity"&gt;pseudonymity&lt;/a&gt;, &lt;/i&gt;which some argue is almost as good as the real thing.&lt;br /&gt;
&lt;br /&gt;
But don't get too comfortable. Already several academic works have &lt;a href="http://eprint.iacr.org/2012/584.pdf"&gt;succeeded in&lt;/a&gt; &lt;a href="http://eprint.iacr.org/2012/596.pdf"&gt;de-anonymizing&lt;/a&gt;&amp;nbsp;Bitcoin transactions. And this work is just getting started. You see, there's an entire subfield&amp;nbsp;of computer science that can roughly be described as '&lt;i&gt;pulling information out of things that look exactly like the Bitcoin transaction graph', &lt;/i&gt;and while these researchers haven't done much to Bitcoin &lt;i&gt;yet --&lt;/i&gt; that's only because they're still fighting over the grant money. We will see more.&lt;br /&gt;
&lt;br /&gt;
If you're a Bitcoin user who values your privacy, this should worry you. The worst part is that right now your options are somewhat limited. Roughly speaking, they are:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;&lt;b&gt;Just be careful&lt;/b&gt;&lt;/i&gt;&lt;b&gt;.&lt;/b&gt; Generate lots of public keys and make sure your client software is extremely careful not to use them in ways that could tie one to another (&lt;i&gt;e.g.,&lt;/i&gt;&amp;nbsp;getting 'change' from one key sent to another). This seems to be the major privacy thrust of the current Bitcoin development effort, and we're all waiting to see how it pans out.&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;&lt;b&gt;Use a laundry&lt;/b&gt;&lt;/i&gt;&lt;b&gt;.&lt;/b&gt; For the more paranoid, there are services called '&lt;i&gt;&lt;a href="http://bitcoin.stackexchange.com/questions/1480/what-bitcoin-mixing-laundry-services-are-availble-today"&gt;laundries&lt;/a&gt;'&lt;/i&gt;&amp;nbsp;that take in bitcoins from a whole bunch of users, mix them up and shuffle them back out. In theory this makes it hard to track your money. Unfortunately, laundries suffer from a few problems. First, they only work well if lots of people are using them, and today's laundries have relatively low volume. More importantly, you're entirely dependent on the honesty and goodwill of the laundry itself. A dishonest (or hacked) laundry can &lt;a href="https://bitcointalk.org/index.php?topic=94933.0"&gt;steal your coins&lt;/a&gt;, or even trace its inputs and outputs -- which could completely undermine your privacy.&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;&lt;b&gt;Use a Chaumian e-cash system&lt;/b&gt;&lt;/i&gt;&lt;b&gt;.&lt;/b&gt;&amp;nbsp;On the wonkier side, there have been &lt;a href="http://www.bitcoinmoney.com/post/6187527905/bitcoin-chauming-blinding-transfer-service"&gt;attempts&lt;/a&gt; to implement real &lt;a href="http://en.wikipedia.org/wiki/Ecash"&gt;anonymous cryptographic e-Cash for Bitcoin&lt;/a&gt;. I've &lt;a href="http://blog.cryptographyengineering.com/2012/05/future-of-electronic-currency.html"&gt;written about&lt;/a&gt; these systems before and while I think they're neat, the existing schemes (from &lt;a href="http://cs.jhu.edu/~sdoshi/crypto/papers/chaum-c82.pdf"&gt;Chaum&lt;/a&gt; on forward) have one critical flaw: they all rely on a central 'bank' to issue and redeem e-Cash tokens. The need for this bank has been a major stumbling block in getting these systems up and running, and it's almost unworkable for Bitcoin -- since trusted parties are antithetical to Bitcoin's decentralized nature.&lt;/blockquote&gt;
In short, the current solutions aren't perfect. It would be awfully nice if we had something better. Something with the power of cryptographic e-Cash, but without the need to change Bitcoin's network model. And &lt;i&gt;this&lt;/i&gt; is where Zerocoin comes in.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Zerocoin&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
Zerocoin is not intended as a replacement for Bitcoin. It's actually a separate anonymous currency that's designed to live side-by-side with Bitcoin on the same block chain. Zerocoins are fully exchangeable on a one-to-one basis with bitcoins, which means (in principle) you can use them with existing merchants.&lt;br /&gt;
&lt;br /&gt;
Zerocoins themselves can be thought of literally as coins. They're issued in a fixed denomination (for example, 1 BTC), and any user can purchase a zerocoin in exchange for the correct quantity of bitcoin. This purchase is done by placing a special new 'Zerocoin Mint' transaction onto the block chain.&lt;br /&gt;
&lt;br /&gt;
Once a Mint transaction has been accepted by the Bitcoin peers, the same user can later &lt;i&gt;redeem&lt;/i&gt;&amp;nbsp;her zerocoin back into bitcoins. She simply embeds a (preferably new) destination Bitcoin address into a 'Zerocoin Spend' transaction, then sends it into the network. If the transaction checks out, the Bitcoin peers will treat it just like a normal Bitcoin transfer -- meaning that she'll receive the full bitcoin value of the coin (minus transaction fees) at the destination address.&lt;br /&gt;
&lt;br /&gt;
Now you're probably wondering what any of this has to do with privacy. To explain that, I need to give you one more piece of information:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;Aside from educated guesswork, there's no way to link a Zerocoin Mint transaction to the Zerocoin Spend transaction that redeems it.&lt;/i&gt;&lt;/blockquote&gt;
Redeeming a zerocoin gives you a completely different set of bitcoins than the ones you used to purchase it. In fact, you can think of Zerocoin like the world's biggest laundry -- one that can handle millions of users, has no trusted party, and&amp;nbsp;&lt;i&gt;can't&lt;/i&gt;&amp;nbsp;be compromised. Once as user converts her bitcoins into zerocoins, it's very hard to determine where she took them back out. Their funds are mixed up with all of the other users who also created zerocoins. And that's a pretty powerful guarantee.&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-i8UyvcYkxWw/UWRQgqSbe9I/AAAAAAAAAW0/eSKBlFJT9FY/s1600/zerocoinchain.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="101" src="http://4.bp.blogspot.com/-i8UyvcYkxWw/UWRQgqSbe9I/AAAAAAAAAW0/eSKBlFJT9FY/s400/zerocoinchain.png" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Illustration of a Bitcoin/Zerocoin block chain. A user transforms bitcoins into a zerocoin,&lt;br /&gt;
then (at some unspecified later point) 'Spends' it to redeem the bitcoins. The linkage between Mint&lt;br /&gt;
and Spend (dotted line) cannot be determined from the block chain data.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
The key to the whole process is to make it all work at the &lt;i&gt;protocol level --&lt;/i&gt;&amp;nbsp;meaning, without adding new trusted parties. And doing that is the goal of Zerocoin.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;How does it work?&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
Zerocoin uses a combination of &lt;a href="http://en.wikipedia.org/wiki/Commitment_scheme"&gt;digital commitments&lt;/a&gt;, &lt;a href="http://www.cs.stevens.edu/~mdemare/pubs/owa.pdf"&gt;one-way accumulators&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Zero-knowledge_proof"&gt;zero-knowledge proofs&lt;/a&gt;, and some extensions to the existing Bitcoin protocol. It also shares some similarities to a previous work by&amp;nbsp;&lt;a href="http://dl.acm.org/citation.cfm?id=703975"&gt;Sander and Ta-Shma&lt;/a&gt;.&amp;nbsp;For the details, &lt;a href="http://spar.isi.jhu.edu/~mgreen/ZerocoinOakland.pdf"&gt;you can see our paper&lt;/a&gt;. Here I'm going to try to give a very high-level intuition that avoids the muck.&lt;br /&gt;
&lt;br /&gt;
The key idea in Zerocoin is that each coin &lt;a href="http://en.wikipedia.org/wiki/Commitment_scheme"&gt;commits to&lt;/a&gt; (read: encrypts) a random &lt;i&gt;serial number.&lt;/i&gt;&amp;nbsp;These coins are easy to create -- all you need to do is pick the serial number and run a fast commitment algorithm to wrap this up in a coin. The commitment works like encryption, in that the resulting coin completely hides the serial number . At the same time this coin 'binds' you to the number you've chosen. The serial number is secret, and it stays with you.&lt;br /&gt;
&lt;br /&gt;
To 'Mint' the new coin you post it to the network along with a standard Bitcoin transaction containing enough (normal) bitcoins to 'pay for' it. The Mint transaction adds some new messages to the Bitcoin protocol, but fundamentally there's no magic here. The Bitcoin network will accept the transaction into the block chain as long as the input bitcoins check out.**&lt;br /&gt;
&lt;br /&gt;
The Zerocoin 'Spend' transaction is a little bit more complicated. To redeem your zerocoin, you first create a new transaction that contains the coin's serial number (remember that you kept it secret after you made the coin). You also attach a &lt;a href="http://en.wikipedia.org/wiki/Zero-knowledge_proof"&gt;zero-knowledge proof&lt;/a&gt; of the following two statements:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;You previously posted a valid zerocoin on the block chain.&lt;/li&gt;
&lt;li&gt;This particular zerocoin contained the serial number you put in your transaction.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
The key to making this all work is that zero-knowledge proof. What you need to know about these is that anyone can verify such a proof, and she'll be absolutely convinced that you're telling the truth about these statements. At the same time, the proof reveals absolutely no other information (hence the 'zero' knowledge).&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This means anyone who sees your Spend transaction will be convinced that you &lt;i&gt;really did&lt;/i&gt;&amp;nbsp;previously Mint a zerocoin, &lt;i&gt;and&lt;/i&gt; that it contained the serial number you just revealed. They can then check the block chain to make sure that particular serial number has never been Spent before. At the same time, the zero knowledge property ensures that they they have &lt;i&gt;absolutely no idea&lt;/i&gt; &lt;i&gt;which&lt;/i&gt;&amp;nbsp;zerocoin you're actually spending. The number of such coins could easily run into the millions.&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
All of this leads us to one final question: where do your bitcoins go after you Mint a zerocoin, and how do you get them back when you Spend?&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The simple answer is that &lt;i&gt;they don't go anywhere at all.&lt;/i&gt;&amp;nbsp;The bitcoins used in a 'Mint' transaction just sit there on the block chain. The Zerocoin protocol semantics require that nobody can access those coins again except by publishing a valid Zerocoin 'Spend'. When you publish a Spend, the protocol allows you to 'claim'&amp;nbsp;&lt;i&gt;any&lt;/i&gt;&amp;nbsp;of the previously-committed bitcoins -- regardless of who posted them. In other words, you Mint with one set of bitcoins, and you leave with someone else's.&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;When will Zerocoin be available?&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
For those looking to use Zerocoin tomorrow, I would advise patience. We've written a proof-of-concept implementation that extends the C++ &lt;span style="font-family: Courier New, Courier, monospace;"&gt;bitcoind&lt;/span&gt; client to support Zerocoin, and we'll be releasing a cleaned up version of our code when we present the paper in May.&lt;br /&gt;
&lt;br /&gt;
But before you get excited, I need to point out some pretty serious caveats.&lt;br /&gt;
&lt;br /&gt;
First of all, Zerocoin is not cheap. Our current zero-knowledge proof averages around 40KB, and take nearly two seconds to verify. By the standards of advanced crypto primitives this is &lt;i&gt;fantastic&lt;/i&gt;. At the same time, it poses some pretty serious engineering challenges -- not least of which is: where do you store all these proofs?&lt;br /&gt;
&lt;br /&gt;
This probably isn't the end of the world. For one thing, it seems likely that we'll be able to reduce the size and cost of verifying the proof, and we think that even the current proof could be made to work with some careful engineering. Still, Zerocoin as currently construed is &lt;i&gt;probably&lt;/i&gt;&amp;nbsp;not going to go online anytime soon. But some version of Zerocoin might be ready in the near future.&lt;br /&gt;
&lt;br /&gt;
Another problem with Zerocoin is the difficulty of incrementally deploying it. Supporting the new Mint and Spend functionality requires changes to every Bitcoin client. That's a big deal, and it's unlikely that the Bitcoin folks are going to accept a unilateral protocol change without some serious pushback. But even this isn't a dealbreaker: it should be possible to start Zerocoin off using some training wheels -- using a trusted central party to assist with the process, until enough Bitcoin clients trust it and are willing to support it natively.&lt;br /&gt;
&lt;br /&gt;
In fact, one of the biggest barriers to adoption is human beings themselves. As complicated as Bitcoin is, you can explain the crypto even to non-experts. This makes people happy. Unfortunately Zerocoin is a different animal. It will take time to convince people that these new techniques are safe. We hope to be there when it happens.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;In conclusion&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I realize that this blog post has run slightly longer than usual. Thanks for sticking with me!&lt;br /&gt;
&lt;br /&gt;
As regular readers of this blog know, I have a passion for anything that gets interesting crypto out into the world. Bitcoin is a great example of this. It would be wonderful if this gave us an opportunity to do even &lt;i&gt;more&lt;/i&gt;&amp;nbsp;interesting things.&amp;nbsp;Perfectly untraceable e-Cash would definitely fit that bill.&lt;br /&gt;
&lt;br /&gt;
But even if we don't get there, the fact that reputable computer science conferences are accepting papers about 'that crazy Bitcoin thing' tells you a lot about how much it's grown up. In the long run, this is good news for everyone.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Notes:&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
* There are a lot of simplifications in here. Identities are the hash of your public key. The block chain is really computed using a &lt;a href="http://en.wikipedia.org/wiki/Hash_tree"&gt;Merkle tree&lt;/a&gt; for efficiency reasons. The peer-to-peer network isn't quite a broadcast network. Did I mention you should &lt;a href="http://bitcoin.org/bitcoin.pdf"&gt;read the paper&lt;/a&gt;?&lt;br /&gt;
&lt;br /&gt;
** Note that for those who 'know' their Bitcoin, you can think of the Zerocoin as a piece of extra data that gets added to a Bitcoin transaction. The inputs are still standard bitcoins. There's just no output. Instead, the transaction contains the coin data.&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/bd3FLLi5szI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/2416761623474678762/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2013/04/zerocoin-making-bitcoin-anonymous.html#comment-form" title="64 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/2416761623474678762?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/2416761623474678762?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/bd3FLLi5szI/zerocoin-making-bitcoin-anonymous.html" title="Zerocoin: making Bitcoin anonymous" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-R5563vo82Ws/UWXP3txJtuI/AAAAAAAAAXQ/htCVKFrYV5k/s72-c/bitcoinpress.png" height="72" width="72" /><thr:total>64</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2013/04/zerocoin-making-bitcoin-anonymous.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0QFQ30zeCp7ImA9WhBWFko.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-207488015487482702</id><published>2013-04-10T21:09:00.000-07:00</published><updated>2013-04-11T04:21:52.380-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-11T04:21:52.380-07:00</app:edited><title>The Ideal Cipher Model (wonky)</title><content type="html">&lt;a href="http://farm9.staticflickr.com/8060/8238115948_1d62a253cb_n.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="132" src="http://farm9.staticflickr.com/8060/8238115948_1d62a253cb_n.jpg" width="200" /&gt;&lt;/a&gt;A friend who's learning cryptography writes with a few questions about block ciphers:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;(1) Let's say we're using AES-128 -- 128 bit keys, 128 bit blocks.&lt;/i&gt;&lt;br /&gt;
&lt;ul class="ul1"&gt;
&lt;li class="li1"&gt;&lt;i&gt;For a given 128 bit block of plaintext "P" - if I was to iterate through all 2**128 key permutations and encrypt the same plaintext P with each key, would the outputs all be unique, or would there be collisions?&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class="ul1"&gt;
&lt;li class="li1"&gt;&lt;i&gt;For a given 128 bit key "K", if I was to use K to encrypt every possible (2**128) plaintext, would the outputs all be unique, or would there be collisions?&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class="ul1"&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;div class="p2"&gt;
These are all reasonable questions with simple answers. But I'm not going to give them. Why bother with two simple answers when we can give&amp;nbsp;&lt;i&gt;one&lt;/i&gt;&amp;nbsp;really complicated intuition?&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;b&gt;What's Claude Shannon got to do with it?&lt;/b&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
Back in the late 1940s when people were still thinking on this whole information theory business, a gentleman named &lt;a href="http://en.wikipedia.org/wiki/Claude_Shannon"&gt;Claude Shannon&lt;/a&gt; came up with &lt;a href="http://netlab.cs.ucla.edu/wiki/files/shannon1949.pdf"&gt;a model for what a block cipher should do&lt;/a&gt;. His idea was -- and yes, I'm embellishing a lot here -- that an 'ideal' block cipher would work kind of like a magical elf.*&lt;br /&gt;
&lt;br /&gt;
You could ask the elf to encipher and decipher things for you. But instead of using a mathematical algorithm, it would just keep a blackboard with a big table. The table would have three columns (Key, Plaintext, Ciphertext), and it would start off empty.&amp;nbsp;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
When you asked the elf to encipher a plaintext &lt;b&gt;P&lt;/b&gt; under a key &lt;b&gt;K&lt;/b&gt;, it would do the following:&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;Check to see if (&lt;b&gt;K, P&lt;/b&gt;) were already recorded in some row of the table. If they were, it would read off the corresponding ciphertext value &lt;b&gt;C&lt;/b&gt; from the same row, and return &lt;b&gt;C&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;If no matching row was found, it would generate a perfectly random ciphertext &lt;b&gt;C&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;It would then check for an existing table entry containing the same key and ciphertext (&lt;b&gt;K, C&lt;/b&gt;). If this entry was found in the table, it would throw &lt;b&gt;C&lt;/b&gt; away and repeat step (2).&lt;/li&gt;
&lt;li&gt;Otherwise it would add (&lt;b&gt;K, P, C&lt;/b&gt;) to the table and return C to the caller.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Now I realize this looks complicated, but if you think about this for a little while you'll realize that this little thought experiment does 'work' a lot like a real block cipher.&lt;br /&gt;
&lt;br /&gt;
Just like a block cipher, it will always give the same output when you pass it a given key and plaintext. Furthermore -- for a given key &lt;b&gt;K&lt;/b&gt;, no two plaintexts will ever encipher to the same ciphertext. This models the fact that a block cipher is a &lt;a href="http://en.wikipedia.org/wiki/Block_cipher#Definition"&gt;permutation&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Lastly, the output of the encipherment is very 'random' -- in the sense that it's intuitively not linked to the input. Calling the cipher on different inputs should produce values that are very much unrelated.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Of course, you also need the elf to decipher stuff as well. Decipherment works mostly like the process above. When you ask to decipher (&lt;b&gt;K, C&lt;/b&gt;), it checks to see whether the given key and ciphertext are already in the table (&lt;i&gt;i.e.,&lt;/i&gt; they were previously enciphered). If so it looks up and returns the corresponding plaintext. Otherwise it generates a new &lt;i&gt;random&lt;/i&gt; plaintext, makes sure it hasn't previously appeared in the table with that key, and returns the result.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Under the assumption that AES works like our elf, we can now answer my friend's questions. Clearly if I encrypt the same plaintext with many different keys, I will get many different ciphertexts. They'll each be random and 128 bits long, which means the probability of any two ciphertexts being the same (colliding) is quite small. But there's no rule preventing it, and over a large enough set it's actually quite likely.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Similarly, the second question is answered by the fact that the cipher is a permutation, something that's captured in our elf's rule (3).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;This is an awful lot of work to answer a few simple questions...&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Yes, it certainly is. But the 'Elf' model is useful for answering much more interesting questions -- like: is a given encryption scheme secure?&lt;br /&gt;
&lt;br /&gt;
For example, take the &lt;a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29"&gt;CBC mode of operation&lt;/a&gt;, which is a way to turn a block cipher into an encryption scheme:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://upload.wikimedia.org/wikipedia/commons/d/d3/Cbc_encryption.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="130" src="http://upload.wikimedia.org/wikipedia/commons/d/d3/Cbc_encryption.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
CBC encryption takes in a random key (&lt;b&gt;K&lt;/b&gt;) and a random 'Initialization Vector' (&lt;b&gt;IV&lt;/b&gt;), both of which are chosen by the encryptor. Now let's see what happens if we CBC-encrypt an &lt;i&gt;N-&lt;/i&gt;block message&amp;nbsp;using our elf.&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;The encryptor XORs the first plaintext block with the (random) Initialization Vector (&lt;b&gt;IV&lt;/b&gt;), which should give a randomly-distributed value. We'll call this &lt;b&gt;P'&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;He then sends (&lt;b&gt;K, P'&lt;/b&gt;) to be enciphered by the elf. Since the elf has never seen (&lt;b&gt;K, P'&lt;/b&gt;) -- meaning it's not in the table -- it will generate a random value (&lt;b&gt;C1&lt;/b&gt;), which will become the first ciphertext block.&lt;/li&gt;
&lt;li&gt;The encryptor now XORs the next plaintext block with&amp;nbsp;&lt;b&gt;C1,&lt;/b&gt; which again should yield a randomly-distributed value which we'll call &lt;b&gt;P''&lt;/b&gt;.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;He sends (&lt;b&gt;K, P''&lt;/b&gt;) to be enciphered by the elf. Since &lt;b&gt;P''&lt;/b&gt; is also random (and, say, 128 bits long), the probability that it's already in the table is astronomically low. Thus with high probability the elf will&amp;nbsp;&lt;i&gt;again&lt;/i&gt;&amp;nbsp;generate a random value (&lt;b&gt;C2&lt;/b&gt;), which becomes the second ciphertext block.&lt;/li&gt;
&lt;li&gt;He then repeats steps (3) and (4) for all the remaining blocks.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Note that with overwhelming probability -- and unless you encrypt really long ciphertexts** -- the elf will generate a random value for each ciphertext block. Hence the entire ciphertext will consist of a random string, which means it &lt;i&gt;really &lt;/i&gt;shouldn't leak anything about the message (except for the length).&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Of course, an attacker might also talk to the elf to try to learn something about the message. But note that even this attack isn't useful unless he can guess the (random) key &lt;b&gt;K&lt;/b&gt;, since the elf will give him random results &lt;i&gt;unless &lt;/i&gt;he asks for a value that includes &lt;b&gt;K&lt;/b&gt;&lt;i style="font-weight: bold;"&gt;. &lt;/i&gt;Since &lt;b&gt;K &lt;/b&gt;is a randomly-chosen secret key, the attacker should not be able to guess it.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Do ideal ciphers exist?&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
Now all of this is well and good, but it leaves us with an important question: is AES actually as good as an ideal cipher? Unfortunately, the resounding answer to this question is &lt;i&gt;no&lt;/i&gt;.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The problem here is that ideal ciphers are totally unworkable. Obviously we can't have an actual elf randomly filling in a bulletin board as we encrypt things. I want to carry a copy of the block cipher around with me (in software or hardware). I also want my copy of the cipher to be consistent with your copy, so that I can send you messages and you can decrypt them.&lt;br /&gt;
&lt;br /&gt;
To make the elf idea work, we would each need to carry around a copy of the elf's table that's&amp;nbsp;completely filled in from the start -- meaning it would already contain entries for every possible plaintext (resp. ciphertext) and key I might ever need to encipher/decipher. When you consider that there would be 2^128 rows&amp;nbsp;just for a single key, you realize that, &lt;i&gt;no, this is not a question of running out to Best Buy and picking up some more SD cards&lt;/i&gt;. It's fundamentally hard.&lt;br /&gt;
&lt;br /&gt;
So carrying ideal ciphers around is not possible. The question then is: is there something that's &lt;i&gt;as good as&lt;/i&gt;&amp;nbsp;an ideal cipher, without requiring us to carry around an exponentially-sized table.&lt;br /&gt;
&lt;br /&gt;
The answer to that question is a mixed bag. The bad news is that nothing really works as well as an ideal cipher. Worse yet, there exists schemes that would be provably secure with an ideal cipher, but would &lt;a href="http://eprint.iacr.org/2005/210"&gt;fail catastrophically&lt;/a&gt;&amp;nbsp;if you implemented them with any real block cipher&lt;i&gt;. &lt;/i&gt;So that sucks.&lt;br /&gt;
&lt;br /&gt;
On the other hand, those are theoretical results. Unless you're doing some very specific things, the ideal cipher model is a moderately helpful tool for understanding what block ciphers are capable of. It's also a good jumping off point for understanding the real proofs we actually use for modes like CBC. These proofs use more 'realistic' assumptions, &lt;i&gt;e.g.,&lt;/i&gt;&amp;nbsp;that&amp;nbsp;the block cipher is a&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Pseudorandom_permutation"&gt;pseudorandom permutation.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
But those proofs will have to wait for another time. I've reached my wonkery limit for today.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Notes:&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
* For the record, at no point did Claude Shannon ever refer to an 'elf'. At least not in writing.&lt;br /&gt;
&lt;br /&gt;
** The probability of a 'collision' (i.e., asking the elf to encipher a value that's already been enciphered) goes up as you put encipher more blocks. At a certain point (for AES, close to 2^64 blocks) it becomes quite high. Not coincidentally, this roughly coincides with the number of blocks NIST says you should encrypt with CBC mode.&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/jqj-Xh9r1nI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/207488015487482702/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2013/04/wonkery-mailbag-ideal-ciphers.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/207488015487482702?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/207488015487482702?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/jqj-Xh9r1nI/wonkery-mailbag-ideal-ciphers.html" title="The Ideal Cipher Model (wonky)" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2013/04/wonkery-mailbag-ideal-ciphers.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D08DRn45fSp7ImA9WhBQEUk.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-3172430439188634606</id><published>2013-03-12T13:44:00.000-07:00</published><updated>2013-03-12T20:37:57.025-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-12T20:37:57.025-07:00</app:edited><title>Attack of the week: RC4 is kind of broken in TLS</title><content type="html">&lt;div style="text-align: right;"&gt;
&lt;a href="http://1.bp.blogspot.com/-PEqnFjj_3Kc/UT9xs-ieW2I/AAAAAAAAAWI/CDLCv1K3Sao/s1600/RC4.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/-PEqnFjj_3Kc/UT9xs-ieW2I/AAAAAAAAAWI/CDLCv1K3Sao/s200/RC4.png" width="190" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;i&gt;&lt;b&gt;Update: &lt;/b&gt;I've added&amp;nbsp;a link to a &lt;a href="http://www.isg.rhul.ac.uk/tls"&gt;page at Royal Holloway&lt;/a&gt; describing the new attack.&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Listen, if you're using RC4 as your primary ciphersuite in &lt;a href="http://en.wikipedia.org/wiki/Transport_Layer_Security"&gt;SSL/TLS&lt;/a&gt;, now would be a great time to stop. Ok, thanks, are we all on the same page?&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
No?&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I guess we need to talk about this a bit more. You see, &lt;a href="http://cr.yp.to/talks/2013.03.12/slides.pdf"&gt;these slides&lt;/a&gt; have been making the rounds since this morning. Unfortunately, they contain a long presentation aimed at cryptographers, and nobody much seems to understand the &lt;i&gt;real&lt;/i&gt;&amp;nbsp;result that's buried around slide 306 (!). I'd like to help.&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here's the short summary:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
According to &lt;a href="http://www.isg.rhul.ac.uk/tls"&gt;AlFardan, Bernstein, Paterson, Poettering and Schuldt&lt;/a&gt;&amp;nbsp;(a team from&amp;nbsp;Royal Holloway, Eindhoven and UIC) the RC4 ciphersuite used in SSL/TLS is broken. If you choose to use it -- as do a ridiculous number of major sites, including Google -- then it may be possible for a dedicated attacker to recover your authentication cookies. The current attack is just on the edge of feasibility, and could probably be improved for specific applications.&lt;br /&gt;
&lt;br /&gt;
This is bad and needs to change soon.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
In the rest of this post I'll cover the details in the usual 'fun' question-and-answer format I save for these kinds of attacks.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;b&gt;What is RC4 and why should I care?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://en.wikipedia.org/wiki/RC4"&gt;RC4&lt;/a&gt;&amp;nbsp;is a fast &lt;a href="http://en.wikipedia.org/wiki/Stream_cipher"&gt;stream cipher&lt;/a&gt; invented in 1987 by Ron Rivest. If you like details, you can see&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/2011/12/whats-deal-with-rc4.html"&gt;this old post of mine&lt;/a&gt; for a longwinded discussion of RC4's history and flaws. Or you can take my word: RC4 is old and crummy.&lt;br /&gt;
&lt;br /&gt;
Despite its age and crumminess, RC4 has become an extremely popular ciphersuite for SSL/TLS connections -- to the point where it accounts for something absurd like&amp;nbsp;&lt;i&gt;half&lt;/i&gt;&amp;nbsp;of all TLS traffic. There are essentially two reasons for this:&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;RC4 does not require padding or IVs, which means it's immune to recent TLS attacks like &lt;a href="http://www.net-security.org/article.php?id=1638"&gt;BEAST&lt;/a&gt; and &lt;a href="http://blog.cryptographyengineering.com/2013/02/attack-of-week-tls-timing-oracles.html"&gt;Lucky13&lt;/a&gt;. Many admins have recommended it as the solution to these threats.&lt;/li&gt;
&lt;li&gt;RC4 is pretty fast. Faster encryption means less computation and therefore lower hardware requirements for big service providers like Google.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;So what's wrong with RC4?&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Like all stream ciphers, RC4 takes a short (&lt;i&gt;e.g.,&lt;/i&gt;&amp;nbsp;128-bit) key and stretches it into a long string of &lt;a href="http://en.wikipedia.org/wiki/Pseudorandomness"&gt;pseudo-random&lt;/a&gt; bytes. These bytes are XORed with the message you want to encrypt, resulting in what &lt;i&gt;should&lt;/i&gt;&amp;nbsp;be a pretty opaque (and random-looking) ciphertext.&lt;br /&gt;
&lt;br /&gt;
The problem with RC4 is that the above statement is not quite true. The bytes come out of the RC4 aren't quite random looking -- they have small&amp;nbsp;&lt;i&gt;biases&lt;/i&gt;. A few of these biases have been known for years, but weren't considered useful. However, &lt;a href="http://link.springer.com/chapter/10.1007%2F978-3-642-19574-7_5"&gt;recent academic work&lt;/a&gt;&amp;nbsp;has uncovered many small but significant additional biases running throughout the first 256 bytes of RC4 output. This new work has systematically identified &lt;i&gt;many&lt;/i&gt;&amp;nbsp;more.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
At first blush this doesn't seem like a big deal. Cryptographically, however, it's a disaster. If I encrypt the same message (plaintext) with many different RC4 keys, then I &lt;i&gt;should&lt;/i&gt;&amp;nbsp;get a bunch of totally random looking ciphertexts. But these tiny biases mean that they won't be random -- a statistical analysis of different positions of the ciphertext will show that some values occur more often.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
By getting many different encryptions of the same message -- under different keys -- I can tally up these small deviations from random and thus figure out what was encrypted.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If you like analogies, think of it like peeking at a picture with your hands over your eyes. By peeking through your fingers you might only see a tiny sliver of the scene you're looking at. But by repeating the observation many times, you may be able to combining those slivers and figure out what you're looking at.&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Why would someone encrypt the same message many times?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The problem here (as usual) is your browser.&lt;br /&gt;
&lt;br /&gt;
You see, there are certain common elements that your browser tends to send at the beginning of every &lt;a href="http://en.wikipedia.org/wiki/HTTP_Secure"&gt;HTTP(S)&lt;/a&gt;&amp;nbsp;connection. One of these values is a &lt;i&gt;&lt;a href="http://en.wikipedia.org/wiki/HTTP_cookie"&gt;cookie&lt;/a&gt;&lt;/i&gt;&amp;nbsp;-- typically a fixed string that identifies you to a website. These cookies are what let you log into Gmail without typing your password every time.&lt;br /&gt;
&lt;br /&gt;
If you use HTTPS (which is enforced in many sites by default), then your cookies &lt;i&gt;should&lt;/i&gt; be safe. After all, they'll always be sent over an encrypted connection to the website.&lt;br /&gt;
&lt;br /&gt;
Unfortunately, if your connection is encrypted using RC4 (as is the case with Gmail), then each time you make a fresh connection to the Gmail site, you're sending a new encrypted copy of the same cookie. If the session is renegotiated (&lt;i&gt;i.e.,&lt;/i&gt;&amp;nbsp;uses a different key) between those connections, then the attacker can build up the list of ciphertexts he needs.&lt;br /&gt;
&lt;br /&gt;
To make this happen quickly, an attacker can send you a piece of Javascript that your browser will run -- possibly on a non-HTTPS tab. This Javascript can then send many HTTPS requests to Google, ensuring that an eavesdropper will quickly build up thousands (or millions) of requests to analyze.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-q39pG7WD8tI/UT-Qi37n9DI/AAAAAAAAAWY/jhlTBlpYHoc/s1600/Plaintextrec1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="203" src="http://1.bp.blogspot.com/-q39pG7WD8tI/UT-Qi37n9DI/AAAAAAAAAWY/jhlTBlpYHoc/s320/Plaintextrec1.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Probability of recovering a plaintext byte (y axis) at a particular byte position in the RC4-encrypted stream (x axis), assuming 2^24 ciphertexts. Increasing the number of ciphertexts to 2^32 gives almost guaranteed plaintext recovery at all positions. (&lt;a href="http://cr.yp.to/talks/2013.03.12/slides.pdf"&gt;source&lt;/a&gt;)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
&lt;b&gt;Millions of ciphertexts? Pah. This is just crypto-wankery.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
It's true that the current attack requires an enormous number of TLS connections -- in the tens to hundreds of millions -- which means that it's not likely to bother you. Today. On the other hand, this is the naive version of the attack, without any special optimizations.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
For example, the results given by Bernstein assume no prior plaintext knowledge. But in practice we often know a lot about the structure of an interesting plaintext like a session cookie. For one thing, they're typically Base64 encoded -- reducing the number of possibilities for each byte -- and they may have some recognizable structure which can be teased out using advanced techiques.&lt;br /&gt;
&lt;br /&gt;
It's not clear what impact these specific optimizations will have, but it tends to reinforce the old maxim: attacks only get better, they never get worse. And they can get &lt;i&gt;a lot&lt;/i&gt;&amp;nbsp;better while you're arguing about them.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;So what do we do about it?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Treat this as a wakeup call. Sites (like Google) need to &lt;i&gt;stop using RC4&lt;/i&gt;&amp;nbsp;--&amp;nbsp;before&amp;nbsp;these attacks become practical. History tells us that &lt;a href="http://www.computerworld.com/s/article/9219731/Hackers_spied_on_300_000_Iranians_using_fake_Google_certificate"&gt;nation-state attackers&lt;/a&gt; are already motivated to penetrate Gmail connections. The longer we stick with RC4, the more chances we're giving them. &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
In the short term we have an ugly choice: stick with RC4 and hope for the best, or move back to CBC mode ciphersuites -- which many sites have avoided due to the BEAST and Lucky13 attacks.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
We could probably cover ourselves a bit by changing the operation of browsers, so as to detect and block Javascript that seems clearly designed to exercise these attacks. We could also put tighter limits on the duration and lifespan of session cookies. In theory we could also drop the first few hundred bytes of each RC4 connection -- something that's a bit of a hack, and difficult to do without breaking the TLS spec.&lt;br /&gt;
&lt;br /&gt;
In the longer term, we need to move towards authenticated encryption modes like the &lt;a href="https://tools.ietf.org/html/rfc5288"&gt;new AEAD TLS ciphersuites&lt;/a&gt;, which&amp;nbsp;should put an end to most of these problems. The problem is that we'll need browsers to support these modes too, and that could take ages.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;In summary&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I once made fun of Threatpost for &lt;a href="http://threatpost.com/en_us/blogs/ssl-vulnerabilities-found-critical-non-browser-software-packages-102512"&gt;sounding alarmist&lt;/a&gt; about SSL/TLS. After all, it's not like we really have an alternative. But the truth is that TLS (in its design, deployment and implementation) needs some active help. We're seeing too many attacks, and they're far too close to practical. Something needs to give.&lt;br /&gt;
&lt;br /&gt;
We live in a world where NIST is happy to give us a new &lt;a href="http://csrc.nist.gov/groups/ST/hash/sha-3/index.html"&gt;hash function every few years&lt;/a&gt;. Maybe it's time we put this level of effort and funding into the protocols that &lt;i&gt;use&lt;/i&gt;&amp;nbsp;these primitives? They certainly seem to need it.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/_TAqnwLHPmI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/3172430439188634606/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2013/03/attack-of-week-rc4-is-kind-of-broken-in.html#comment-form" title="38 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/3172430439188634606?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/3172430439188634606?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/_TAqnwLHPmI/attack-of-week-rc4-is-kind-of-broken-in.html" title="Attack of the week: RC4 is kind of broken in TLS" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-PEqnFjj_3Kc/UT9xs-ieW2I/AAAAAAAAAWI/CDLCv1K3Sao/s72-c/RC4.png" height="72" width="72" /><thr:total>38</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2013/03/attack-of-week-rc4-is-kind-of-broken-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQFRH84eyp7ImA9WhBRGEU.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-6987579130585364532</id><published>2013-03-09T10:50:00.000-08:00</published><updated>2013-03-09T19:31:55.133-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-09T19:31:55.133-08:00</app:edited><title>Here come the encryption apps!</title><content type="html">&lt;div class="" style="clear: both; text-align: left;"&gt;
&lt;a href="http://3.bp.blogspot.com/-ULqiWum8n1M/UTtjd49ug4I/AAAAAAAAAVw/tH96JfWSHXs/s1600/Cryptocathdln.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="232" src="http://3.bp.blogspot.com/-ULqiWum8n1M/UTtjd49ug4I/AAAAAAAAAVw/tH96JfWSHXs/s320/Cryptocathdln.png" width="320" /&gt;&lt;/a&gt;It seems like these days I can't eat breakfast without reading about some new encryption app that will (supposedly) revolutionize our communications -- while making tyrannical&amp;nbsp;regimes fall like cheap confetti.&lt;br /&gt;
&lt;br /&gt;
This is exciting stuff, and I want to believe. After all, I've spent a lot of my professional life working on crypto, and it's nice to imagine that people are actually going to start &lt;i&gt;using&lt;/i&gt;&amp;nbsp;it. At the same time, I worry that too much hype can be a bad thing -- and could even get people killed.&lt;br /&gt;
&lt;br /&gt;
Given what's at stake, it seems worthwhile to sit down and look carefully at some of these new tools. How solid are they? What makes them different/better than what came before? And most importantly: should you trust them with your life?&lt;/div&gt;
&lt;div class="" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="" style="clear: both; text-align: left;"&gt;
To take a crack at answering these questions, I'm going to look at four apps that seem to be getting a lot of press in this area. In no particular order, these are&amp;nbsp;&lt;a href="https://crypto.cat/"&gt;Cryptocat&lt;/a&gt;, &lt;a href="https://silentcircle.com/"&gt;Silent Circle&lt;/a&gt;, &lt;a href="http://www.whispersystems.org/"&gt;RedPhone&lt;/a&gt; and &lt;a href="https://www.mywickr.com/en/index.php"&gt;Wickr&lt;/a&gt;.&lt;/div&gt;
&lt;div class="" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="" style="clear: both; text-align: left;"&gt;
&lt;b&gt;A couple of notes...&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
Before we get to the details, a few stipulations. First, the apps we'll talk about here are hardly the only apps that use encryption. In fact, these days almost everyone advertises some form of '&lt;a href="http://en.wikipedia.org/wiki/End-to-end_encryption"&gt;end-to-end encryption&lt;/a&gt;' for your data. This has even gotten&amp;nbsp;&lt;a href="http://www.slate.com/blogs/future_tense/2013/01/24/skype_urged_to_come_clean_on_eavesdropping_capabilities_and_policies_in.html"&gt;Skype&lt;/a&gt; and &lt;a href="http://www.engadget.com/2012/08/08/indian-official-sees-end-to-blackberry-eavesdropping-standoff/"&gt;Blackberry&lt;/a&gt;&amp;nbsp;into a bit of hot water with foreign governments.&lt;br /&gt;
&lt;br /&gt;
However -- and this is a critical point -- 'end-to-end encryption' is rapidly becoming the most useless term in the security lexicon. That's because actually&amp;nbsp;&lt;i&gt;encrypting&lt;/i&gt; stuff&amp;nbsp;is not the interesting part. The real challenge turns out to be distributing users'&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Key_management"&gt;&lt;span class="s1"&gt;encryption keys&lt;/span&gt;&lt;/a&gt;&amp;nbsp;securely, i.e., without&amp;nbsp;relying on a trusted, central service.&lt;br /&gt;
&lt;br /&gt;
The problem here is simple: if I can compromise such a service, then I can convince you to use &lt;i&gt;my &lt;/i&gt;encryption key instead of your intended recipient's. In this scenario -- known as a&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Man-in-the-middle_attack"&gt;Man in the Middle&lt;/a&gt;&amp;nbsp;(MITM)&amp;nbsp;attack -- all the encryption in the world won't help you.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="p1"&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-zswJqLLlrw4/UTtmn2DRKPI/AAAAAAAAAV4/iB63wTkQ6ZI/s1600/MITM.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="67" src="http://4.bp.blogspot.com/-zswJqLLlrw4/UTtmn2DRKPI/AAAAAAAAAV4/iB63wTkQ6ZI/s200/MITM.png" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Man in the Middle attack (image: Wikipedia). Mallory convinces Alice and Bob to use her key, then transparently passes messages between the two.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
And this is where most 'end-to-end' commercial services (like Skype and &lt;a href="http://blog.cryptographyengineering.com/2012/08/dear-apple-please-set-imessage-free.html"&gt;iMessage&lt;/a&gt;) seem to fall down. Clients depend fundamentally on a central directly server to obtain their encryption keys. This works fine if the server really is trustworthy, but it's huge problem if the server is ever compromised -- or forced to engage in MITM attacks by a nosy government.&amp;nbsp;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
(An even worse variant of this attack comes from services that actually &lt;i&gt;store your secret keys for you. &lt;/i&gt;In this case you're&amp;nbsp;truly dependent on their good behavior.*)&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
One important feature of the 'new' encryption apps is that they recognize this concern. That is, they&amp;nbsp;&lt;i&gt;don't&lt;/i&gt; require you to trust the service. A few even point this out in their marketing material, and have included&amp;nbsp;&lt;i&gt;their own dishonesty&lt;/i&gt; into the threat model.&amp;nbsp;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;span class="s2"&gt;&lt;b&gt;&lt;u&gt;Cryptocat&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://twimg0-a.akamaihd.net/profile_images/2218141212/cryptocat.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="200" src="https://twimg0-a.akamaihd.net/profile_images/2218141212/cryptocat.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;a href="https://crypto.cat/"&gt;Cryptocat&lt;/a&gt; is an IM application developed by Nadim Kobeissi, who -- when he's not busy being&amp;nbsp;&lt;a href="http://log.nadim.cc/?p=110"&gt;harassed by government officials&lt;/a&gt; -- manages to put out out a very useable app. What truly distinguishes Cryptocat is its platform: it's designed to run as a plugin inside of a web browser (Safari, Chrome and Firefox).&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
Living in a browser is Cryptocat's greatest strength &lt;i&gt;and&lt;/i&gt; greatest weakness. It's a strength because &lt;i&gt;(1) &lt;/i&gt;just about everyone has a browser, &lt;i&gt;(2)&lt;/i&gt; the user interface is pretty and intuitive, and&amp;nbsp;&lt;i&gt;(3) &lt;/i&gt;the installation process is trivial. Cryptocat's impressive user base testifies to the demand for such an application.&lt;br /&gt;
&lt;br /&gt;
The weakness is that&amp;nbsp;&lt;i&gt;it runs in a frigging web browser.&lt;/i&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
To put a finer point on it: web browsers are some of the most complex software packages you can run on a consumer device. They do eight million things, most of which require them to process arbitrary and untrusted data. Running security-critical code in a browser is like having surgery in a hospital that doubles as a sardine cannery and sewage-treatment plant -- maybe it's fine, but you should be aware of the risk you're taking.&amp;nbsp;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
If that's not good enough for you: go check out this year's &lt;a href="http://www.esecurityplanet.com/browser-security/chrome-firefox-and-ie-fall-at-pwn2own-2013.html"&gt;pwn2own results&lt;/a&gt;.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
For non-group messaging, Cryptocat uses a protocol known as &lt;a href="http://www.cypherpunks.ca/otr/"&gt;off-the-record (OTR)&lt;/a&gt;&amp;nbsp;and ships the encrypted data over Jabber/XMPP -- using either Cryptocat's own server, or the XMPP server of your choice. OTR is a well-studied protocol that does a form of &lt;i&gt;dynamic&lt;/i&gt; key agreement, which means that two parties who have never previously spoken can quickly agree on a cryptographic key. To ensure that your key is valid (&lt;i&gt;i.e.,&lt;/i&gt; you're not being tricked by a MITM attacker), Cryptocat presents users with a &lt;i&gt;key fingerprint&lt;/i&gt; they can manually verify through a separate (voice) connection.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
So how does Cryptocat stack up?&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Code quality:&lt;/i&gt;&lt;/b&gt;&amp;nbsp;Nadim has taken an enormous amount of crap from people over the past year or two, and the result has been a consistent and notable improvement in &lt;a href="https://github.com/cryptocat/cryptocat"&gt;Cryptocat's code quality&lt;/a&gt;. While Cryptocat is written in Javascript (aaggh!), the application is distributed as a plugin and &lt;i&gt;not &lt;/i&gt;dumped out to you like typical script. This negates some of the &lt;a href="http://rdist.root.org/2010/11/29/final-post-on-javascript-crypto/"&gt;most serious complaints&lt;/a&gt; people level at Javascript crypto, but &lt;a href="http://lists.w3.org/Archives/Public/public-identity/2011Dec/0064.html"&gt;not all of them&lt;/a&gt;! Cryptocat has also been subject to a couple of commercial code audits.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Crypto:&lt;/i&gt; &lt;/b&gt;&lt;strike&gt;All of the protocols are well-studied and designed by experts.&lt;/strike&gt;&amp;nbsp;&lt;b&gt;Update: &lt;/b&gt;Jake Appelbaum reminds me that while this is true for one-on-one communications, it's &lt;i&gt;not &lt;/i&gt;true for&amp;nbsp;the multi-party (group chat) OTR protocol -- which is basically hand-rolled. Don't use that.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Ease of use:&lt;/i&gt; &lt;/b&gt;My five year old can use Cryptocat.&lt;/div&gt;
&lt;div class="p2"&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Other notes:&lt;/i&gt; &lt;/b&gt;If the silent auto-update functionality is activated (in Chrome) it is technically possible for someone to compromise Cryptocat's update keys and quietly push out a malicious version of the app. This concern probably applies to most applications, but it &lt;i&gt;is&lt;/i&gt; something you should be aware of.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Should I use it to fight an oppressive regime?&lt;/i&gt; &lt;/b&gt;&lt;a href="http://www.wired.com/threatlevel/2012/07/crypto-cat-encryption-for-all/"&gt;Oh god no&lt;/a&gt;.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;span class="s2"&gt;&lt;b&gt;&lt;u&gt;Silent Circle&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-3PfHe5sgeag/UTrcC49VCYI/AAAAAAAAAVA/8dj70NY57JY/s1600/SilentPhone'.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="190" src="http://1.bp.blogspot.com/-3PfHe5sgeag/UTrcC49VCYI/AAAAAAAAAVA/8dj70NY57JY/s200/SilentPhone'.png" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Using SilentCircle on a&lt;br /&gt;
Huawei complete negates&lt;br /&gt;
the point of using SilentCircle.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class="p1"&gt;
Silent Circle is the brainchild of PGP inventor Phil Zimmerman and a &lt;a href="https://silentcircle.com/web/founders-leadership/"&gt;cadre of smart/paranoid folks&lt;/a&gt;. It actually consists of multiple apps, supporting VoIP/IM/PGP-based Email and videoconferencing -- with an optional Snapchat-like self-destructing messages feature. The apps can essentially replace the standard Phone and Messages apps in your iPhone or Android device.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
Silent Circle is a paid subscription service, which means it's marketed to folks who (in theory, anyway) really care about their security, but also don't want to scrounge around with messy &lt;a href="http://www.gnupg.org/"&gt;open-source software&lt;/a&gt; -- for example, journalists working in dangerous locations or business executives running overseas operations. In exchange for $240/year you get the ability to securely call other SilentCircle subscribers &lt;i&gt;and&lt;/i&gt;&amp;nbsp;to dial ordinary telephone (&lt;a href="http://en.wikipedia.org/wiki/Plain_old_telephone_service"&gt;POTS&lt;/a&gt;) numbers.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
The termination to POTS is SilentCircle's best feature, and&amp;nbsp;also its biggest concern. When you directly call another SilentCircle user, your connection is encrypted from your phone to theirs. When you dial a normal phone line, your connection will only be encrypted until it reaches SilentCircle's servers. From there it will travel on normal, tappable phone lines.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://silentcircle.com/static/img/Layout_SecureCalling.c9e5f917671c.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="153" src="https://silentcircle.com/static/img/Layout_SecureCalling.c9e5f917671c.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
Now&amp;nbsp;&lt;i&gt;most&lt;/i&gt;&amp;nbsp;users will&amp;nbsp;probably understand this, and SilentCircle certainly does its best to make sure people do. Still, most users aren't experts, and it's easy to imagine a typical user getting confused -- and possibly assuming they're safer than they actually are.&amp;nbsp;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="https://silentcircle.com/static/faq/img/sp16.1bf65e9ed803.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="200" src="https://silentcircle.com/static/faq/img/sp16.1bf65e9ed803.jpg" width="133" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;The SilentCircle short authentication string.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class="p1"&gt;
SilentCircle uses &lt;a href="http://blog.cryptographyengineering.com/2012/11/lets-talk-about-zrtp.html"&gt;ZRTP&lt;/a&gt; (and a variant called &lt;a href="https://silentcircle.com/web/scimp-protocol/"&gt;SCIMP&lt;/a&gt;) to generate the keys used in communications. It doesn't require you to trust a central directory server, or to send your keys outside of the device. Your protection against MITM comes from two features: &lt;i&gt;(1) &lt;/i&gt;the app presents a 'short authentication string' that users can verbally compare before they communicate, and &lt;i&gt;(2) &lt;/i&gt;after you've successfully communicated the first time,&lt;i&gt; &lt;/i&gt;it caches a 'secret' that can be used to protect future sessions.&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Overall code quality:&lt;/i&gt;&lt;/b&gt; It took a while for SilentCircle to publish their code, but they've finally put &lt;i&gt;most&lt;/i&gt; of it online. It's much less fun to look at SilentCircle than it is to poke at Cryptocat -- mostly because Nadim's reactions are more entertaining -- but the code for SilentCircle looks ok. (I've seen a couple of &lt;a href="http://erratasec.blogspot.com/2013/02/silent-circle-and-inexperienced.html"&gt;minor comments&lt;/a&gt;, but nobody's found any security issues.) Moreover, the app has been &lt;a href="http://www.forbes.com/sites/jonmatonis/2013/02/06/pressure-increases-on-silent-circle-to-release-application-source-code/"&gt;independently audited&lt;/a&gt; and given a clean bill of health.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Crypto:&lt;/i&gt; &lt;/b&gt;SilentCircle uses&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/2012/11/lets-talk-about-zrtp.html"&gt;ZRTP&lt;/a&gt;, which I dislike because it's so &lt;i&gt;complex&lt;/i&gt; -- it's like a choose-your-own-adventure by sadists. But ZRTP is old and well-studied so it's unlikely that there are any serious issues lurking in it. The messaging app uses a simplified variant called SCIMP (Silent Circle Instant Messaging Protocol) which seems &lt;i&gt;much&lt;/i&gt; better, since it ditches most of the crazy options I dislike about ZRTP. I'm pretty confident that both of these protocols work just fine.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Ease of use:&lt;/i&gt; &lt;/b&gt;To quote SilentCircle's PR: so simple even an MBA can use it. (No, I'm kidding, they don't say that. They just&amp;nbsp;&lt;i&gt;think&lt;/i&gt; it.)&amp;nbsp;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Other thoughts:&lt;/i&gt; &lt;/b&gt;Rumor has it that the current market price for an iOS vulnerability is currently near $500,000. That doesn't mean iOS (or Silent Circle's app) is bulletproof. But it should give you a little bit of confidence. If you're being targeted with an iOS software vulnerability, then someone really wants you.&amp;nbsp;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Should I use this to fight my oppressive regime?&lt;/i&gt; &lt;/b&gt;SilentCircle's founders have made it clear that they'll chew off their own legs before they allow themselves to be a party to eavesdropping on their clients. But even so -- I would still have to think on this for a while.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;span class="s2"&gt;&lt;b&gt;&lt;u&gt;RedPhone/TextSecure&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/F4fB6vjIpEX00ODWZJi55Z_Fz3bzolywZ-F3noaM1Kmqhh6BV6jBp7NhP4QYkqTEeYw" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/F4fB6vjIpEX00ODWZJi55Z_Fz3bzolywZ-F3noaM1Kmqhh6BV6jBp7NhP4QYkqTEeYw" width="120" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;a href="https://play.google.com/store/apps/details?id=org.thoughtcrime.redphone&amp;amp;hl=en"&gt;RedPhone&lt;/a&gt; and &lt;a href="https://play.google.com/store/apps/details?id=org.thoughtcrime.securesms&amp;amp;hl=en"&gt;TextSecure&lt;/a&gt; are developed by Moxie Marlinspike's &lt;a href="http://www.whispersystems.org/"&gt;Open Whisper Systems&lt;/a&gt;. Note that OWS is actually Moxie's second company -- the original Whisper Systems was purchased by Twitter a couple of years back -- not for the software, mind you; just to get hold of Moxie for a while.&amp;nbsp;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
RedPhone does a much of what SilentCircle does, though without the paid subscription and termination to POTS. In fact, I'm not quite sure &lt;i&gt;if you can&lt;/i&gt;&amp;nbsp;terminate it to POTS (I'll update if I find out.)&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
Like Silent Circle, RedPhone uses ZRTP to establish keys, then encrypts voice data using AES. Consequently, most of what I said for SilentCircle also applies here, including the use of a short authentication string to prevent MITM attacks.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Overall code quality:&lt;/i&gt;&lt;/b&gt;&amp;nbsp;After reading Moxie's RedPhone code the first time, I literally discovered a line of drool running down my face. It's really nice.&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
In fact, it was &lt;i&gt;so&lt;/i&gt; nice that I decided to rough it up a little. I assigned it to the grad students in my &lt;a href="http://spar.isi.jhu.edu/~mgreen/650.445/650.445__Main.html"&gt;Practical Crypto&lt;/a&gt; course -- assuming that they'd find &lt;i&gt;something&lt;/i&gt;, anything to take the shine off of it. Unfortunately they basically failed on this score (though see 'Other thoughts' below). In short: it's very well written.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Crypto:&lt;/i&gt; &lt;/b&gt;Most of what I said about Silent Circle applies here, except that RedPhone uses only ZRTP, not SCIMP. However, RedPhone's implementation of ZRTP is somewhat simplified and avoids most of the options that make ZRTP a pain to deal with.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Other thoughts:&lt;/i&gt;&lt;/b&gt;&amp;nbsp;In fairness to my students, they did point out that Redphone&amp;nbsp;&lt;i&gt;does&lt;/i&gt; not retain a cache of secrets from connection to connection. Technically this is an optional feature of ZRTP, so it's not &lt;i&gt;wrong&lt;/i&gt; to omit it. However, it means that you have to verify the authentication string on every single call. Moxie is working on this, so it may change in the future. &amp;nbsp;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Should I use this to fight my oppressive regime?&lt;/i&gt;&amp;nbsp;&lt;/b&gt;Oh look, a pony!&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;span class="s2"&gt;&lt;b&gt;&lt;u&gt;Wickr&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://i.i.com.com/cnwk.1d/i/tim/2012/06/27/Screen_shot_2012-06-27_at_12.42.19_PM.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="200" src="http://i.i.com.com/cnwk.1d/i/tim/2012/06/27/Screen_shot_2012-06-27_at_12.42.19_PM.png" width="135" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
Wickr is an encrypted Snapchat-like app for the iPhone. Like the above applications it provides for instant messaging, but it also focuses heavily on the message destruction feature. Chats/messages can be set to self-destruct after a pre-specified period of time.&amp;nbsp;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
I've included Wickr on this list because I've seen it mentioned in a handful of &lt;a href="http://bits.blogs.nytimes.com/2012/06/27/an-app-that-encrypts-shreds-hashes-and-salts/"&gt;respectable media outlets&lt;/a&gt; over the past few months. This means that people are either using Wickr, &lt;i&gt;or&lt;/i&gt; that Wickr has very good PR folks. I also included it because it was at least partially designed by &lt;a href="http://dankaminsky.com/"&gt;Dan Kaminsky&lt;/a&gt;, who generally knows his stuff.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
Unfortunately I can't say too much about Wickr because -- to date -- there's virtually no technical information available on it. (Not even a white paper!) However, based on Tweets with Dan and &lt;a href="https://mailman.stanford.edu/pipermail/liberationtech/2012-June/004247.html"&gt;this short post&lt;/a&gt; on the LiberationTech mailing list, I &lt;i&gt;believe&lt;/i&gt; that Wickr uses a centralized directory server to share keys. In theory this could be ok if it provided a mechanism to compare key fingerprints between users, and/or detect invalid keys. But currently this does not seem to be the case.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
As for the destruction of secrets, well, this does seem like a nice idea, particularly if the destruction is enforced cryptographically. Unfortunately this is a fundamentally hard problem to solve correctly: if I can get a copy of your phone's memory while the message is there, I can keep the message forever.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Overall code quality:&lt;/i&gt;&lt;/b&gt; Who knows.&amp;nbsp;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Crypto:&lt;/i&gt; &lt;/b&gt;Current versions use some kind of RSA-based key agreement. According to Dan, the next generation will use &lt;a href="http://en.wikipedia.org/wiki/Elliptic_curve_cryptography"&gt;elliptic curve crypto&lt;/a&gt; with &lt;a href="http://en.wikipedia.org/wiki/Perfect_forward_secrecy"&gt;perfect forward secrecy&lt;/a&gt;. But the real horses head is the (apparent) reliance on a central directory server, which makes the service much more vulnerable to MITM.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Ease of use:&lt;/i&gt; &lt;/b&gt;Very easy. Just set your message expiration date, key in the destruct time, and send away.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;i&gt;Should I use this to fight my oppressive regime?&lt;/i&gt; &lt;/b&gt;Yes, as long your fight consists of sending naughty self-portraits to your comrades-at-arms. Otherwise, probably not.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;u&gt;&lt;b&gt;In summary&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;
If you've made it this far, I'm guessing you still have one burning question. Namely:&amp;nbsp;&lt;i&gt;What app &lt;u&gt;should&lt;/u&gt;&amp;nbsp;I use if I'm trying to overthrow my government&lt;/i&gt;?&lt;br /&gt;
&lt;br /&gt;
The simple answer is that I just don't know. It's not an easy question.&lt;br /&gt;
&lt;br /&gt;
Each of the above apps seem quite good, cryptographically speaking. But that's not the problem. The real issue is that they each run on a vulnerable, networked platform. If I &lt;i&gt;really&lt;/i&gt; had to trust my life to a piece of software, I would probably use something much less flashy --&amp;nbsp;&lt;a href="http://www.gnupg.org/"&gt;GnuPG&lt;/a&gt;, maybe,&amp;nbsp;running on an isolated computer locked in a basement.&lt;br /&gt;
&lt;br /&gt;
Then I would probably stay locked in the basement with it.&lt;br /&gt;
&lt;br /&gt;
But not everyone is a coward like me. The widespread availability of smartphones has already changed the way people &lt;a href="http://www.guardian.co.uk/world/2011/dec/29/arab-spring-captured-on-cameraphones"&gt;interact with their government&lt;/a&gt;. These encryption apps could well be the first wave in an entirely new revolution -- one that makes truly private communication a reality.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Notes:&lt;/i&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;i&gt;* &lt;/i&gt;Some services actually know and store your private keys, while others operate as a Certificate Authority, allowing you to 'certify' new public keys under your name. Either of these models makes eavesdropping relatively easy for someone with access to the server.&amp;nbsp;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/tEPV3Lqgf-c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/6987579130585364532/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2013/03/here-come-encryption-apps.html#comment-form" title="27 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/6987579130585364532?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/6987579130585364532?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/tEPV3Lqgf-c/here-come-encryption-apps.html" title="Here come the encryption apps!" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-ULqiWum8n1M/UTtjd49ug4I/AAAAAAAAAVw/tH96JfWSHXs/s72-c/Cryptocathdln.png" height="72" width="72" /><thr:total>27</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2013/03/here-come-encryption-apps.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8BQnc5fSp7ImA9WhBSFU0.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-2681689261750251869</id><published>2013-02-21T18:46:00.003-08:00</published><updated>2013-02-21T19:30:53.925-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-21T19:30:53.925-08:00</app:edited><title>Cryptography is a systems problem (video)</title><content type="html">Tonight's the &lt;a href="https://www.usenix.org/conference/usenixsecurity13"&gt;Usenix Security&lt;/a&gt; deadline. Who has time to blog...?&lt;br /&gt;
&lt;br /&gt;
But in case you're &lt;i&gt;dying &lt;/i&gt;for a dose&amp;nbsp;of crypto wonkery (and have an hour with nothing better to do) feel free to check out this talk on SSL/TLS I just gave at Dartmouth. &lt;a href="http://www.cs.dartmouth.edu/~sergey/cs108/matthew-d-green-lecture.pdf"&gt;Slides here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;iframe allowfullscreen="" frameborder="0" height="315" src="http://www.youtube.com/embed/uP6np_oKVCk" width="560"&gt;&lt;/iframe&gt;

&lt;br /&gt;
&lt;br /&gt;
Thanks to &lt;a href="https://twitter.com/sergeybratus"&gt;Sergey Bratus&lt;/a&gt;&amp;nbsp;for the invitation and to everyone who filled out the excellent audience.&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/ORhnY4ZoYOU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/2681689261750251869/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2013/02/cryptography-is-systems-problem-video.html#comment-form" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/2681689261750251869?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/2681689261750251869?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/ORhnY4ZoYOU/cryptography-is-systems-problem-video.html" title="Cryptography is a systems problem (video)" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://img.youtube.com/vi/uP6np_oKVCk/default.jpg" height="72" width="72" /><thr:total>7</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2013/02/cryptography-is-systems-problem-video.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0cDRnYycCp7ImA9WhBTGUk.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-7810022666776393295</id><published>2013-02-14T21:38:00.001-08:00</published><updated>2013-02-15T07:11:17.898-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-15T07:11:17.898-08:00</app:edited><title>Why I hate CBC-MAC</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.cbc.ca/edmonton/features/turkeydrive/includes/2012/cbc.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="200" src="http://www.cbc.ca/edmonton/features/turkeydrive/includes/2012/cbc.jpg" width="155" /&gt;&lt;/a&gt;&lt;/div&gt;
If you're like most people, you don't have a strong opinion about &lt;a href="http://en.wikipedia.org/wiki/CBC-MAC"&gt;CBC-MAC&lt;/a&gt;. In fact, if you're like most people, you don't have a strong opinion about &lt;i&gt;any&lt;/i&gt; crypto primitive.&lt;br /&gt;
&lt;br /&gt;
This is healthy. Keep up the good work.&lt;br /&gt;
&lt;br /&gt;
I'm not most people. I've spent the last week thinking about and dealing with CBC-MAC -- or more specifically, code that uses it in various contexts -- and I need to share with you how much I despise this little algorithm. And beg you never to use it.&lt;br /&gt;
&lt;br /&gt;
Oh yes, I know the temptation. You have this nice block cipher just sitting around -- maybe you're encrypting something -- and you've heard how serious this whole&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Message_authentication_code"&gt;message authentication&lt;/a&gt; thing is. Maybe you've even thought about using one of those fancy&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/2012/05/how-to-choose-authenticated-encryption.html"&gt;authenticated encryption&lt;/a&gt; modes, but found them to be too exotic and complicated.&lt;br /&gt;
&lt;br /&gt;
Then it comes to you that all your problems would be solved if you just used CBC-MAC. This is too bad, because now your troubles are just beginning.&lt;br /&gt;
&lt;br /&gt;
Now a quick note: there's nothing &lt;i&gt;really&lt;/i&gt;&amp;nbsp;wrong with CBC-MAC&lt;i&gt;, &lt;/i&gt;when implemented correctly. And it's not even that hard to implement properly. The problem is that many people who use CBC-MAC (rather than &lt;a href="http://en.wikipedia.org/wiki/Hash-based_message_authentication_code"&gt;HMAC&lt;/a&gt; or a &lt;a href="http://en.wikipedia.org/wiki/AEAD_block_cipher_modes_of_operation"&gt;proper AEAD mode&lt;/a&gt;) &lt;i&gt;seem incapable of actually doing this&lt;/i&gt;. They get it wrong in hilariously, embarassingly, stupid, complicated ways.&lt;br /&gt;
&lt;br /&gt;
But of course you wanted examples. Ok, let's give some.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. Your implementation doesn't handle variable-length messages.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A quick reminder. CBC-MAC is very similar to the classic &lt;a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29"&gt;CBC mode for encryption&lt;/a&gt;, with a few major differences. First, the Initialization Vector (IV) is a fixed value, usually zero. Second, CBC-MAC only outputs the&amp;nbsp;&lt;i&gt;last&lt;/i&gt;&amp;nbsp;block of the ciphertext -- this single value forms the MAC.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://upload.wikimedia.org/wikipedia/commons/thumb/b/bf/CBC-MAC_structure_(en).svg/570px-CBC-MAC_structure_(en).svg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="119" src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/bf/CBC-MAC_structure_(en).svg/570px-CBC-MAC_structure_(en).svg.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Many dumb implementations stop here. And that leads to big problems.&lt;br /&gt;
&lt;br /&gt;
Most notably, if your system allows for variable-length messages -- as it should -- there is a simple attack that allows you to forge new messages. First, get a MAC &lt;i&gt;T&lt;/i&gt;&amp;nbsp;on a message M1. Now XOR the tag&amp;nbsp;&lt;i&gt;T&lt;/i&gt; into the first block of some arbitrary second message M2, and get a MAC on the modified version of M2.&lt;br /&gt;
&lt;br /&gt;
The resulting tag T' turns out to be a valid MAC for the combined message (M1 || M2). This is a valid forgery, and in some cases can actually be useful.&lt;br /&gt;
&lt;br /&gt;
The standard fix to prepend the message length to the first block of the message before MACing it. But a surprisingly large number of (dumb) implementations skip this extra step. And &lt;i&gt;many&lt;/i&gt;&amp;nbsp;CBC-MAC implementations are dumb implementations.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2. Your implementation uses a random Initialization Vector.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If CBC-MAC with a fixed IV is great, surely CBC-MAC with a &lt;i&gt;random &lt;/i&gt;IV must be super-great. But no, it isn't.&lt;br /&gt;
&lt;br /&gt;
Using a random (or variable IV) is bad for the simple reason that &lt;i&gt;verifying&lt;/i&gt;&amp;nbsp;a CBC-MAC requires you to know the IV, and to know the IV you probably need to read it from somewhere. Typically this means the same untrusted place where you were storing your message.&lt;br /&gt;
&lt;br /&gt;
If the attacker can change the CBC-MAC IV, they can also change the first block of the MACed message in an equivalent manner. This works because the first step of CBC-MAC is to XOR the IV with the message. There are all kinds of silly variants of this problem, and all of them hurt.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3. You've used the same key for MAC and encryption.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A general rule in cryptography is that you shouldn't use the same key for two different cryptographic primitives -- encryption and signature, for example. Or encryption and MAC.&lt;br /&gt;
&lt;br /&gt;
Some people figure that rules were made to be broken.&lt;br /&gt;
&lt;br /&gt;
Note that shared keys can actually be ok, in some cases. Combined modes like &lt;a href="http://en.wikipedia.org/wiki/CCM_mode"&gt;CCM&lt;/a&gt; (short for CTR + CBC-MAC) actually do use the same key for both operations. However, these modes do it in a very careful, thoughtful manner. Your garden-variety implementation doesn't.&lt;br /&gt;
&lt;br /&gt;
One particularly ugly pattern I've seen is to use (dumb) CBC-MAC on a plaintext, then to encrypt said plaintext in &lt;a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29"&gt;CTR mode&lt;/a&gt;&amp;nbsp;using some initial counter (&lt;i&gt;C&lt;/i&gt;). This is insecure for a bunch of reasons, but specifically because I might be able to completely decrypt your ciphertext.&lt;br /&gt;
&lt;br /&gt;
To do this, I simply ask you to encrypt a series of small files corresponding to the counter values&amp;nbsp;&lt;i&gt;C, C+1, &lt;/i&gt;etc. of the ciphertext I want to attack. The CBC-MAC of each of these files lets me recreate the CTR-mode keystream I need to decrypt the original ciphertext. Now I have your message.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://upload.wikimedia.org/wikipedia/commons/3/3f/Ctr_encryption.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="129" src="http://upload.wikimedia.org/wikipedia/commons/3/3f/Ctr_encryption.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;4. You've used CBC-MAC as a hash function.&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
This one isn't really a problem with CBC-MAC, but it does crop up. In fact, it&amp;nbsp;&lt;a href="http://news.idg.no/cw/art.cfm?id=E3C61CE8-05EA-6926-D26309E8F8CBC03E"&gt;happened recently&lt;/a&gt;&amp;nbsp;to the file sharing site Mega.&lt;br /&gt;
&lt;br /&gt;
To make a long story short: cryptographic&amp;nbsp;hash functions are public functions (&lt;i&gt;i.e.,&lt;/i&gt;&amp;nbsp;no secret key)&amp;nbsp;that have the property of &lt;a href="http://en.wikipedia.org/wiki/Collision_resistance"&gt;collision-resistance&lt;/a&gt;&amp;nbsp;(it's hard to find two messages with the same hash). MACs are keyed functions that (typically) provide &lt;a href="http://en.wikipedia.org/wiki/Digital_signature_forgery"&gt;message unforgeability&lt;/a&gt; -- a very different property. Moreover, they guarantee this only when the key is secret.&lt;br /&gt;
&lt;br /&gt;
If you attempt to use CBC-MAC with a non-secret key, it becomes a very bad candidate for anything. In fact, you can trivially find useful collisions in the output, something that's very bad if you're using it to authenticate code. Which is what Mega was doing with it.&lt;br /&gt;
&lt;br /&gt;
This isn't true of all MACs -- &lt;a href="http://en.wikipedia.org/wiki/Hash-based_message_authentication_code"&gt;HMAC&lt;/a&gt;, for example, should retain the collision resistance of the underlying hash function even if the MAC key is compromised. This is yet another reason to prefer it for cases where cryptographic expertise is not a sure bet.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;In summary&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I'll repeat that none of these are really problems with CBC-MAC, which is a perfectly lovely algorithm if implemented and used correctly. The problems above only crop up when people try to whip it up themselves, &lt;i&gt;without&lt;/i&gt;&amp;nbsp;using a standard construction.&lt;br /&gt;
&lt;br /&gt;
If you must write your own code, my recommendation is to use HMAC -- which is extremely hard to screw up. If you're doing combined encryption/MAC and you only have a block cipher, then look into the&amp;nbsp;&lt;a href="http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/ccm/ccm.pdf"&gt;CCM spec&lt;/a&gt;, which is a&amp;nbsp;patent free &lt;a href="http://en.wikipedia.org/wiki/AEAD_block_cipher_modes_of_operation"&gt;AEAD mode&lt;/a&gt;.&amp;nbsp;This should address all of these problems and give you some nice test vectors too.&lt;br /&gt;
&lt;br /&gt;
What you &lt;i&gt;shouldn't&lt;/i&gt;&amp;nbsp;do is code up some half-assed CBC-MAC thing and expect you'll be ok. The fact is, you probably won't.&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/sI6B8btvJ28" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/7810022666776393295/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2013/02/why-i-hate-cbc-mac.html#comment-form" title="16 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/7810022666776393295?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/7810022666776393295?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/sI6B8btvJ28/why-i-hate-cbc-mac.html" title="Why I hate CBC-MAC" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><thr:total>16</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2013/02/why-i-hate-cbc-mac.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE8AQX87eCp7ImA9WhNaGUQ.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-4229475952626214922</id><published>2013-02-04T04:00:00.000-08:00</published><updated>2013-02-04T08:54:00.100-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-04T08:54:00.100-08:00</app:edited><title>Attack of the week: TLS timing oracles</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://s2.favim.com/orig/33/art-brad-pitt-fight-club-film-hot-Favim.com-267353.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="200" src="http://s2.favim.com/orig/33/art-brad-pitt-fight-club-film-hot-Favim.com-267353.jpg" width="162" /&gt;&lt;/a&gt;&lt;/div&gt;
Ever since I started writing this blog (and specifically, the posts on SSL/TLS) I've had a new experience: people come up to me and share clever attacks that they haven't made public yet.&lt;br /&gt;
&lt;br /&gt;
This is pretty neat -- like being invited to join an exclusive club. Unfortunately, being in this club mostly sucks&lt;i&gt;. &lt;/i&gt;That's because&amp;nbsp;the first rule of 'TLS vulnerability club' is:&amp;nbsp;&lt;i&gt;You don't talk about TLS vulnerability club. &lt;/i&gt;Which takes all the fun out of it.&lt;br /&gt;
&lt;br /&gt;
(Note that this is all for&amp;nbsp;boring reasons -- stuff like responsible disclosure, publication and fact checking. Nobody is planning a revolution.)&lt;br /&gt;
&lt;br /&gt;
Anyway, it's a huge relief that I'm finally free to&amp;nbsp;tell you about a neat new TLS attack I learned about recently. The new result&amp;nbsp;&lt;a href="http://www.isg.rhul.ac.uk/tls/"&gt;comes from&amp;nbsp;Nadhem AlFardan and Kenny Paterson of Royal Holloway&lt;/a&gt;. Dubbed 'Lucky 13',&amp;nbsp;it takes advantage of a very subtle bug in the way records are encrypted in the TLS protocol.&lt;br /&gt;
&lt;br /&gt;
If you aren't into long crypto posts, here's the TL;DR:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
There is a subtle timing bug in the way that TLS data decryption works when using the (standard) CBC mode ciphersuite. Given the right set of circumstances, an attacker can use this to completely decrypt sensitive information, such as passwords and cookies.&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class="tr_bq"&gt;
The attack is borderline practical if you're using the Datagram version of TLS (DTLS). It's more on the theoretical side if you're using standard TLS. However, with some clever engineering, that could change in the future. You should probably patch!&lt;/blockquote&gt;
For the details, read on. As always, we'll do this in the 'fun' question/answer format I save for these kinds of posts.&lt;br /&gt;
&lt;div class="p1"&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;What is TLS, what is CBC mode, and why should I care if it's broken?&lt;/b&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class="p1"&gt;
Some background:&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Transport_Layer_Security"&gt;Transport Layer Security&lt;/a&gt;&amp;nbsp;(née SSL) is the most important security protocol on the Internet. If you find yourself making a secure connection to another computer, there's a very good chance you'll be doing it with TLS. (Unless you're using&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/User_Datagram_Protocol"&gt;UDP&lt;/a&gt;-based protocol, in which case you might use TLS's younger cousin &lt;a href="http://en.wikipedia.org/wiki/Datagram_Transport_Layer_Security"&gt;Datagram TLS&lt;/a&gt;&amp;nbsp;[DTLS]).&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
The problem with TLS is that it kind of stinks. Mostly this is due to bad decisions made back in the the mid-1990s when SSL was first designed. Have you seen the way people &lt;a href="http://www.complex.com/style/2011/09/the-90-greatest-90s-fashion-trends/overalls-with-the-straps-down"&gt;dressed back then?&lt;/a&gt;&amp;nbsp;Protocol design was&amp;nbsp;worse.&lt;br /&gt;
&lt;br /&gt;
While TLS has gotten better since then, it still retains many of the worst ideas from the era. One example is the&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29"&gt;CBC-mode&lt;/a&gt; ciphersuite, which I've &lt;a href="http://blog.cryptographyengineering.com/2012/09/on-provable-security-of-tls-part-2.html"&gt;written about&lt;/a&gt; &lt;a href="http://blog.cryptographyengineering.com/2011/09/brief-diversion-beast-attack-on-tlsssl.html"&gt;several times&lt;/a&gt;&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/search?q=bram+cohen"&gt;before&lt;/a&gt; on this blog. CBC-mode uses a block cipher (typically&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard"&gt;AES&lt;/a&gt;) to encrypt data. It's the most common ciphersuite in use today, probably because it's the only&amp;nbsp;&lt;a href="https://tools.ietf.org/html/rfc5246#page-65"&gt;&lt;i&gt;mandatory &lt;/i&gt;ciphersuite&lt;/a&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;given&amp;nbsp;in the spec.&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;What's wrong with CBC mode?&lt;/b&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class="p1"&gt;
The real problem with TLS is not the encryption itself, but rather the &lt;a href="http://en.wikipedia.org/wiki/Message_authentication_code"&gt;Message Authentication Code&lt;/a&gt; (MAC) that's used to protect the integrity (authenticity) of each data record.&lt;br /&gt;
&lt;br /&gt;
Our &lt;a href="http://cseweb.ucsd.edu/~mihir/papers/oem.pdf"&gt;modern understanding&lt;/a&gt; is that you&amp;nbsp;should always encrypt a message first, &lt;i&gt;then&lt;/i&gt; apply the MAC to the resulting ciphertext. But TLS gets&amp;nbsp;this backwards. Upon encrypting a record, the sender first applies a MAC to the plaintext, then adds up to 255 bytes of&amp;nbsp;&lt;i&gt;padding&lt;/i&gt;&amp;nbsp;to get the message up to a multiple of the cipher (e.g., &lt;a href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard"&gt;AES's&lt;/a&gt;) block size. Only then does it CBC-encrypt the record.&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-knWVOVIC1PQ/UQrxeQm4n9I/AAAAAAAAATs/4k6Cmnuyp-0/s1600/TLSRecord1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="64" src="http://3.bp.blogspot.com/-knWVOVIC1PQ/UQrxeQm4n9I/AAAAAAAAATs/4k6Cmnuyp-0/s320/TLSRecord1.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Structure of a TLS record. The whole thing is encrypted with CBC mode.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
The critical point is that the padding is &lt;i&gt;not&lt;/i&gt; protected by the MAC. This means an attacker can tamper with it (by flipping specific bits in the ciphertext), leading to a very nasty kind of problem known as a &lt;a href="http://en.wikipedia.org/wiki/Padding_oracle_attack"&gt;padding oracle attack&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
In these attacks (&lt;a href="http://blog.cryptographyengineering.com/2011/10/attack-of-week-xml-encryption.html"&gt;example here&lt;/a&gt;), an attacker first captures an encrypted record sent by an honest party, modifies it, then re-transmits it to the server for decryption. If the attacker can learn whether her changes affected the padding -- &lt;i&gt;e.g.,&lt;/i&gt;&amp;nbsp;by receiving a padding error&amp;nbsp;as opposed to a bad MAC error -- she can use this information to adaptively decrypt the whole record. The structure of TLS's encryption padding makes it friendly to these attacks.&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-926wTO8dlBQ/UQrvAPhwUTI/AAAAAAAAATk/C3m-LwVpgIE/s1600/TLSRecord2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="74" src="http://1.bp.blogspot.com/-926wTO8dlBQ/UQrvAPhwUTI/AAAAAAAAATk/C3m-LwVpgIE/s320/TLSRecord2.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Closeup of a padded TLS record. Each byte contains the padding length, followed by another (pointless, redundant) length byte.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;But padding oracle attacks are well known, and (D)TLS has countermeasures!&lt;/b&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class="p1"&gt;
The TLS designers learned about padding oracles way back in 2002, and immediately took steps to rectify them. Unfortunately, instead of&amp;nbsp;&lt;i&gt;fixing&lt;/i&gt;&amp;nbsp;the problem, they decided to apply band-aids. This is a time-honored tradition in TLS design.&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
The first band-aid was simple: eliminate any error messages that could indicate to the attacker whether the padding check (vs. the MAC check) is what caused a decryption failure.&lt;br /&gt;
&lt;br /&gt;
This seemed to fix things for a while, until some researchers figured out that you could simply &lt;a href="http://www.iacr.org/cryptodb/archive/2003/CRYPTO/1069/1069.pdf"&gt;&lt;i&gt;time&lt;/i&gt;&amp;nbsp;the server&lt;/a&gt;&amp;nbsp;to see how long decryption takes, and thereby learn if&amp;nbsp;the padding check failed. This is because implementations of the time would first check the padding, then return immediately (without checking the MAC) if the padding was bad. That resulted in a noticeable timing differential the attacker could detect.&lt;br /&gt;
&lt;br /&gt;
Thus a second band-aid was needed. The TLS designers decreed that decryption should always take &lt;i&gt;the same amount of time,&lt;/i&gt; regardless of how the padding check comes out. Let's roll the TLS 1.2&amp;nbsp;&lt;a href="https://tools.ietf.org/rfc/rfc5246.txt"&gt;spec&lt;/a&gt;:&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;/div&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: Courier New, Courier, monospace; font-size: x-small;"&gt;&lt;b&gt;[T]he best way to do this is to compute the MAC even if the padding is incorrect, and only then reject the packet.  For instance, if the pad appears to be incorrect, the implementation might assume a zero-length pad and then compute the MAC.&lt;/b&gt;&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;div class="p1"&gt;
Yuck. Does this even work?&lt;br /&gt;
&lt;br /&gt;
Unfortunately, not quite. When the padding check fails, the decryptor&lt;i&gt;&amp;nbsp;doesn't know how much padding to strip off&lt;/i&gt;. That means they don't know how long the actual message is, and therefore how much data to MAC. The recommended countermeasure (above) is to assume&amp;nbsp;&lt;i&gt;no&lt;/i&gt;&amp;nbsp;padding, then MAC the whole blob. As a result, the MAC computation can take a tiny&amp;nbsp;bit longer when the padding is damaged.&lt;br /&gt;
&lt;br /&gt;
The TLS designers realized this, but by this point they were exhausted and wanted to go think about something else. So they left us with the following note:&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: Courier New, Courier, monospace; font-size: x-small;"&gt;&lt;b style="white-space: pre-wrap;"&gt;This leaves a small timing channel&lt;/b&gt;&lt;span style="white-space: pre-wrap;"&gt;, &lt;b&gt;since MAC performance depends to some extent on the size of the data fragment&lt;/b&gt;, &lt;b&gt;&lt;u&gt;but it is not believed to be large enough to be exploitable&lt;/u&gt;&lt;/b&gt;, due to the large block size of existing MACs and the small size of the timing signal.&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class="p1"&gt;
And for the last several years -- at least,&amp;nbsp;&lt;i&gt;as far as we know&lt;/i&gt;&amp;nbsp;--&amp;nbsp;they were basically correct.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;How does this new paper change things?&lt;/b&gt;&amp;nbsp;&lt;/blockquote&gt;
The &lt;a href="http://www.isg.rhul.ac.uk/tls/"&gt;new AlFardan and Paterson result&lt;/a&gt;&amp;nbsp;shows that it is &lt;i&gt;indeed&lt;/i&gt; possible to distinguish the tiny timing differential caused by invalid padding, at least from a relatively close distance -- &lt;i&gt;e.g., &lt;/i&gt;over a LAN. This is partly due to advances in computing hardware: most new computers now ship with an easily accessible &lt;a href="http://en.wikipedia.org/wiki/Time_Stamp_Counter"&gt;CPU cycle counter&lt;/a&gt;. But it's also thanks to some clever statistical techniques that use &lt;i&gt;many&lt;/i&gt;&amp;nbsp;samples to smooth out and overcome the jitter and noise of a network connection.&lt;br /&gt;
&lt;br /&gt;
The upshot is that new technique can measure timing differentials of less than &lt;i&gt;1&amp;nbsp;microsecond&lt;/i&gt;&amp;nbsp;over a LAN connection -- for example,&amp;nbsp;if the attacker is in the same data center as your servers. It does this&amp;nbsp;by making several thousand decryption queries and processing the results. Under the right circumstances, this turns out to be enough to bring (D)TLS padding oracle attacks back to life.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;How does the attack work?&lt;/b&gt;&lt;/blockquote&gt;
For the details, you should obviously read &lt;a href="http://www.isg.rhul.ac.uk/tls/"&gt;the full paper or at least the nice FAQ&lt;/a&gt; that Royal Holloway has put out. Here I'll try to give some intuition.&lt;br /&gt;
&lt;br /&gt;
Before I can explain the attack, you need to know a little bit about how hash-based MACs work. TLS typically uses &lt;a href="http://en.wikipedia.org/wiki/Hash-based_message_authentication_code"&gt;HMAC&lt;/a&gt; with either MD5, SHA1 or SHA256 as the hash function. While these are very different hash functions, the critical point is that each one processes messages in 64-byte blocks.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://upload.wikimedia.org/wikipedia/commons/e/ed/Merkle-Damgard_hash_big.svg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="93" src="http://upload.wikimedia.org/wikipedia/commons/e/ed/Merkle-Damgard_hash_big.svg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Consequently, hashing time is a function of the number of &lt;i&gt;blocks&lt;/i&gt;&amp;nbsp;in the message, not the number of bytes. Going from a 64-byte input to a &lt;i&gt;65-byte&lt;/i&gt;&amp;nbsp;input means an entire extra block, and hence a (relatively) large jump in the amount of computation time (an extra iteration of the hash function's &lt;a href="http://en.wikipedia.org/wiki/One-way_compression_function"&gt;compression function&lt;/a&gt;).&lt;br /&gt;
&lt;br /&gt;
There are a few subtleties in here. The hash functions incorporate an 8-byte length field plus some special hash function padding, which actually means a one-block message can only contain about 55 bytes of real data (which also includes the 13-byte record header). The &lt;a href="http://en.wikipedia.org/wiki/Hash-based_message_authentication_code"&gt;HMAC&lt;/a&gt; construction adds a (constant) amount of additional work, but we don't need to think about that here.&lt;br /&gt;
&lt;br /&gt;
So in summary: you can get 55 bytes of data into one block of the hash. Go a single byte beyond that, and the hash function will have to run a whole extra round, causing a tiny (500-1000 hardware cycle) delay.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://3.bp.blogspot.com/-YAGiwllSAHg/UQw--NGyTcI/AAAAAAAAAUA/d_RQG4giUro/s1600/cycles.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="122" src="http://3.bp.blogspot.com/-YAGiwllSAHg/UQw--NGyTcI/AAAAAAAAAUA/d_RQG4giUro/s200/cycles.png" width="200" /&gt;&lt;/a&gt;The attack here is to take a message that --&amp;nbsp;&lt;i&gt;including &lt;/i&gt;the TLS padding -- would fall above that 55 byte boundary. However, the same message with padding properly&amp;nbsp;&lt;i&gt;removed&amp;nbsp;&lt;/i&gt;would fall below it. When an attacker tampers with the message (damaging the padding), the decryption process will MAC the longer version of the message&amp;nbsp;-- resulting in a measurably higher computation time than when the padding checks out.&lt;br /&gt;
&lt;br /&gt;
By repeating this process many, many thousand (or millions!) of times to eliminate noise and network jitter, it's possible to get a clear measurement of whether the decryption succeeded or not. Once you get that, it's just a matter of executing a standard padding oracle attack.&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;But there's no way this will work on TLS! It'll kill the session!&lt;/b&gt;&lt;/blockquote&gt;
Please recall that I described this as a &lt;i&gt;practical&lt;/i&gt; attack on Datagram TLS (DTLS) -- and as a more theoretical one on TLS itself.* There's a reason for this.&lt;br /&gt;
&lt;br /&gt;
The reason is that TLS (and not DTLS) includes one more countermeasure I haven't mentioned yet: anytime a record fails to decrypt (due to a bad MAC &lt;i&gt;or&lt;/i&gt; padding error), the TLS server kills the session. &lt;a href="http://blog.cryptographyengineering.com/2012/01/attack-of-week-datagram-tls.html"&gt;DTLS does &lt;i&gt;not&lt;/i&gt; do this&lt;/a&gt;, which makes this attack borderline practical. (Though it still takes millions of packet queries to execute.)&lt;br /&gt;
&lt;br /&gt;
The standard TLS 'session kill' feature would appear to stop padding oracle attacks, since they require the attacker to make&amp;nbsp;&lt;i&gt;many,&amp;nbsp;many&lt;/i&gt;&amp;nbsp;decryption attempts. Killing the session limits the attacker to one decryption -- and intuitively that would seem to be the end of it.&lt;br /&gt;
&lt;br /&gt;
But actually, this turns out not to be true.&lt;br /&gt;
&lt;br /&gt;
You see, one of the neat things about padding oracle attacks is that they can&amp;nbsp;&lt;a href="http://www.iacr.org/cryptodb/archive/2003/CRYPTO/1069/1069.pdf"&gt;work&amp;nbsp;across different &lt;/a&gt;&lt;i&gt;&lt;a href="http://www.iacr.org/cryptodb/archive/2003/CRYPTO/1069/1069.pdf"&gt;sessions&lt;/a&gt; &lt;/i&gt;(keys), provided that that &lt;i&gt;(a)&lt;/i&gt; your victim is willing to re-initiate the session after it drops, and &lt;i&gt;(b)&lt;/i&gt; the secret plaintext appears in the same position in each stream. Fortunately the design of browsers and HTTPS lets us satisfy both of these requirements.&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;To make a target browser initiate many connections, you can feed it some custom Javascript that causes it to repeatedly connect to an SSL server (as in the&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/CRIME_(security_exploit)"&gt;CRIME attack&lt;/a&gt;). Note that the Javascript &lt;i&gt;doesn't&lt;/i&gt; need to come from the target webserver -- it can even served on an unrelated non-HTTPS page, possibly running in a different tab. So in short: this is pretty feasible.&lt;/li&gt;
&lt;li&gt;Morover, thanks to the design of the HTTP(S) protocol, each of these connections will include &lt;i&gt;cookies&lt;/i&gt; at a known location in HTTP stream. While you may not be able to decrypt the rest of the stream, these cookie values are generally all you need to break into somebody's account.&lt;/li&gt;
&lt;/ol&gt;
Thus the only practical limitation on such a cookie attack is the &lt;i&gt;time&lt;/i&gt;&amp;nbsp;it takes for the server to re-initiate all of these connections. TLS handshakes aren't fast, and this attack can take tens of thousands (or millions!) of connections per byte. So in practice the TLS attack would probably take days. In other words: don't panic.&lt;br /&gt;
&lt;br /&gt;
On the other hand, don't get complacent either. The authors propose some &lt;a href="http://www.isg.rhul.ac.uk/tls/"&gt;clever optimizations&lt;/a&gt; that could take the TLS attack into the realm of the feasible (for TLS) in the near future.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;How is it being fixed?&lt;/b&gt;&lt;/blockquote&gt;
With more band-aids of course!&lt;br /&gt;
&lt;br /&gt;
But at least this time, they're excellent band-aids. Adam Langley &lt;a href="http://www.imperialviolet.org/2013/02/04/luckythirteen.html"&gt;has written a 500-line OpenSSL patch&lt;/a&gt; (!) that modifies the CBC-mode decryption procedure to wipe out the timing differentials used by this attack. I would recommend that you think about updating at least your servers in the future (though we all know you won't). Microsoft products &lt;strike&gt;should also see updates soon&lt;/strike&gt;&amp;nbsp;are allegedly not vulnerable to this attack, so won't need updates.**&lt;br /&gt;
&lt;br /&gt;
Still, this is sort of like fixing your fruitfly problem by spraying your kitchen with DDT.&amp;nbsp;Why not just throw away the rotted fruit? In practice, that means moving towards modern&amp;nbsp;&lt;a href="https://tools.ietf.org/html/rfc5288"&gt;AEAD ciphersuites like AES-GCM&lt;/a&gt;, which should generally end this madness. We hope.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;Why not switch to RC4?&lt;/b&gt;&lt;/blockquote&gt;
&lt;a href="http://en.wikipedia.org/wiki/RC4"&gt;RC4&lt;/a&gt;&amp;nbsp;is not an option in DTLS. However, it will mitigate this issue for TLS, since the RC4 ciphersuite doesn't use padding at all. In fact, this ancient ciphersuite has been (hilariously) enjoying a resurgence in recent years as the 'solution' to TLS attacks like &lt;a href="http://www.net-security.org/article.php?id=1638"&gt;BEAST&lt;/a&gt;. Some will see this attack as further justification for the move.&lt;br /&gt;
&lt;br /&gt;
But please don't do this. &lt;a href="http://blog.cryptographyengineering.com/2011/12/whats-deal-with-rc4.html"&gt;RC4 is old and creaky&lt;/a&gt;, and we &lt;i&gt;really&lt;/i&gt;&amp;nbsp;should be moving away from it too.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;So what's next for TLS?&lt;/b&gt;&lt;/blockquote&gt;
I'd love to say more, but you see, the&amp;nbsp;first&lt;i&gt; &lt;/i&gt;rule of TLS vulnerability club is...&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Notes:&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
* The attack on Datagram TLS is more subtle, and a lot more interesting. I haven't covered it much in this post because TLS is much more widely used than DTLS. But briefly, it's an extension of some previous techniques -- by the same authors -- that I &lt;a href="http://blog.cryptographyengineering.com/2012/01/attack-of-week-datagram-tls.html"&gt;covered in this blog last year&lt;/a&gt;. The gist is that an attacker can&amp;nbsp;&lt;i&gt;amplify&lt;/i&gt;&amp;nbsp;the impact of the timing differential by 'clogging' the server with lots of unrelated traffic. That makes these tiny differentials much easier to detect.&lt;br /&gt;
&lt;br /&gt;
** And if you believe that, I have a lovely old house in Baltimore to sell you...&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/nrRu1g-Crvk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/4229475952626214922/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2013/02/attack-of-week-tls-timing-oracles.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/4229475952626214922?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/4229475952626214922?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/nrRu1g-Crvk/attack-of-week-tls-timing-oracles.html" title="Attack of the week: TLS timing oracles" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-knWVOVIC1PQ/UQrxeQm4n9I/AAAAAAAAATs/4k6Cmnuyp-0/s72-c/TLSRecord1.png" height="72" width="72" /><thr:total>6</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2013/02/attack-of-week-tls-timing-oracles.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkEAR3Y6cCp7ImA9WhNaEk4.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-902033125852506350</id><published>2013-01-25T02:31:00.003-08:00</published><updated>2013-01-26T12:04:06.818-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-26T12:04:06.818-08:00</app:edited><title>In defense of Provable Security</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://www.morebooks.de/assets/product_images/9783642332/big/7797974/provable-security.jpg?locale=gb" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="200" src="https://www.morebooks.de/assets/product_images/9783642332/big/7797974/provable-security.jpg?locale=gb" width="131" /&gt;&lt;/a&gt;&lt;/div&gt;
It's been a long time with no blogging, mostly thanks to travel and deadlines. In fact I'm just coming back from a &lt;a href="https://www.cosic.esat.kuleuven.be/ecrypt/cryptofor2020/"&gt;workshop&lt;/a&gt; in Tenerife, where I learned a lot. Some of which I can't write about yet, but am &lt;i&gt;really&lt;/i&gt; looking forward to sharing with you soon.&lt;br /&gt;
&lt;br /&gt;
During the workshop I had some time to talk to Dan Bernstein (djb), and to hear his views on the relevance of provable security. This is a nice coincidence, since I notice that &lt;a href="http://cr.yp.to/talks/2013.01.23/slides.pdf"&gt;Dan's slides&lt;/a&gt;&amp;nbsp;have been making the rounds on Twitter -- to the general approval of some who, I suspect, agree with Dan because they think that security proofs are &lt;i&gt;hard&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
The problem here is that this isn't what Dan's saying. Part of the issue is that his presentation is short, so it's easy to misinterpret his position as a call to&amp;nbsp;&lt;i&gt;just&lt;/i&gt;&amp;nbsp;&lt;i&gt;start designing cryptosystems the way we design software. &lt;/i&gt;That's not right, or if it is: get ready for a lot of broken crypto.&lt;br /&gt;
&lt;br /&gt;
This post is my attempt to explain what Dan's saying, and then (hopefully) convince you he's &lt;i&gt;not&lt;/i&gt; recommending the crazy things above.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;There's no such thing as a "security proof"&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Dan's first point is that we're using the wrong nomenclature. The term 'security proof' is misleading in that it gives you the impression that a scheme is, well... provably secure. There aren't many schemes that can make this claim (aside from the&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/One-time_pad"&gt;One-Time Pad&lt;/a&gt;). Most security proofs don't say this, and that can lead to misunderstandings.&lt;br /&gt;
&lt;br /&gt;
The proofs that we see in day-to-day life are more accurately referred to as &lt;i&gt;security&lt;/i&gt;&amp;nbsp;&lt;i&gt;reductions&lt;/i&gt;. These take something (like a cryptographic scheme) and &lt;i&gt;reduce&lt;/i&gt;&amp;nbsp;its security to the hardness of some other problem -- typically a mathematical problem, but sometimes even another cryptosystem.&lt;br /&gt;
&lt;br /&gt;
A classic example of this is something like the&amp;nbsp;&lt;a href="http://www.rsa.com/rsalabs/node.asp?id=2005"&gt;RSA-PSS&lt;/a&gt; signature, which is unforgeable if the RSA problem is hard, or &lt;a href="http://en.wikipedia.org/wiki/ElGamal_encryption"&gt;Chaum-van Heijst-Pfitzmann&lt;/a&gt;&amp;nbsp;hashing, which reduce to the hardness of the Discrete Logarithm problem. But there are more complex examples like block cipher&amp;nbsp;&lt;a href="http://www.cs.ucdavis.edu/research/tech-reports/1997/CSE-97-9.pdf"&gt;modes of operation&lt;/a&gt;, which can often be reduced to the (&lt;a href="http://en.wikipedia.org/wiki/Pseudorandom_permutation"&gt;PRP&lt;/a&gt;) security of a block cipher.&lt;br /&gt;
&lt;br /&gt;
So the point here is that these proofs don't actually &lt;i&gt;prove security&lt;/i&gt; -- since the RSA problem or Discrete Log or block cipher could still be&amp;nbsp;broken. What they do is allow us to generalize: instead of analyzing many different schemes, we can focus our attention one or a small number of hard problems. In other words, it's a different -- and probably much better -- way to allocate our (limited) cryptanalytic effort.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;But we don't study those problems well, and when we do, we break them&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Dan argues that this approach is superficially appealing, but &lt;i&gt;concretely &lt;/i&gt;it can be&amp;nbsp;harmful. Take the Chaum &lt;i&gt;et al.&lt;/i&gt;&amp;nbsp;hash function listed above. Nobody should ever use this thing: it's disastrously slow and there's no solid evidence that it's truly more secure than something like SHA-3 or even SHA-3's lamest competitors.&lt;br /&gt;
&lt;br /&gt;
And here (unfortunately) he's got some evidence on his side: we've been amazingly unsuccessful at cryptanalyzing complex new cipher/hash primitives like AES, BLAKE and Keccak, despite the fact that these functions don't have [real] security proofs. Where we make cryptanalytic progress, it's almost always on first-round competition proposals, or on truly ancient functions like MD5. Moreover, if you take a look at 'provably-secure' number theoretic systems from the same era, you'll find that &lt;i&gt;they're &lt;/i&gt;equally broken -- thanks to bad assumptions about key and parameter sizes.&lt;br /&gt;
&lt;br /&gt;
We've also gotten pretty good at chipping away at classic problems like the Discrete Logarithm. The charitable interpretation is that &lt;i&gt;this is a feature, not a bug&lt;/i&gt;&amp;nbsp;-- we're focusing cryptanalytic effort on those problems, and we're making progress, whereas nobody's giving enough attention to all these new ciphers. The less charitable interpretation is that the Discrete Logarithm problem is a bad problem to begin with. Maybe we're safer with &lt;i&gt;unprovable &lt;/i&gt;schemes that we can't break, then provable schemes that seem to be slowly failing.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;You need a cryptanalyst...&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This is by far the fuzziest part (for me) of what Dan's saying. Dan argues that security proofs are a useful tool, but they're no substitute for human cryptanalysis. None of which I would argue with at all. But the question is: cryptanalysis of what?&lt;br /&gt;
&lt;br /&gt;
The whole point of a security reduction is to reduce the amount of cryptanalysis we have to do. Instead of a separate signature and encryption scheme to analyze, we can design two schemes that both reduce to the RSA problem, then we can cryptanalyze that. Instead of analyzing a hundred different authenticated cipher modes, we can simply analyze one AES -- and know that &lt;a href="http://en.wikipedia.org/wiki/OCB_mode"&gt;OCB&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Galois/Counter_Mode"&gt;GCM&lt;/a&gt; and CBC and CTR will all be secure (for appropriate definitions of 'secure').&lt;br /&gt;
&lt;br /&gt;
This is good, and it's why we should be using security proofs. Not to mislead people, but to help us better allocate our&amp;nbsp;&lt;i&gt;very&lt;/i&gt;&amp;nbsp;scarce resources -- of smart people who can do this work (and haven't sold out to the NSA).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;...because people make mistakes&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
One last point: errors in security proofs are pretty common, but this isn't quite what Dan is getting at. We both agree that this problem can be fixed, hopefully with the help of computer-aided proof techniques. Rather, he's concerned that security proofs only prove that something is secure &lt;i&gt;within a given model. &lt;/i&gt;There&amp;nbsp;are &amp;nbsp;many examples of provably-secure schemes that admit attacks because those attacks were completely outside of that threat model.&lt;br /&gt;
&lt;br /&gt;
As an example, Dan points to some older EC key agreement protocols that did not explicitly include group membership tests in their description. Briefly, these schemes are secure if the attacker submits valid elements of an elliptic curve group. But of course, a real life attacker might not. The result can be disastrously insecure.&lt;br /&gt;
&lt;br /&gt;
So where's the problem here? Technically the proof &lt;i&gt;is&lt;/i&gt;&amp;nbsp;correct -- as long as the attacker submits group elements, everything's fine. What the protocol doesn't model is the fact that an attacker can cheat -- it just assumes honesty. Or as Dan puts it: 'the attack can't even be modeled in the language of the proof'.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What Dan's not saying&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The one thing you should &lt;i&gt;not&lt;/i&gt;&amp;nbsp;take away from this discussion is the idea that security proofs have no value. What Dan is saying is that security proofs are one element of the design process, but not 100% of it. And I can live with that.&lt;br /&gt;
&lt;br /&gt;
The risk is that some will see Dan's talk as a justification for using goofy, unprovable protocols like PKCS#1v1.5 signature or the &lt;a href="http://en.wikipedia.org/wiki/Secure_Remote_Password_protocol"&gt;SRP password protocol&lt;/a&gt;. It's not. We have better protocols that are just as well analyzed, but actually have a justification behind them.&lt;br /&gt;
&lt;br /&gt;
Put it this way: if you have a choice between driving on a suspension bridge that was designed using scientific engineering techniques, and one that &lt;i&gt;simply hasn't fallen down yet&lt;/i&gt;, which one are you going to take? Me, I'll take the scientific techniques. But I admit that scientifically-designed bridges sometimes do fall down.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;In conclusion&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
While I've done my best to sum up Dan's position, what I've written above is probably still a bit inaccurate. In fact, it's entirely possible that I've just constructed a 'strawman djb' to argue with here. If so, please don't blame me -- it's a &lt;i&gt;whole&lt;/i&gt; lot easier to argue with a straw djb than the real thing.&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/_yzMLuXhkPQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/902033125852506350/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2013/01/in-defense-of-provable-security.html#comment-form" title="10 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/902033125852506350?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/902033125852506350?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/_yzMLuXhkPQ/in-defense-of-provable-security.html" title="In defense of Provable Security" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><thr:total>10</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2013/01/in-defense-of-provable-security.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkMARXg-cSp7ImA9WhNUE0k.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-4722728351108486018</id><published>2013-01-04T13:19:00.005-08:00</published><updated>2013-01-04T15:00:44.659-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-04T15:00:44.659-08:00</app:edited><title>Surveillance works! Let's have more of it.</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://upload.wikimedia.org/wikipedia/commons/thumb/a/a1/Three_Surveillance_cameras.jpg/738px-Three_Surveillance_cameras.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="162" src="http://upload.wikimedia.org/wikipedia/commons/thumb/a/a1/Three_Surveillance_cameras.jpg/738px-Three_Surveillance_cameras.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
If you care about these things, you might have heard that &lt;a href="https://threatpost.com/en_us/blogs/fraudulent-certificate-google-domains-found-after-mistake-turkish-ca-010313"&gt;Google recently detected and revoked a bogus Google certificate&lt;/a&gt;. Good work, and huge kudos to the folks at Google who lost their holidays to this nonsense.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
From what I've read, this particular incident got started in late 2011 when Turkish Certificate Authority &lt;a href="http://www.turktrust.com.tr/"&gt;TURKTRUST&lt;/a&gt; accidentally handed out &lt;i&gt;intermediate&lt;/i&gt; CA certificates to two of their customers.&amp;nbsp;Intermediate CA certs are like normal SSL certs, with one tiny difference: they can be used to generate other SSL certificates. &lt;i&gt;Oops.&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
One of the recipients noticed the error and reported it to the CA. The other customer took a different approach and&amp;nbsp;&lt;a href="http://erratasec.blogspot.com/2013/01/notes-on-turktrust-fiasco.html"&gt;installed it into an intercepting Checkpoint firewall&lt;/a&gt; to sniff SSL-secured connections. Because, you know, &lt;i&gt;why not.&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So this is bad but not exactly surprising -- in fact, it's all stuff&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/2012/02/how-to-fix-internet.html"&gt;we've seen before&lt;/a&gt;. Our CA system has far too many trust points, and it requires too many people to act collectively when someone&amp;nbsp;&lt;a href="http://www.theregister.co.uk/2012/02/09/tustwave_disavows_mitm_digital_cert/"&gt;proves untrustworthy&lt;/a&gt;. Unless we do something, we're going to see lots more of this.&lt;br /&gt;
&lt;br /&gt;
What's interesting about this case -- and what leads to the title above -- is not so much what went wrong, but rather, &lt;i&gt;what went right.&lt;/i&gt;&amp;nbsp;You see, this bogus certificate was&amp;nbsp;detected, and likely not because some good samaritan reported the violation. Rather, it was (probably) detected&amp;nbsp;&lt;i&gt;by Google's unwavering surveillance.&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
The surveillance in question is conducted by the Chrome brower, which actively looks out for attacks and reports them. Here's the money quote from their &lt;a href="http://www.google.com/chrome/intl/en/privacy.html"&gt;privacy policy&lt;/a&gt;:&lt;/div&gt;
&lt;div&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;"If you attempt to connect to a Google website using a secure&lt;br /&gt;connection, and the browser blocks the connection due to information&lt;br /&gt;that indicates you are being actively attacked by someone on the&lt;br /&gt;network (a “man in the middle attack”), Chrome may send information&lt;br /&gt;about that connection to Google for the purpose of helping to&lt;br /&gt;determine the extent of the attack and how the attack functions."&lt;/b&gt;&lt;/blockquote&gt;
The specific technical mechanism in Chrome simple:&amp;nbsp;Chrome ships with a series of 'pins'&amp;nbsp;&lt;a href="https://src.chromium.org/viewvc/chrome/trunk/src/net/base/transport_security_state_static.h?view=markup"&gt;in its source code&lt;/a&gt;&amp;nbsp;(thanks Moxie, &lt;a href="http://ritter.vg/blog-cas_and_pinning.html"&gt;thanks Tom&lt;/a&gt;).&amp;nbsp;These tell Chrome what valid Google certificates should look like, and help it detect an obviously bogus certificate. When Chrome sees a bogus cert attached to a purported Google site, it doesn't just stop the connection, it&amp;nbsp;rings an alarm at Google HQ.&lt;br /&gt;
&lt;br /&gt;
And that alarm is a fantastic thing, because in this case it may have led to discovery and revocation&amp;nbsp;&lt;i&gt;before&lt;/i&gt;&amp;nbsp;this certificate could be stolen and used for something worse.&lt;br /&gt;
&lt;br /&gt;
Now imagine doing the same thing happening in many other browsers, and not just for Google sites. Well, you don't have to imagine. This is exactly the approach taken by plugins like &lt;a href="https://addons.mozilla.org/en-us/firefox/addon/perspectives/"&gt;Perspectives&lt;/a&gt;&amp;nbsp;and &lt;a href="http://www.convergence.io/"&gt;Convergence&lt;/a&gt;, which monitor users' SSL connections in a distributed fashion to detect bogus certificates. These plugins are great, but they're not deployed widely enough. The technique should be standard in all browsers, perhaps with some kind of opt in. (I certainly would opt.)&lt;br /&gt;
&lt;br /&gt;
The simple fact is that our CA system is broken and this is what we've got. Congratulations to Google for taking a major first step in protecting its users. Now let's take some more.&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/v5RxJJ_CSVk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/4722728351108486018/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2013/01/ubiquitous-surveillance-works-lets-have.html#comment-form" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/4722728351108486018?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/4722728351108486018?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/v5RxJJ_CSVk/ubiquitous-surveillance-works-lets-have.html" title="Surveillance works! Let's have more of it." /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><thr:total>5</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2013/01/ubiquitous-surveillance-works-lets-have.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkICQX07cCp7ImA9WhBTGU0.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-4128478152259818890</id><published>2012-12-28T14:52:00.004-08:00</published><updated>2013-02-14T22:09:20.308-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-14T22:09:20.308-08:00</app:edited><title>The anatomy of a bad idea</title><content type="html">&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://farm4.staticflickr.com/3404/3646874712_516731e044.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="136" src="http://farm4.staticflickr.com/3404/3646874712_516731e044.jpg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;(&lt;a href="http://www.flickr.com/photos/vermininc/3646874712/"&gt;source&lt;/a&gt;/cc)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
I've been running a fever all day and am only coming back to my senses now, thanks to a huge (and possibly toxic) dose of Motrin. Sometimes when you're under the weather, things kind of blur together. This is probably why I can only recall two things I read this afternoon.&lt;br /&gt;
&lt;br /&gt;
The first was a news story concerning a series&amp;nbsp;of tests in which the US government dropped&amp;nbsp;&lt;a href="http://news.cnet.com/8301-17938_105-57516285-1/nuked-beers-safe-to-drink-following-u.s-government-tests/"&gt;nuclear bombs on a variety of canned beverages&lt;/a&gt;, apparently to see how well they held up (but possibly just because they had some nukes).&amp;nbsp;The second was the&amp;nbsp;&lt;a href="http://www.w3.org/TR/2012/WD-WebCryptoAPI-20120913/"&gt;W3C Web Cryptography API&lt;/a&gt;, a draft Javascript crypto API that will ultimately power a lot of the crypto we use on the web.&lt;br /&gt;
&lt;br /&gt;
Even in my addled state, I can tell that only&amp;nbsp;&lt;i&gt;one&lt;/i&gt; of these things is a good idea.&lt;br /&gt;
&lt;br /&gt;
(In case you're still guessing, here's a hint: &lt;i&gt;we'll still need beer after the bombs fall&lt;/i&gt;.)&lt;br /&gt;
&lt;br /&gt;
Before I go further, let me be clear: I think the web absolutely &lt;i&gt;should&lt;/i&gt;&amp;nbsp;have a secure browser-based crypto API!&amp;nbsp;My problem is that I can't bear to watch the W3C screw it up. Because&amp;nbsp;screw it up they absolutely will.&amp;nbsp;The W3C, bless their sweet little hearts, has left a &lt;a href="http://blog.cryptographyengineering.com/2012/05/how-to-choose-authenticated-encryption.html"&gt;trail of wreckage&lt;/a&gt; behind every crypto project they've ever taken on.&lt;i&gt;&amp;nbsp;And these were small projects!&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The Web Crypto API is far more ambitious, which means it will blow up that much more spectacularly when it goes. And unfortunately, the W3C contributors seem immune to all attempts to disuade them from this course.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;So what is it?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The Web Cryptography API (henceforth WC-API) is a perfectly lovely idea: to build a standard Javascript API for doing crypto on the web. In theory it'll be supported by lots of browsers and will include all the logic you need to manage keys securely and perform common cryptographic operations. Things like encryption, signing, etc.&lt;br /&gt;
&lt;br /&gt;
This can't be deployed soon enough -- if it's done right. The problem with current Javascript implementations is that they're really bad at managing keys securely, and the crypto implementations are frequently ad-hoc, slow, and vulnerable to side-channel attacks. A common API should allow us to do much, much better.&lt;br /&gt;
&lt;br /&gt;
But at the same time we need to recognize that &lt;i&gt;cryptography is hard&lt;/i&gt; (seriously: this should be the name of my blog.) Moreover, Javascript development is -- no offense -- the &lt;i&gt;last&lt;/i&gt;&amp;nbsp;place we want people making hard cryptographic decisions. Decisions like, for example, 'should I use the obsolete and &lt;i&gt;&lt;a href="http://www.iacr.org/archive/eurocrypt2000/1807/18070374-new.pdf"&gt;very broken&lt;/a&gt; &lt;/i&gt;PKCS#1v1.5 encryption padding scheme in my protocol?' These are things that very few people need to think about, and most people who &lt;i&gt;are&lt;/i&gt;&amp;nbsp;thinking about them are going to make the wrong choice.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Two visions&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This is not a new argument. For two competing visions of how a cryptography library should work, consider two existing libraries: &lt;a href="http://openssl.org/"&gt;OpenSSL&lt;/a&gt; and &lt;a href="http://nacl.cr.yp.to/"&gt;NaCl&lt;/a&gt;.&amp;nbsp;OpenSSL is the grand old lady of cryptography, 'beloved' by millions. Actually OpenSSL isn't a crypto library except by accident -- it's an SSL library that happens to expose a bunch of underlying crypto routines. NaCl is much newer and basically tries to repair the damage wrought by OpenSSL.&lt;br /&gt;
&lt;br /&gt;
If we must resort to analogies, let's try these: OpenSSL is the space shuttle of crypto libraries. It will get you to space, provided you have a team of people to push the ten thousand buttons required to do so. NaCl is more like an elevator -- you just press a button and it takes you there. No frills or options.&lt;br /&gt;
&lt;br /&gt;
I like elevators.&lt;br /&gt;
&lt;br /&gt;
Now obviously there are different reasons to take the space shuttle. Sometimes you need to go to places that aren't supported by the buttons on an elevator. But you'd better know exactly what you're doing, because making a mistake on the space shuttle is not something you get to do twice.&lt;br /&gt;
&lt;br /&gt;
More concretely, NaCl takes the position that most users don't need their crypto to be backwards compatible with other systems, and instead provides a simplified abstraction in the form of&amp;nbsp;the '&lt;a href="http://nacl.cr.yp.to/box.html"&gt;crypto_box&lt;/a&gt;' operation. This abstracts all the messy details of public and secret key cryptography into a single secure function call. This approach may seem a bit extreme, but it's also sufficient for a huge amount of what most people need to get done when they're encrypting things.&lt;br /&gt;
&lt;br /&gt;
WC-API does not adhere to the NaCl vision. Instead, it follows in the OpenSSL tradition. Here the basic unit is the crypto primitive, which can be selected from a menu provided by the designers. This menu includes some pretty solid primitives like &lt;a href="http://en.wikipedia.org/wiki/Optimal_asymmetric_encryption_padding"&gt;RSA-OAEP&lt;/a&gt;, &lt;a href="http://www.w3.org/TR/WebCryptoAPI/#ecdh"&gt;ECDH&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Galois/Counter_Mode"&gt;AES-GCM&lt;/a&gt;, but it also includes ridiculous stuff that should be banned from the universe -- things like the aforementioned RSA-PKCS#1v1.5 (signature and encryption) padding as well as several&amp;nbsp;&lt;i&gt;unauthenticated&lt;/i&gt;&amp;nbsp;symmetric modes of operation. Worse, some of the &lt;i&gt;bad&lt;/i&gt;&amp;nbsp;primitives are also the &lt;a href="http://www.w3.org/2012/webcrypto/WebCryptoAPI/#recommended-algorithms"&gt;recommended ones&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The user has to pick the right ones, generate the right keys, and hopefully (god bless) tie them all together&amp;nbsp;&lt;i&gt;without&lt;/i&gt;&amp;nbsp;running afoul of the various practical attacks that they'll be victim to when they make the wrong choice.&lt;br /&gt;
&lt;br /&gt;
Some will do this. Some will not.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;But maybe you're just being too sensitive...?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This is possible, but gosh, don't take my word for it. If you think I'm just blowing smoke, please at least listen to IETF Crypto Forum Research Group representatives Kenny Paterson,&amp;nbsp;&lt;span style="background-color: white; white-space: pre-wrap;"&gt;Tibor Jager and Juraj Somorovsky when they say &lt;i&gt;exactly the same things as me&lt;/i&gt; &lt;a href="http://lists.w3.org/Archives/Public/public-webcrypto/2012Sep/0186.html"&gt;but in scarier language&lt;/a&gt;:
&lt;/span&gt;&lt;br /&gt;
&lt;pre id="body" style="background-color: white; padding: 0.5em; white-space: pre-wrap; word-wrap: break-word;"&gt;We noted that the standard contains some legacy crypto algorithms,
which have well-known serious weaknesses but are (unfortunately) still
widely used. These weaknesses frequently lead to attacks on systems
that naively use these algorithms.

For instance, several works [Ble98,BFKST12,JSS12, ...] demonstrate the
vulnerability of RSA PKCS#1 v1.5 to variants of Bleichenbacher's
attack in various (practical and widely-used) applications. &lt;b&gt;Using
PKCS#1 v1.5 in a secure way is highly non-trivial and often
impossible, in particular in Web-based applications&lt;/b&gt;. Moreover, it is
known that the pure availability of PKCS#1 v1.5 encryption may also
spoil the security of other algorithms, like RSA-OAEP or
RSASSA-PKCS1-v1_5 signatures.

&lt;b&gt;Similarly, unauthenticated block-cipher modes of operation, like CTR
and CBC, have in the past been shown to enable "padding-oracle"-like
attacks&lt;/b&gt;, for instance in [Vau02,DR'10,DR'11,JS'11,AP'12, ...]. These
modes of operation should not be used without additional security
measures. An appropiate measure is a message authentication code,
which should be computed over the ciphertext and must be verified by
the receiver.

&lt;b&gt;Actually we would like to recommend that these legacy ciphers are
removed from the standard&lt;/b&gt;. While in some special cases countermeasures
against the known attacks are possible, implementing these is highly
non-trivial and error-prone, thus much harder than implementing new
libraries supporting secure algorithms. Even worse, in many examples
there exists no countermeasure.
&lt;/pre&gt;
&lt;b&gt;What about backwards compatibility?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Yes, I concede that there may occasionally be times when your Javascript&amp;nbsp;needs to decrypt a message that was encrypted by some other, archaic piece of crypto software. And for those times there really is a need to support some of the obsolete crypto schemes provided in the current W3C specification. But "support" is not the same as "provide in your mainline API".&lt;br /&gt;
&lt;br /&gt;
Unfortunately, several proposals to separate the older algorithms into a different namespace have been shot down, as have proposals to strongly warn users against the bad algorithms. I can't see any justification for these decisions, except that possibly there is a God and he wants cryptographers/pentesters to stay busy for the next few years.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;So what does it all mean?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A while ago on Twitter somebody asked why I spend so much time criticizing things that are old and broken, rather than making things new and shiny. When I finished sputtering, I realized that the answer is simple: I'm lazy.&lt;br /&gt;
&lt;br /&gt;
But that's ok, because the truth is, &lt;i&gt;most software developers are too&lt;/i&gt;. Not in a bad way, but simply in the sense that we want to get from point A to point B without being distracted by a lot of useless garbage. Give us a way to get between those two points and we'll do it with alacrity. Make us understand that PKCS#1v1.5 is universally insecure unless you use it in a &lt;a href="http://www.iacr.org/archive/crypto2002/24420127/24420127.pdf"&gt;very particular way (that's documented almost nowhere)&lt;/a&gt;, and that even &lt;i&gt;this&lt;/i&gt;&amp;nbsp;relies on some pretty unusual assumptions -- and you'll tend to find a lot of people just making mistakes.&lt;br /&gt;
&lt;br /&gt;
And in case this is all too doom-and-gloom for you, here's a parting thought to cheer you up. No matter how bad this API turns out to be, at least we don't have to drink&lt;i&gt;&amp;nbsp;&lt;/i&gt;it.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Update (12/30): &lt;/b&gt;A few people have criticized this post on the grounds that I should join the WebCrypto WG rather than complaining about it.&amp;nbsp;Usually the implication is that I'm after blog hits.&lt;br /&gt;
&lt;br /&gt;
The short answer is: if I really wanted blog hits, I wouldn't be bitching about an obscure web standard! I'd be &lt;a href="http://news.ycombinator.com/item?id=4403874"&gt;&lt;i&gt;complaining about Apple&lt;/i&gt;&lt;/a&gt;. I speak from experience here.&lt;br /&gt;
&lt;br /&gt;
The longer response is that many bright folks in and outside of the WG have made these points (see the CFRG note above). Their input has been respectfully considered and rejected. My impression is that we're not dealing with a lack of &lt;i&gt;knowledge &lt;/i&gt;here, but rather a more fundamental difference in approach. The WG has made an institutional decision to emphasize backwards compatibility over security. This works if you're designing a standard and hoping to get it adopted quickly. It just doesn't lead to a good standard.&lt;br /&gt;
&lt;br /&gt;
I think there's a certain kind of person who has the time and political skills to fix this kind of organizational problem, and I sincerely hope that person gets involved. But sadly, that person is not me.&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/0AaXM245c58" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/4128478152259818890/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/12/the-anatomy-of-bad-idea.html#comment-form" title="17 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/4128478152259818890?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/4128478152259818890?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/0AaXM245c58/the-anatomy-of-bad-idea.html" title="The anatomy of a bad idea" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><thr:total>17</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/12/the-anatomy-of-bad-idea.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkUEQX0zcCp7ImA9WhNUE0k.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-1761889473149623912</id><published>2012-11-24T06:51:00.004-08:00</published><updated>2013-01-04T14:56:40.388-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-04T14:56:40.388-08:00</app:edited><title>Let's talk about ZRTP</title><content type="html">&lt;div style="text-align: right;"&gt;
&lt;/div&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-BweIMgiEJqY/ULDkTbcn_4I/AAAAAAAAAQM/S-ibvOfUrbA/s1600/zooko-zrtp-h3-big.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="85" src="http://2.bp.blogspot.com/-BweIMgiEJqY/ULDkTbcn_4I/AAAAAAAAAQM/S-ibvOfUrbA/s200/zooko-zrtp-h3-big.jpg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Source: &lt;a href="http://financialcryptography.com/mt/archives/001329.html"&gt;Zooko&lt;/a&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
I just checked the date on my last post and it seems that I haven't blogged in nearly a month. Believe me, this isn't for lack of trying. The world has just been a very, very busy place.&lt;br /&gt;
&lt;br /&gt;
But this is the Thanksgiving holiday and every (US) American knows the best part of Thanksgiving is sitting around for hours waiting for a huge bird to cook thoroughly enough that it won't kill your family. And that means I finally have time to write about my favorite wonky topic: cryptographic protocols. And how utterly confusing they can be.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;ZRTP&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The subject of today's post is the &lt;a href="http://en.wikipedia.org/wiki/ZRTP"&gt;ZRTP key agreement protocol&lt;/a&gt;. ZRTP has recently gotten some press for being the primary key agreement used by &lt;a href="https://silentcircle.com/"&gt;Silent Circle&lt;/a&gt;, a new encrypted voice/video/text service launched by PGP inventor &lt;a href="http://en.wikipedia.org/wiki/Phil_Zimmermann"&gt;Phil Zimmermann&lt;/a&gt;&amp;nbsp;and some other bright folks. But it's also used in other secure VoIP solutions, like &lt;a href="http://zfoneproject.com/"&gt;Zfone&lt;/a&gt; and Moxie's&amp;nbsp;&lt;a href="http://www.whispersys.com/"&gt;RedPhone&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Silent Circle's an interesting case, since it's gotten some gentle criticism lately from a variety of folks -- well, mostly &lt;a href="http://en.wikipedia.org/wiki/Nadim_Kobeissi"&gt;Nadim&amp;nbsp;Kobeissi&lt;/a&gt; -- for being partially closed-source and for having received no real security audits. Nadim's typical, understated critique goes like this:&lt;br /&gt;
&lt;blockquote class="twitter-tweet"&gt;
Silent Circle is morally bankrupt for promoting its unreviewed, closed-source, centralized crypto software and marketing it as “secure.”&lt;br /&gt;
— Nadim Kobeissi (@kaepora) &lt;a data-datetime="2012-11-06T17:55:05+00:00" href="https://twitter.com/kaepora/status/265874962101981184"&gt;November 6, 2012&lt;/a&gt;&lt;/blockquote&gt;
&lt;script charset="utf-8" src="//platform.twitter.com/widgets.js"&gt;&lt;/script&gt;&lt;br /&gt;
And is usually followed by the whole world telling Nadim he's being a jerk. Eventually a tech reporter notices the fracas and chimes in to tell us the &lt;i&gt;whole Infosec community&lt;/i&gt; is a bunch of jerks:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class="twitter-tweet"&gt;
This &lt;a href="http://t.co/PaDsM6D7" title="http://twitter.com/marshray/status/266295895878942720"&gt;twitter.com/marshray/statu…&lt;/a&gt; is exactly the kind of thing that makes a community look juvenile, petty and not ready for primetime.&lt;br /&gt;
— Quinn Norton (@quinnnorton) &lt;a data-datetime="2012-11-07T23:43:03+00:00" href="https://twitter.com/quinnnorton/status/266324917400768512"&gt;November 7, 2012&lt;/a&gt;&lt;/blockquote&gt;
&lt;script charset="utf-8" src="//platform.twitter.com/widgets.js"&gt;&lt;/script&gt;

&lt;br /&gt;
And the cycle repeats, without anyone having actually learned much at all.&amp;nbsp;(Really, it's enough to make you think&amp;nbsp;Twitter &lt;i&gt;isn't&lt;/i&gt;&amp;nbsp;the right place to get your Infosec news.)&lt;br /&gt;
&lt;br /&gt;
Now, as unhelpful as all this is, maybe we can make lemonade and let all of this serve as a teaching moment. For one thing, it gives us a (wonky) chance to learn a little bit about this ZRTP protocol that so many people seem to be using.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Overview of ZRTP&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The ZRTP protocol is fully laid out in &lt;a href="http://zfone.com/docs/ietf/rfc6189bis.html"&gt;RFC 6189&lt;/a&gt;. This is one of the more confusing&amp;nbsp;specs I've read&amp;nbsp;-- partly because the critical information is spread out across so many different sections, and partly because ZRTP seems determined to address every possible attack &lt;i&gt;simultaneously.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Fortunately the Intro does a good job of telling us what the protocol's up to:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: verdana, charcoal, helvetica, arial, sans-serif; font-size: small; margin-left: 2em; margin-right: 2em;"&gt;
ZRTP is a key agreement protocol that performs a Diffie-Hellman key exchange during call setup in the media path and is transported over the same port as the&amp;nbsp;&lt;a class="info" href="http://zfone.com/docs/ietf/rfc6189.html#RFC3550" style="color: #663333; font-weight: bold; position: relative; text-decoration: initial; z-index: 24;"&gt;Real-time Transport Protocol (RTP)&lt;/a&gt;&amp;nbsp;media stream which has been established using a signaling protocol such as&amp;nbsp;&lt;a class="info" href="http://zfone.com/docs/ietf/rfc6189.html#RFC3261" style="color: #663333; font-weight: bold; position: relative; text-decoration: initial; z-index: 24;"&gt;Session Initiation Protocol (SIP)&lt;/a&gt;. This generates a shared secret, which is then used to generate keys and salt for a&amp;nbsp;&lt;a class="info" href="http://zfone.com/docs/ietf/rfc6189.html#RFC3711" style="color: #663333; font-weight: bold; position: relative; text-decoration: initial; z-index: 24;"&gt;Secure RTP (SRTP)&lt;/a&gt;&amp;nbsp;session.&lt;/div&gt;
&lt;div style="font-family: verdana, charcoal, helvetica, arial, sans-serif; font-size: small; margin-left: 2em; margin-right: 2em;"&gt;
&lt;br /&gt;&lt;/div&gt;
So: simple enough. ZRTP lets us establish keys over an insecure channel using&amp;nbsp;&lt;a href="http://www.rsa.com/rsalabs/node.asp?id=2248"&gt;Diffie-Hellman&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
However we all know that Diffie-Hellman isn't secure against active (Man-in-the-Middle) attacks. Normally we prevent these by &lt;i&gt;signing&lt;/i&gt; Diffie-Hellman messages using keys distributed via a &lt;a href="http://en.wikipedia.org/wiki/Public-key_infrastructure"&gt;PKI&lt;/a&gt;. ZRTP is having none of it:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="background-color: white; font-family: verdana, charcoal, helvetica, arial, sans-serif; font-size: x-small;"&gt;Although it uses a public key algorithm, [ZRTP] does not rely on a public key infrastructure (PKI) ...&lt;/span&gt;&lt;span style="background-color: white; font-family: verdana, charcoal, helvetica, arial, sans-serif; font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: verdana, charcoal, helvetica, arial, sans-serif; font-size: x-small;"&gt;&lt;b&gt;[ZRTP]&amp;nbsp;allows the detection of man-in-the-middle (MiTM) attacks by displaying a short authentication string (SAS) for the users to read and verbally compare over the phone&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: verdana, charcoal, helvetica, arial, sans-serif; font-size: x-small;"&gt;&lt;b&gt;.&lt;/b&gt; ...&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: verdana, charcoal, helvetica, arial, sans-serif; font-size: x-small;"&gt;But even if the users are too lazy to bother with short authentication strings, we still get reasonable authentication against a MiTM attack, based on a form of key continuity. &lt;b&gt;It does this by caching some key material to use in the next call, to be mixed in with the next call's DH shared secret, giving it key continuity properties analogous to Secure SHell (SSH)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: verdana, charcoal, helvetica, arial, sans-serif; font-size: x-small;"&gt;.&lt;/span&gt;&lt;/blockquote&gt;
So our protection is twofold: &lt;i&gt;(1)&lt;/i&gt;&amp;nbsp;every time we establish a connection with some remote party, we can verbally compare a "short authentication string" (SAS) to ensure that we've both agreed on the same key. Assuming that our attacker &lt;i&gt;isn't&lt;/i&gt;&amp;nbsp;a voice actor, this should let us easily detect a typical MiTM. And just in case we're too lazy to bother with this, even completing one 'un-attacked'&amp;nbsp;connection leaves us with &lt;i&gt;(2)&amp;nbsp;&lt;/i&gt;a long-term shared secret that we can use to validate future connection attempts.&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="https://silentcircle.com/static/faq/img/sp16.1bf65e9ed803.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="200" src="https://silentcircle.com/static/faq/img/sp16.1bf65e9ed803.jpg" width="133" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;The SilentCircle authentication string prevents MiTM. But is it trying to tell you something? (&lt;a href="https://silentcircle.com/web/faq/"&gt;source&lt;/a&gt;)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
So is this a reasonable model? Well, you can draw your own conclusions -- but it works fine for me. Moreover, I'm willing to accept just about any assumption that allows us to &lt;i&gt;not&lt;/i&gt;&amp;nbsp;think about the '&lt;a href="http://seclab.stanford.edu/pcl/cs259/WWW06/projects/project05/05-Writeup.pdf"&gt;&lt;span id="goog_1009500742"&gt;&lt;/span&gt;Bill Clinton'&lt;span id="goog_1009500743"&gt;&lt;/span&gt;&lt;/a&gt;&amp;nbsp;or '&lt;a href="http://news.discovery.com/tech/silent-circle-encrypted-voice-video-calling-texting-121030.html"&gt;Rich Little attacks&lt;/a&gt;'. So let's just assume that this voice thing works... and move on to the interesting bits.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;The Guts of the Protocol&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
ZRTP is an interaction between two parties, defined as an Initiator and a Responder.&amp;nbsp;This figure from the spec illustrates the flow of a typical transaction:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-C7VeqjXiznI/UK-6FSsmIJI/AAAAAAAAAPc/42UgQhi5eGY/s1600/zrtp_overview.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-C7VeqjXiznI/UK-6FSsmIJI/AAAAAAAAAPc/42UgQhi5eGY/s320/zrtp_overview.png" width="281" /&gt;&lt;/a&gt;&lt;/div&gt;
Note that the identity of the party acting as the Initiator is determined &lt;i&gt;during&lt;/i&gt;&amp;nbsp;the protocol run -- it's the one that sends the Commit message (F5).&amp;nbsp;The protocol breaks down into roughly four phases:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;Discovery and protocol negotiation&amp;nbsp;&lt;/b&gt;(F1-F4), in which the parties start up a protocol transaction and agree on a supported ZRTP version and ciphersuites.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Diffie-Hellman key establishment&lt;/b&gt; (F5-F7). This is almost 'missionary position' Diffie-Hellman, with one exception (the F5 message), which we'll talk more about in a second.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Key confirmation &lt;/b&gt;(F8-F10), in which the parties verify that they've agreed on the same key.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Secure communication.&lt;/b&gt;&amp;nbsp;That's the last section, labeled "SRTP begins".&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;i&gt;&lt;u&gt;Discovery and Protocol Negotiation&lt;/u&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Messages F1-F4 are responsible for setting up a ZRTP connection. This stuff is (almost) entirely non-cryptographic, which means &lt;i&gt;this&lt;/i&gt; is the part of the protocol where stuff is most likely to go wrong.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Let me explain: prior to completing the Diffie-Hellman key exchange in messages F5-F7, we can't assume that Alice or Bob share a cryptographic key yet. Without a key, they can't authenticate their messages -- at least not until &lt;i&gt;after&lt;/i&gt;&amp;nbsp;the Diffie-Hellman transaction is complete. That means an attacker can potentially re-write any portion of those messages&lt;i&gt;&amp;nbsp;&lt;/i&gt;and get away with it. At least for a while.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So what's in those messages? Well, &lt;a href="http://zfone.com/docs/ietf/rfc6189.html#HelloMsg"&gt;just a couple of small things&lt;/a&gt;:&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;A 4-character string containing the version of the ZRTP protocol.&lt;/li&gt;
&lt;li&gt;A Client Identifier string (cid), which is 4 words long and identifies the vendor and release of the ZRTP software.&lt;/li&gt;
&lt;li&gt;The 96-bit-long unique identifier for the ZRTP endpoint (ZID).&lt;/li&gt;
&lt;li&gt;A&amp;nbsp;Signature-capable flag (S) indicates this Hello message is sent from a ZRTP endpoint which is able to parse and verify digital signatures.&lt;/li&gt;
&lt;li&gt;The MiTM flag (M), which has something to do with PBXes.&lt;/li&gt;
&lt;li&gt;The Passive flag (P), which is set to true if and only if this Hello message is sent from a device that is configured to always act as a Responder (not Initiator).&lt;/li&gt;
&lt;li&gt;The supported Hash algorithms, Cipher algorithms (including Diffie-Hellman handshake type),&amp;nbsp;SRTP Auth Tag Types, Key Agreement Types, and SAS Types.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Which is to say: quite a lot! And some of these values are pretty critical. Changing the version number might allow an attacker to roll us back to an earlier (potentially insecure) version of the protocol. Changing the ciphers might (theoretically) allow us to switch to a weaker set of Diffie-Hellman parameters, hash function or Short Authentication String algorithm.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
At this point a careful protocol reviewer will be asking 'what does ZRTP does to prevent this?' ZRTP gives us several answers, both good and not-so-good:&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;On the bad side,&amp;nbsp;ZRTP allows us to send a &lt;i&gt;hash&lt;/i&gt;&amp;nbsp;of the Initiator's Hello message through a separate integrity-protected channel, &lt;i&gt;e.g.,&lt;/i&gt;&amp;nbsp;&lt;a href="http://www.blogger.com/"&gt;&lt;span id="goog_1009500805"&gt;&lt;/span&gt;secure SIP&lt;/a&gt;. (This protection gets folded on into later messages using a crazy hash-chain and MAC construction.) In general I'm not a fan of this protection -- it's like saying a life-preserver will keep you alive... as long as you have a separate lifeboat to wear it in. If you have a secure channel in the first place, &lt;i&gt;why are you using ZRTP&lt;/i&gt;? (Even the ZRTP authors seem a &lt;a href="http://zfone.com/docs/ietf/rfc6189.html#LeveragingIntegrityProtectedSIP"&gt;little sheepish&lt;/a&gt; about this one.)&lt;/li&gt;
&lt;li&gt;On the confusing side, Hello messages are MACed using a MAC key that isn't revealed until the subsequent&amp;nbsp;message&amp;nbsp;(&lt;i&gt;e.g.,&lt;/i&gt; Commit). In theory this means you can't forge a MAC until the Commit message has been delivered. In practice, an MiTM attacker can just capture both the Initiator Hello (F3)&amp;nbsp;&lt;i&gt;and &lt;/i&gt;the Commit message (F5), learn the MAC key, and then forge the Hello message to its heart's content... before sending both messages on to the recipient. This entire mechanism baffles me. The less said about it the better.&lt;/li&gt;
&lt;li&gt;A more reasonable protection comes from the key derivation process. In a later phase of the protocol, both ZRTP parties compute a hash over the handshake messages. This value is folded into the Key Derivation Function (KDF) that's ultimately to compute session keys. The hashing process looks like:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt; &amp;nbsp;total_hash = hash(Hello of responder || Commit ||&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DHPart1 || DHPart2)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
But... zounds! One important message is missing: the Initiator's Hello (F3). I can't for the life of me figure out why this message would be left out. And unless there's something really clever that I'm missing, this means an attacker&amp;nbsp;can tamper with the Initiator's Hello message&amp;nbsp;&lt;i&gt;without affecting the key at all&lt;/i&gt;.*&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
So is this a problem? Well, in theory it means you &lt;i&gt;could&lt;/i&gt;&amp;nbsp;roll back any field in the Initiator Hello message without detection. It's not exactly clear what &lt;i&gt;practical&lt;/i&gt;&amp;nbsp;benefit this would have. You could certainly modify the Diffie-Hellman parameters or ciphers to turn off advanced options like ECDH or 256-bit AES. Fortunately&amp;nbsp;ZRTP does not support '&lt;a href="http://www.carbonwind.net/blog/post/Random-SSLTLS-101%E2%80%93SSLTLS-version-rollbacks-and-browsers.aspx"&gt;export weakened&lt;/a&gt;' ciphers, so even the 'weak' options are pretty strong. &lt;strike&gt;Still:&amp;nbsp;this seems like a pretty big oversight, and possibly an unforced error.&lt;/strike&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
For the moment, let's file it under '&lt;i&gt;this protocol is really complicated&lt;/i&gt;' or '&lt;i&gt;don't analyze protocols at Thanksgiving&lt;/i&gt;'. At very least I think this could use a good explanation.&lt;br /&gt;
&lt;br /&gt;
(&lt;b&gt;Update 11/25:&lt;/b&gt;&amp;nbsp;After some back and forth, Moxie points out that the Hash, SAS and Cipher information is repeated in the Commit message [F5], so that should provide an extra layer of protection against rollback on those fields -- but not the other fields like version or signature capability. And of course, an implementation might have the Responder prune&amp;nbsp;&lt;i&gt;its&lt;/i&gt;&amp;nbsp;list of supported algorithms by basing it off the Initiator's list, which would be a big problem.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;u&gt;Diffie-Hellman Key Establishment&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
Assuming that the two parties have successfully completed the negotiation, the next phase of the protocol requires the two parties to establish a shared key. This is done using (&lt;i&gt;nearly)&lt;/i&gt; straight-up Diffie-Hellman. The parameters are negotiated in the previous phase, and are drawn from a list defined by&amp;nbsp;&lt;a href="http://tools.ietf.org/html/rfc3526"&gt;RFC3526&lt;/a&gt; and&amp;nbsp;&lt;a href="http://csrc.nist.gov/publications/nistpubs/800-56A/SP800-56A_Revision1_Mar08-2007.pdf"&gt;a NIST publication&lt;/a&gt;.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;Normally&lt;/i&gt;&amp;nbsp;a Diffie-Hellman agreement would work something like this (all exponentiation is in a group&lt;i&gt;, i.e.,&lt;/i&gt;&amp;nbsp;mod &lt;i&gt;p&lt;/i&gt;):&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;Alice picks &lt;i&gt;a&lt;/i&gt;, sends &lt;b&gt;g^a &lt;/b&gt;(message F6).&lt;/li&gt;
&lt;li&gt;Bob picks &lt;i&gt;b&lt;/i&gt;, sends &lt;b&gt;g^b &lt;/b&gt;(message F7).&lt;/li&gt;
&lt;li&gt;Both parties compute &lt;b&gt;g^ab&lt;/b&gt;&amp;nbsp;and HMAC this value together with lots of other things to derive a session key &lt;b&gt;s0&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;The parties further compute a 32-bit Short Authentication value as a function of &lt;b&gt;s0&lt;/b&gt;, convert this into a human-readable Short Authentication String (SAS), and compare notes verbally.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div&gt;
The problem with the traditional Diffie-Hellman protocol is that it doesn't play nice with the Short Authentication String mechanism. Say an MiTM attacker Eve has established a connection with Bob, during which they agreed on SAS value&amp;nbsp;&lt;b&gt;X&lt;/b&gt;. Eve now tries to run the Diffie-Hellman protocol with Alice. Once Alice sends her choice of&amp;nbsp;&lt;b&gt;g^a,&lt;/b&gt;&amp;nbsp;Eve can now run an offline attack, trying&amp;nbsp;&lt;i&gt;millions &lt;/i&gt;of candidate &lt;i&gt;b&lt;/i&gt;&amp;nbsp;values&amp;nbsp;until she gets one such that the derived SAS between her and Alice is also&amp;nbsp;&lt;b&gt;X.&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
This is a problem, since Alice and Bob will now see the same SAS, even though Eve is duping them.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
ZRTP deals with this by forcing one party (Bob) to &lt;i&gt;commit&lt;/i&gt;&amp;nbsp;to&amp;nbsp;&lt;b&gt;g^b &lt;/b&gt;before the protocol even begins. Thus, in ZRTP Bob picks &lt;b&gt;b&lt;/b&gt; and sends H(&lt;b&gt;g^b)&amp;nbsp;&lt;/b&gt;&lt;i&gt;before&lt;/i&gt; Alice sends her first message. This 'commitment' is transmitted in the "Commit" message (F5).&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This prevents Bob from&amp;nbsp;'changing his mind' after seeing Alice's input, and thus&amp;nbsp;the remote party has at most one chance to get a colliding SAS per protocol run. Which means Eve is (probably) out of luck.**&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;u&gt;Key Confirmation &amp;amp; Secure Communication&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The rest of the protocol does all of the stuff you expect from a key agreement protocol: the two parties, having successfully completed a Diffie-Hellman exchange, now derive a session key by HMACing together the value &lt;b&gt;g^ab&lt;/b&gt;&amp;nbsp;with &lt;span style="font-family: Courier New, Courier, monospace;"&gt;total_hash&lt;/span&gt; and any pre-shared secrets they hold from older sessions. If all goes well, the result &lt;i&gt;should&lt;/i&gt;&amp;nbsp;be a strong secret that only the two parties know -- or an SAS mismatch that reveals Eve's tampering.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
From this point it's all downhill, or it should be at least. Both parties now have a shared secret that they can use to derive secure encryption and &lt;a href="http://en.wikipedia.org/wiki/Message_authentication_code"&gt;MAC&lt;/a&gt; keys. They now construct "Confirm" messages (F8, F9), which they encrypt and (partially) MAC. In principle this exchange gives both parties a chance to detect a mismatch in keys and call the whole thing off.&lt;br /&gt;
&lt;br /&gt;
There's not a ton to say about this section except for one detail: the MAC on these messages is computed &lt;i&gt;only&lt;/i&gt;&amp;nbsp;over the encrypted portion (between the == signs below), and leaves out critical details like the &lt;a href="http://en.wikipedia.org/wiki/Initialization_vector"&gt;Initialization Vector&lt;/a&gt; that's used to encrypt them: ***&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-Vp74HFxvZUw/ULDhXJMW2AI/AAAAAAAAAP8/fm12Mb2TrLk/s1600/zrtpconfirm.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="226" src="http://4.bp.blogspot.com/-Vp74HFxvZUw/ULDhXJMW2AI/AAAAAAAAAP8/fm12Mb2TrLk/s320/zrtpconfirm.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Structure of a ZRTP "Confirm" message (&lt;a href="http://zfone.com/docs/ietf/rfc6189bis.html#ConfirmMsg"&gt;source&lt;/a&gt;).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
Once again it's not clear if there's any practical impact here, but at least &lt;i&gt;technically&lt;/i&gt;&amp;nbsp;speaking, someone could tamper with this IV and thus change the decryption of the message (specifically, the first 64 bits of H0). I have no idea if this matters -- or even if it's a real attack -- but in general it seems like the kind of thing you want to avoid. It's another example of a place where I just plain don't understand ZRTP.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I think it should be obvious at this point that I have no real point with this post -- I just love protocols. If you're still reading at this point, you must also love protocols... or else you did something &lt;i&gt;really wrong,&lt;/i&gt;&amp;nbsp;and reading this post is your punishment.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
ZRTP is a fun protocol to analyze, since it's a particularly complicated spec that deals with many use-cases at once. Plus it's an &lt;i&gt;old&lt;/i&gt;&amp;nbsp;protocol and it's been subjected to lots of analysis (including &lt;a href="http://infonomics-society.org/IJI/ProVerif%20Analysis%20of%20the%20ZRTP%20Protocol.pdf"&gt;analysis by robots&lt;/a&gt;). That's why I'm so surprised to see loose ends at this date, even if they're not particularly &lt;i&gt;useful&lt;/i&gt;&amp;nbsp;loose ends.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Regardless of the results, anyone who's interested in cryptography should try their hands at this from time to time. There are so many protocols that we rely on in our day-to-day existence, and far too few of these have really been poked at.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Notes:&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;* &lt;/i&gt;An &lt;a href="http://www.cs.utexas.edu/~shmat/shmat_csf07.pdf"&gt;older paper by Gupta and Shmatikov&lt;/a&gt; also notes the lack of authentication for ZID messages, and describes a clever attack that causes the peers to &lt;i&gt;not&lt;/i&gt;&amp;nbsp;detect mutually shared secrets. This seems to be fixed in later versions of the protocol, since the ZID values are now included in the Key Derivation Function. But not the rest of the fields in the Initiator Hello.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
*** This is another place where the specification is a bit vague. It says that the MAC is computed over the "encrypted part of the message", but isn't entirely clear if the MAC is computed pre- or post- encryption. If it's pre- encryption this is a bit non-standard, but not a major concern.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/FzahyZVBfz0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/1761889473149623912/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/11/lets-talk-about-zrtp.html#comment-form" title="13 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/1761889473149623912?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/1761889473149623912?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/FzahyZVBfz0/lets-talk-about-zrtp.html" title="Let's talk about ZRTP" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-BweIMgiEJqY/ULDkTbcn_4I/AAAAAAAAAQM/S-ibvOfUrbA/s72-c/zooko-zrtp-h3-big.jpg" height="72" width="72" /><thr:total>13</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/11/lets-talk-about-zrtp.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkQARng-cSp7ImA9WhNSFEs.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-5111621697028429375</id><published>2012-10-26T19:21:00.000-07:00</published><updated>2012-10-28T16:52:27.659-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-28T16:52:27.659-07:00</app:edited><title>Attack of the week: Cross-VM side-channel attacks</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.outsourcing-center.com/wp-content/uploads/2012/01/cloud-future.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="177" src="http://www.outsourcing-center.com/wp-content/uploads/2012/01/cloud-future.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
It's been a busy week for crypto flaws. So busy in fact, that I'm totally overwhelmed and paralyzed trying to write about them. It's made blogging almost impossible.&lt;br /&gt;
&lt;br /&gt;
So let's just blast through it, then we can get to the subject I &lt;i&gt;actually&lt;/i&gt;&amp;nbsp;want to talk about.&lt;br /&gt;
&lt;br /&gt;
First, at the start of the week we received news that many Android applications and a few (critical!) &lt;a href="http://aws.amazon.com/sdkforjava/"&gt;Java libraries&lt;/a&gt; simply &lt;a href="http://arstechnica.com/security/2012/10/android-apps-expose-passwords-e-mail-and-more/"&gt;don't validate certificates&lt;/a&gt;&amp;nbsp;on TLS/SSL connections. This is disastrous,&amp;nbsp;embarrassing&amp;nbsp;and stupid, since lack of certificate verification makes TLS trivially &lt;a href="http://www.cs.utexas.edu/~shmat/shmat_ccs12.pdf"&gt;vulnerable to man-in-the-middle attacks&lt;/a&gt;. I&amp;nbsp;&lt;i&gt;was&lt;/i&gt;&amp;nbsp;going to say something shrill and over-the-top about all of this, but turns out that&amp;nbsp;&lt;a href="http://threatpost.com/en_us/blogs/ssl-vulnerabilities-found-critical-non-browser-software-packages-102512"&gt;Threatpost&lt;/a&gt;&amp;nbsp;has already totally beaten me there with this synopsis:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;The death knell for SSL is getting louder.&lt;/i&gt;&lt;/blockquote&gt;
Yes indeed, Threatpost. Thank you for making me feel better.&lt;br /&gt;
&lt;br /&gt;
In other news, we learned that major email providers -- who &lt;i&gt;should&lt;/i&gt; remain nameless, &lt;a href="http://www.wired.com/threatlevel/2012/10/dkim-vulnerability-widespread/"&gt;but are actually Microsoft, Google, Apple, Yahoo and &lt;i&gt;everyone else&lt;/i&gt;&lt;/a&gt; --&amp;nbsp;have been competing to see who can deploy the shortest RSA key for&amp;nbsp;&lt;a href="http://www.dkim.org/"&gt;DomainKeys Identified Mail&lt;/a&gt; (DKIM). I'm told that Yahoo was ahead with 384 bits, but Microsoft had a research team working on a 22-bit key and&amp;nbsp;Apple had abandoned keys altogether, opting for a simple note from Tim Cook asserting that any invalid email messages were probably the recipient's fault. (Ba-dum-tschch.)&lt;br /&gt;
&lt;br /&gt;
So that's the headline news, and I don't want to write about any of it.&lt;br /&gt;
&lt;br /&gt;
What I &lt;i&gt;do&lt;/i&gt; want to write about is a result that's gotten a lot less attention -- mostly because it's subtle, falls into the category of '&lt;i&gt;things we thought of knew about, but didn't explore&lt;/i&gt;'&lt;i&gt;&amp;nbsp;&lt;/i&gt;and because it involves Hidden Markov models -- which are to tech reporters as raw garlic and silver are to vampires.&lt;br /&gt;
&lt;br /&gt;
This new&amp;nbsp;&lt;a href="http://www.cs.unc.edu/~reiter/papers/2012/CCS.pdf"&gt;result is by Zhang, Juels, Reiter and Ristenpart&lt;/a&gt;, and it&amp;nbsp;appeared in the ACM CCS conference just a few weeks ago, and it deals&amp;nbsp;with something very relevant to the way we build modern systems. Specifically, if we're going to go and stick all of cryptographic services in cloud-based VMs, how secure can we possibly expect them to be?&lt;br /&gt;
&lt;br /&gt;
The answer is: unfortunately, not very. To get into the details I'm going to use the standard 'fun' question/answer format I usually save for these kinds of attacks.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;Why would I put my cryptography in a VM anyway?&lt;/b&gt;&lt;/blockquote&gt;
In case you missed it, &lt;a href="https://www.google.com/search?q=%22the+cloud+is+the+future%22"&gt;the cloud is our future&lt;/a&gt;. The days of running our own cranky hardware and dealing with problems like power-supply faults are long gone. If you're deploying a new service, there's a good chance it'll be at least partly cloud-based. There's a decent chance it will be &lt;i&gt;entirely&lt;/i&gt;&amp;nbsp;cloud-based.&lt;br /&gt;
&lt;br /&gt;
Take Instagram, for instance. Their entire $1bn service &lt;a href="http://instagram-engineering.tumblr.com/post/13649370142/what-powers-instagram-hundreds-of-instances-dozens-of"&gt;runs on a few hundred cleverly-managed EC2 instances&lt;/a&gt;. While Instagram itself isn't exactly a security product, they do use TLS and SSH (presumably on the instances themselves), and this implies public key crypto and the use of &lt;i&gt;secret &lt;/i&gt;keys.&lt;br /&gt;
&lt;br /&gt;
Now this shouldn't be a problem, but VM instances often share physical hardware with other instances, and since EC2 is a public service, those co-resident VMs may not be entirely friendly. The major threat here is, of course, software vulnerabilities -- things that can let an attacker&amp;nbsp;&lt;a href="http://www.darkreading.com/security-services/167801101/security/application-security/217701908/hacking-tool-lets-a-vm-break-out-and-attack-its-host.html"&gt;break out &lt;/a&gt;of one VM and into another. But even if you perfect the software, there's another more insidious threat: namely, that the attacker VM instance could be able to run a &lt;a href="http://en.wikipedia.org/wiki/Side_channel_attack"&gt;side-channel attack&lt;/a&gt; on the co-resident VM.&lt;br /&gt;
&lt;br /&gt;
This threat has long been discussed, and security people generally agree that it's a concern. But actually &lt;i&gt;implementing&lt;/i&gt;&amp;nbsp;such an attack has proven surprisingly difficult. This is because real&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Hypervisor"&gt;hypervisors&lt;/a&gt; put a lot of fluff between the attacking process and the bare metal of the server. Different VMs often run on different cores. Moreover, since each VM has an &lt;i&gt;entire OS &lt;/i&gt;running inside of it, there's tons of noise.&lt;br /&gt;
&lt;br /&gt;
In fact, there's been plenty of reason to wonder if these attacks are simply the product of security researchers' fevered imaginations, or if something we need to worry about.&amp;nbsp;What Zhang, Juels, Reiter and Ristenpart tell us is: &lt;i&gt;yes, we should worry&lt;/i&gt;. And oh boy, do they do it in a nifty way.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;So what is it and how does it work?&lt;/b&gt;&lt;/blockquote&gt;
The new result focuses specifically on the &lt;a href="http://en.wikipedia.org/wiki/Xen"&gt;Xen&lt;/a&gt; Hypervisor, which is the one actually used by services like &lt;a href="http://aws.amazon.com/ec2/"&gt;Amazon EC2&lt;/a&gt;. Although the attack was not implemented in EC2 itself,&amp;nbsp;it focuses on similar hardware: multi-core servers with &lt;a href="http://en.wikipedia.org/wiki/Simultaneous_multithreading"&gt;SMT&lt;/a&gt; turned &lt;i&gt;off&lt;/i&gt;. The threat model assumes that the attacker and victim VM are co-resident on the machine, and that the victim is decrypting an &lt;a href="http://en.wikipedia.org/wiki/ElGamal_encryption"&gt;Elgamal ciphertext&lt;/a&gt; using&amp;nbsp;&lt;a href="http://www.gnu.org/software/libgcrypt/"&gt;libgcrypt v.1.5.0.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Now, Elgamal encryption is a great example for side-channel attacks, since it's implemented by taking a portion of the ciphertext, which we'll call &lt;i&gt;x, &lt;/i&gt;and computing x&lt;i&gt;^e&lt;/i&gt;&amp;nbsp;&lt;i&gt;mod N&lt;/i&gt;, where &lt;i&gt;e&lt;/i&gt;&amp;nbsp;is the secret key and &lt;i&gt;N&lt;/i&gt;&amp;nbsp;is (typically) a prime number&lt;i&gt;.&lt;/i&gt;&amp;nbsp;This exponentiation is implemented via the '&lt;i&gt;&lt;a href="http://en.wikipedia.org/wiki/Exponentiation_by_squaring"&gt;square and multiply&lt;/a&gt;&lt;/i&gt;' algorithm, shown in the figure below:&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-fZ0guqNN58k/UIq2bdpRgAI/AAAAAAAAAO4/mh2HaaFGtJo/s1600/squaremultiply.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="165" src="http://2.bp.blogspot.com/-fZ0guqNN58k/UIq2bdpRgAI/AAAAAAAAAO4/mh2HaaFGtJo/s200/squaremultiply.png" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Square and multiply algorithm (source: &lt;a href="http://www.cs.unc.edu/~reiter/papers/2012/CCS.pdf"&gt;&lt;i&gt;Zhang &lt;/i&gt;et al&lt;/a&gt;.)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
The first thing you notice about square-and-multiply is that its operation depends fundamentally on the bits of the secret key. If the &lt;i&gt;i&lt;/i&gt;th bit of e&lt;i&gt;&amp;nbsp;&lt;/i&gt;is 1, the steps labeled (M) and (R) are conducted. If that bit is 0, they aren't. The bits of the key results in a distinctive set of computations that can be detected if the attacking VM is able to precisely monitor the hardware state.&lt;br /&gt;
&lt;br /&gt;
Now, side-channel attacks on square-and-multiply are &lt;i&gt;not&lt;/i&gt;&amp;nbsp;new. They date back at least to&amp;nbsp;&lt;a href="http://www.cryptography.com/public/pdf/TimingAttacks.pdf"&gt;Paul Kocher's observations&lt;/a&gt;&amp;nbsp;in the mid-to-late 90s using power and operating time as a channel, and they've been repeatedly optimized as technology advances. More &lt;a href="http://css.csail.mit.edu/6.858/2012/readings/ht-cache.pdf"&gt;recent attacks&lt;/a&gt; have exploited &lt;i&gt;cache misses &lt;/i&gt;in&amp;nbsp;a&amp;nbsp;shared processor cache (typical in &lt;a href="http://en.wikipedia.org/wiki/Hyper-threading"&gt;hyper-threading&lt;/a&gt; environments) as a means by which a single process can monitor the execution of another one.&lt;br /&gt;
&lt;br /&gt;
However, while these attacks have worked from one &lt;i&gt;process&lt;/i&gt;&amp;nbsp;to another, they've never been applied to the full Xen VM setting. This is a pretty challenging problem for a variety of reasons, including::&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;The difficulty of getting the attacking process to &lt;i&gt;run&lt;/i&gt;&amp;nbsp;frequently enough to take precise measurements.&lt;/li&gt;
&lt;li&gt;The problem that VCPUs can be assigned to different cores, or irrelevant VCPUs can be assigned to the same core.&lt;/li&gt;
&lt;li&gt;Noisy measurements that give only &lt;i&gt;probabilistic&lt;/i&gt; answers about which operations occurred on the &amp;nbsp;target process.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
And so on and so forth. The challenge in this paper is to overcome all that nonsense and still recover useful information from the attacked VM.&amp;nbsp;&lt;/div&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;So what's the basic idea?&lt;/b&gt;&lt;/blockquote&gt;
At a fundamental level, the attack in this paper is quite similar to &lt;a href="http://css.csail.mit.edu/6.858/2012/readings/ht-cache.pdf"&gt;previous attacks&lt;/a&gt; that worked only across processes. The attacking VM first '&lt;i&gt;primes&lt;/i&gt;' the L1 instruction cache by allocating continuous memory pages, then executing a series of instructions designed to load the cache with cache-line-sized blocks it controls.&lt;br /&gt;
&lt;br /&gt;
The attacker then gives up execution and hopes that the target VM will run next on the same core -- and moreover, that the target is in the process of running the square-and-multiply operation. If it is, the target will cause a few cache-line-sized blocks of the attacker's instructions to be evicted from the cache. &lt;i&gt;Which&lt;/i&gt;&amp;nbsp;blocks are evicted is highly dependent on the operations that the attacker conducts.&lt;br /&gt;
&lt;br /&gt;
To see what happened, the attacking VM must recover control as quickly as possible. It then&amp;nbsp;'&lt;i&gt;probes&lt;/i&gt;' to see which blocks have been evicted from the cache set. (This is done by executing the same instructions and timing the results. If a given block has been evicted from the cache, execution will result in a cache miss and a measurable delay.) By compiling a list of which blocks were missing, the attacker gains insight into which instructions may have been executed while the target VM was running.&lt;br /&gt;
&lt;br /&gt;
A big challenge for the attacker is the need to regain control quickly. Wait too long and all kinds of things will happen -- the state of the cache won't give any useful information.&lt;br /&gt;
&lt;br /&gt;
Normally Xen doesn't allow VCPUs to rapidly regain control, but there are a few exceptions: Xen gives high priority to Virtual CPUs (VCPUs) that receive an interrupt. The authors were able to exploit this by running a 2-VCPU VM, where the second VCPU's&amp;nbsp;only job is to issue &lt;a href="http://en.wikipedia.org/wiki/Inter-processor_interrupt"&gt;Inter-Processor Interrupts&lt;/a&gt; (IPIs) in an effort to get the first VCPU back in control as quickly as possible. Using this approach they were able to get back in the saddle within about 16 microseconds -- an eternity in processing time, but enough to give useful information.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;But isn't that data noisy as hell? And fragmented?&lt;/b&gt;&lt;/blockquote&gt;
Yes. The challenge here is that the attacking VM has no control over &lt;i&gt;where&lt;/i&gt;&amp;nbsp;in the computation it will jump in. It could get just a small fragment of the square-and-multiply operation (which is hundreds or thousands operations long), it could jump into the OS kernel, it could even get the wrong VM, thanks to the fact that they can run on any core. Plus the data could be pretty noisy.&lt;br /&gt;
&lt;br /&gt;
The solution to these problems is what's so nifty about this paper. First, they don't just monitor one execution -- they assume that the device is constantly decrypting different ciphertexts, all with the same key. This is a pretty reasonable assumption for something like an SSL web server.&lt;br /&gt;
&lt;br /&gt;
Next, they use machine learning techniques to identify which of the many possible instruction sequences are associated with particular cache measurements. This requires the researchers to train the algorithm beforehand on the target hardware, having the target VCPU conduct of square, multiply and modular reduce calls in order build a training model. During the attack, the data was further processed using a Hidden Markov Model to eliminate errors and bogus measurements from non-cryptographic processes.&lt;br /&gt;
&lt;br /&gt;
Even after all this work, the attacker winds up with thousands of fragments, some of which contain errors or low-confidence results. These can be compared against each other to reduce errors, then stitched together to recover the key itself. Fortunately this is a problem that's been solved in many other domains (most famously: &lt;a href="http://www.liacs.nl/~hoogeboo/mcb/mapp.pdf"&gt;DNA sequencing&lt;/a&gt;), and the techniques used here are quite similar.&lt;br /&gt;
&lt;br /&gt;
A good way to illustrate the process is to present a totally made-up example, in which six fragments are reconstructed to form a single spanning sequence:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;S1: SRSRMRSR&lt;b&gt;MRSRSR&lt;/b&gt;SMR&lt;br /&gt;S2: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;MRSRSR&lt;/b&gt;SRMR**SR&lt;b&gt;MRSR&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;S3: &amp;nbsp; &amp;nbsp; &amp;nbsp;SR&lt;b&gt;MRSRSR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;S4: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;MRSRSRSR&lt;/b&gt;**SR&lt;b&gt;MRSR&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;S5:&lt;/span&gt;&lt;b style="font-family: 'Courier New', Courier, monospace;"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MR*R&lt;/b&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;SRMRSRMRSR&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;S6: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;MR&lt;/b&gt;SRSR&lt;b&gt;MRSRSRSR&lt;/b&gt;MR&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; ------------------------------------------------&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;SRSRMRSR&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;MRSRSR&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;SMR&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;SRSR&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;MRSRSRSR&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;MRSR&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;MRSR&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;SRMRSRMRSR&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This is obviously a huge simplification of a very neat (and complex) process that's very well described in the paper. And if all this technical stuff is too much for you: it's basically like the scene in &lt;a href="http://en.wikipedia.org/wiki/Argo_(2012_film)"&gt;Argo&lt;/a&gt; where the little kids reconstructed the shredded photos of the embassy workers. Just without the kids. Or the photos.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;So does it actually work?&lt;/b&gt;&lt;/blockquote&gt;
It would be a hell of a bad paper if it didn't.&lt;br /&gt;
&lt;br /&gt;
With everything in place, the researchers applied their attack against a 4096-bit Elgamal public key, which (due to an optimization in libgcrypt) actually has a&amp;nbsp;457-bit private key &lt;i&gt;e&lt;/i&gt;. After several hours of data collection, they were able to obtain about 1000 key-related fragments, of which 330 turned out to be long enough to be useful for key reconstruction. These allowed the attackers to reconstruct the full key with only a few missing bits, and those they were able to guess using brute force.&lt;br /&gt;
&lt;br /&gt;
And that, as they say, is the ballgame.&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-pcDp1AWgSIk/UIs1iL6tFBI/AAAAAAAAAPI/xUDy3ipnIFE/s1600/results.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="128" src="http://1.bp.blogspot.com/-pcDp1AWgSIk/UIs1iL6tFBI/AAAAAAAAAPI/xUDy3ipnIFE/s400/results.png" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Left: Fragment size vs. number of fragments recovered, Right: sequence accuracy as a function of fragments in a batch.&amp;nbsp;(source:&amp;nbsp;&lt;a href="http://www.cs.unc.edu/~reiter/papers/2012/CCS.pdf"&gt;&lt;i&gt;Zhang&amp;nbsp;&lt;/i&gt;et al&lt;/a&gt;.)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;Oh my god, we're all going to die.&lt;/b&gt;&lt;/blockquote&gt;
I would note that this isn't actually a question. But before you start freaking out and pulling down your cloud VMs, a few points of order.&lt;br /&gt;
&lt;br /&gt;
First: there's a reason these researchers did this with libgcrypt and Elgamal, and not, say OpenSSL and RSA (which would be a &lt;i&gt;whole&lt;/i&gt;&amp;nbsp;lot more useful). That's because libgcrypt's Elgamal implementation is the cryptographic equivalent of a 1984 Stanley lawnmower engine -- it uses textbook&amp;nbsp;square-and-multiply with no ugly optimizations to get in the way.&amp;nbsp;OpenSSL RSA decryption, on the other hand, is more like a 2012 Audi turbo-diesel:&amp;nbsp;it&amp;nbsp;uses windowing and &lt;a href="http://en.wikipedia.org/wiki/RSA_(algorithm)#Using_the_Chinese_remainder_algorithm"&gt;CRT&lt;/a&gt; and blinding and two different types of multiplication, all of which make it a &lt;i&gt;real&lt;/i&gt;&amp;nbsp;pain in the butt to deal with.&lt;br /&gt;
&lt;br /&gt;
Secondly, this attack requires a perfect set of conditions. As proposed it works only works with two VMs, and requires specific training on the target hardware. This doesn't mean that the attack isn't &lt;i&gt;viable&lt;/i&gt; (especially since cloud services probably do &lt;i&gt;use&lt;/i&gt; lots of identical hardware), but it does mean that messiness -- the kind you get in real cloud deployments -- is going to be more of an obstacle than it seems.&lt;br /&gt;
&lt;br /&gt;
One last thing worth mentioning is that before you can attack a VM, you have to get your attack VM onto the same physical hardware with your target. This seems like a pretty big challenge. Unfortunately, some&amp;nbsp;&lt;a href="http://rump2009.cr.yp.to/8d9cebc9ad358331fcde611bf45f735d.pdf"&gt;slightly older research&lt;/a&gt; indicates that this is actually very feasible in existing cloud deployments. In fact, for only a few dollars, researchers were able to co-locate&amp;nbsp;themselves&amp;nbsp;with a given target VM with about 40% probability.&lt;br /&gt;
&lt;br /&gt;
In the short term, you certainly shouldn't panic about this, especially given how elaborate the attack is. But it does indicate that we should be thinking very hard about side-channel attacks, and considering how we can harden our systems and VMMs to be sure they aren't going to happen to us.&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/85OJ7pylx3o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/5111621697028429375/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/10/attack-of-week-cross-vm-timing-attacks.html#comment-form" title="20 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/5111621697028429375?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/5111621697028429375?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/85OJ7pylx3o/attack-of-week-cross-vm-timing-attacks.html" title="Attack of the week: Cross-VM side-channel attacks" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-fZ0guqNN58k/UIq2bdpRgAI/AAAAAAAAAO4/mh2HaaFGtJo/s72-c/squaremultiply.png" height="72" width="72" /><thr:total>20</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/10/attack-of-week-cross-vm-timing-attacks.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0YCR386eip7ImA9WhNXE0o.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-2602160329753554751</id><published>2012-10-16T11:15:00.004-07:00</published><updated>2012-12-01T07:19:26.112-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-01T07:19:26.112-08:00</app:edited><title>The crypto dream</title><content type="html">&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://farm3.staticflickr.com/2136/2274252795_918bcffc01.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="150" src="http://farm3.staticflickr.com/2136/2274252795_918bcffc01.jpg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;(Credit: &lt;a href="http://www.flickr.com/photos/mattblaze/2274252795/sizes/m/in/photostream/"&gt;Matt Blaze/cc&lt;/a&gt;)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Arvind Narayanan just gave a fascinating talk at Princeton's Center for Information Technology Policy entitled '&lt;i&gt;&lt;a href="http://www.youtube.com/watch?v=dei2CH2aeLU"&gt;What Happened to the Crypto Dream?&lt;/a&gt;&lt;/i&gt;'. That link is to the video, which unfortunately you'll actually have to watch -- I have yet to find a transcript.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
From the moment I heard the title of Arvind's talk I was interested, since it asks an important question that &lt;i&gt;I&lt;/i&gt;&amp;nbsp;wanted a chance to answer. Specifically: what happened to the golden future of crypto?&amp;nbsp;You know, the future that folks like Phil Zimmermann offered us -- the one that would have powered the utopias of Neal Stephenson and the &lt;i&gt;dystopias &lt;/i&gt;of William Gibson (or do I have that backwards?) This was the future where&amp;nbsp;cryptography fundamentally altered the nature of society and communications and set us free in new and exciting ways.&lt;br /&gt;
&lt;br /&gt;
That future never quite arrived. Oh, mind you, the &lt;i&gt;technology&lt;/i&gt;&amp;nbsp;did -- right on schedule. We're living in a world where it's possible to &lt;a href="http://maps.google.com/maps?f=q&amp;amp;hl=en&amp;amp;geocode=&amp;amp;q=%E7%A7%8B%E8%91%89%E5%8E%9F&amp;amp;sll=35.787288,139.899119&amp;amp;sspn=0.007084,0.016522&amp;amp;layer=c&amp;amp;ie=UTF8&amp;amp;ll=35.699538,139.774407&amp;amp;spn=0.007092,0.016522&amp;amp;t=h&amp;amp;z=17&amp;amp;cbll=35.698171,139.771611&amp;amp;panoid=OgitUM-j0h5VmOTsLDi6Kw&amp;amp;cbp=1,244.24437299035372,,0,-19.7427652733119"&gt;visit Tokyo&lt;/a&gt; without ever leaving your bed, and where governments &lt;a href="http://en.wikipedia.org/wiki/Stuxnet"&gt;go to war with software&lt;/a&gt; rather than tanks. Yet in some ways the real future is more&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/The_Langoliers"&gt;Stephen King&lt;/a&gt; than William Gibson. The plane landed; nobody was on board.&lt;br /&gt;
&lt;br /&gt;
So what &lt;i&gt;did &lt;/i&gt;happen&amp;nbsp;to the crypto dream?&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Arvind gives us a bunch of great answers, and for the most part I agree with him. But we differ in a few places too. Most importantly, Arvind is a Princeton scholar who has been known to toss out terms like '&lt;i&gt;technological determinism'&lt;/i&gt;&lt;i&gt;.&amp;nbsp;&lt;/i&gt;Me,&amp;nbsp;I'm just an engineer. What I want to know is: where did we screw it all up? And how do we make it right?&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;The premise, explained&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Once upon a time most important human transactions were done face-to-face, and in those transactions we enjoyed at least the &lt;i&gt;promise&lt;/i&gt;&amp;nbsp;that our communications would be private. Then everything changed. First came&amp;nbsp;the telephones and telegraphs, and then computer networks. As our friends and colleagues spread farther apart &lt;i&gt;geographically&lt;/i&gt;, we eagerly moved our personal communications to these new electronic networks.&amp;nbsp;Networks that, for all their many blessings, are&amp;nbsp;&lt;i&gt;&lt;a href="http://people.howstuffworks.com/wiretapping3.htm"&gt;anything but private&lt;/a&gt;.&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://www.aclu.org/files/people_affected.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="148" src="http://www.aclu.org/files/people_affected.jpg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;People affected by telephonic surveillance (1998-2011). Source:&amp;nbsp;&lt;a href="http://www.aclu.org/blog/national-security-technology-and-liberty/new-justice-department-documents-show-huge-increase"&gt;ACLU&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
Some people didn't like this. They &lt;a href="http://www.philzimmermann.com/EN/essays/WhyIWrotePGP.html"&gt;pointed out&lt;/a&gt; that our new electronic communications were a double-edge sword, and were costing us protections that our ancestors had fought for.&amp;nbsp;And a very few decided to do something about it. If&amp;nbsp;technological advances could&amp;nbsp;&lt;i&gt;damage&lt;/i&gt;&amp;nbsp;our privacy, they reasoned, then perhaps the same advances could help us gain it back.&lt;br /&gt;
&lt;br /&gt;
Technically, the dream was born from the confluence of three separate technologies. The first was the PC, which brought computing into our living room. The second was the sudden and widespread availability of computer &lt;i&gt;networking:&amp;nbsp;&lt;/i&gt;first BBSes, then WANs like GTE Telenet, and then the Internet. Most critically, the dream was fueled by the coincidental rise of &lt;i&gt;scientific, industrial&lt;/i&gt;&amp;nbsp;cryptography, starting with the publication of the &lt;a href="http://en.wikipedia.org/wiki/Data_Encryption_Standard"&gt;Data Encryption Standard&lt;/a&gt; and continuing through the development of technologies like&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Public-key_cryptography"&gt;public-key cryptography&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
By 1990s, the conditions were in place for a privacy renaissance. For&amp;nbsp;the first time in history, the average person had access to encryption technology that was light years beyond what most&amp;nbsp;&lt;i&gt;governments&lt;/i&gt;&amp;nbsp;had known before. The flagbearer of this revolution was Philip Zimmermann and his&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Pretty_Good_Privacy"&gt;Pretty Good Privacy&lt;/a&gt;&amp;nbsp;(PGP), which brought strong encryption to millions.&amp;nbsp;Sure, by modern standards PGP 1.0 was a terrible&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/BassOmatic"&gt;flaming piece of crap&lt;/a&gt;. But&amp;nbsp;it was a miraculous piece of crap. And&amp;nbsp;it quickly got better. If we just hung in there, the dream told us, the future would bring us further miracles, things like&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Mix_network"&gt;perfect cryptographic anonymity&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Ecash"&gt;untraceable electronic cash.&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
It's worth pointing out that the 'dream' owes a lot of its power to government itself. Congress and the NSA boosted it by doing what they do best -- freaking out. This was the era of export regulations and 40-bit keys and &lt;a href="http://en.wikipedia.org/wiki/Clipper_chip"&gt;Clipper chips&lt;/a&gt; and proposals for&amp;nbsp;&lt;a href="http://thomas.loc.gov/cgi-bin/bdquery/z?d102:S266:"&gt;mandatory backdoors in all crypto software&lt;/a&gt;. Nothing says 'clueless old dinosaurs' like the image of Phil Zimmermann being searched at the border -- for copies of a program you could &lt;i&gt;download off the Internet&lt;/i&gt;!&lt;br /&gt;
&lt;br /&gt;
And so we all held a million&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Key_signing_party"&gt;key signing parties&lt;/a&gt;&amp;nbsp;and overlooked a few glaring problems with the software we were using. After all,&amp;nbsp;these would be resolved.&amp;nbsp;Once we convinced the masses to come along with us, the future would be encrypted and paid for with e-Cash spent via untraceable electronic networks on software that would encrypt itself when you were done using it. The world would never be the same.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Obviously none of this actually happened.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If you&amp;nbsp;sent an email today -- or texted, or made a phone call -- chances are that your communication was just as insecure as it would have been in 1990. Maybe less so. It probably went through a large service provider who snarfed up the cleartext, stuffed it into an advertising algorithm, then dropped it into a long term data store where it will reside for the next three years. It's hard to be private under these circumstances.&lt;br /&gt;
&lt;br /&gt;
Cryptography is still everywhere, but ufortunately it's grown up and lost its&amp;nbsp;ideals. I don't remember the last time I bothered to send someone a GPG email -- and do people actually have key signing parties anymore?&lt;br /&gt;
&lt;br /&gt;
There are a few amazingly bright spots in this dull landscape -- I'll get to them in due course -- but for the most part crypto just hasn't lived up to its privacy billing. The question is &lt;i&gt;why? &lt;/i&gt;What went so terribly wrong?&amp;nbsp;In the rest of this post I'll try to give a few of &lt;i&gt;my&lt;/i&gt;&amp;nbsp;answers to this question.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;Problem #1: Crypto software is too damned hard to use.&lt;/b&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;
Cryptographers are good at cryptography. Software developers are good at writing code. Very few of &lt;i&gt;etiher&lt;/i&gt;&amp;nbsp;camp are good at&amp;nbsp;&lt;i&gt;making things easy to use.&lt;/i&gt;&amp;nbsp;In fact, usability is a surprisingly hard nut to crack across all areas of software design, since it's one of a few places where 99% is just not good enough. This is why Apple and Samsung sell a zillion phones every year, and it's why the '&lt;i&gt;year of Linux on the Desktop&lt;/i&gt;' always seems to be a few years away.&lt;br /&gt;
&lt;br /&gt;
Security products are without a doubt the &lt;i&gt;worst&lt;/i&gt; products for usability, mostly because your user is also the enemy. If your user can't work a smartphone, she might not be able to make calls. But if she screws up with a &lt;i&gt;security product&lt;/i&gt;, she could get pwned.&lt;br /&gt;
&lt;br /&gt;
Back in 1999 -- in one of the &lt;i&gt;few&lt;/i&gt;&amp;nbsp;usability studies we have in this area -- Alma Whitten and J.D. Tygar&amp;nbsp;&lt;a href="http://www.gaudior.net/alma/johnny.pdf"&gt;sat down and tried to get non-experts to use PGP&lt;/a&gt;, a program that experts generally thought of as being&amp;nbsp;&lt;i&gt;highly&amp;nbsp;&lt;/i&gt;user friendly. Needless to say the results &lt;i&gt;were not impressive.&amp;nbsp;&lt;/i&gt;And as fun as it is to chuckle at the people involved (like the guy who&amp;nbsp;revoked his key and left the revocation message on his hard drive) the participants weren't idiots. They were making the same sort of mistakes &lt;i&gt;everyone&lt;/i&gt;&amp;nbsp;makes with software, just with potentially more serious consequences.&lt;br /&gt;
&lt;br /&gt;
And no, this isn't just a software design problem. Even if you're a wizard with interfaces, key management turns out to be&amp;nbsp;&lt;i&gt;just plain hard&lt;/i&gt;. And worse, your brililant idea for making it easier will probably also&amp;nbsp;&lt;i&gt;make you more vulnerable&lt;/i&gt;. Where products have 'succeeded' in marketing end-to-end encryption, they've usually done so by making radical compromises that undermine the purpose of the entire exercise.&lt;br /&gt;
&lt;br /&gt;
Think Hushmail, where the &lt;a href="http://www.wired.com/threatlevel/2007/11/hushmail-to-war/"&gt;crypto client was delivered from a (potentially) untrustworthy server&lt;/a&gt;. Or S/MIME email certificates which are typically generated in a way that could expose&amp;nbsp;&lt;a href="http://www.symantec.com/verisign/digital-id"&gt;private key to the CA&lt;/a&gt;. And of course, there's Skype, which operates their own user-friendly CAs, a CA that can potentially &lt;i&gt;pwn&lt;/i&gt;&amp;nbsp;you in a heartbeat.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;Problem #2: Snake-oil cryptography has cluttered the space.&lt;/b&gt;&lt;/blockquote&gt;
As Arvind points out, most people don't really understand the limitations of cryptography. This goes for people who rely on it for their business (can't tell you how many times I've explained this stuff to DRM vendors.) It goes &lt;i&gt;double&lt;/i&gt;&amp;nbsp;for the average user.&lt;br /&gt;
&lt;br /&gt;
The problem is that when cryptography&amp;nbsp;&lt;i&gt;does&lt;/i&gt;&amp;nbsp;get used, it's often applied in dangerous, stupid and pointless ways. And yet people don't know this. So &lt;a href="http://www.cryptotech.com/ftp/pub/techdocs/manuals/CRYPTO-BOX/SmarxOS/CBU%20SC%20White%20Paper%20for%20Developers.pdf"&gt;bad products&lt;/a&gt; get equal (or greater) billing than good ones, and the market lacks the necessary information to provide a sorting function. This is a mess, since cryptography -- when treated as a cure-all with magical properties -- can actually make&amp;nbsp;us &lt;i&gt;less&lt;/i&gt;&amp;nbsp;secure than we might otherwise be.&lt;br /&gt;
&lt;br /&gt;
Take VPN services, for example. These propose to secure you from all kinds of threats, up to and including totalitarian governments. But the vast majority of commercial VPN providers do terribly insecure things, like use a &lt;a href="http://www.giganews.com/vyprvpn/setup/iphone/l2tp.html"&gt;fixed shared-secret across all users&lt;/a&gt;. Data encryption systems are another big offender. These&amp;nbsp;are largely purchased to satisfy regulatory requirements, and buying one can get&amp;nbsp;you off the hook for all kinds of bad behavior: regulations often excuse breaches as long as you encrypt your data -- in some way -- before you leave it in a taxi. The details are often overlooked.&lt;br /&gt;
&lt;br /&gt;
With so much weak cryptography out there, it's awfully hard to distinguish a good system. Moreover, the good system will probably be harder to use. How do you convince people that there's a difference?&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;Problem #3: You can't make money selling privacy.&lt;/b&gt;&lt;/blockquote&gt;
As I'll explain in a minute this one isn't &lt;i&gt;entirely&lt;/i&gt; true. Yet of all the answers in this post I tend to believe that it's also the one with the most explanitory power.&lt;br /&gt;
&lt;br /&gt;
Here's the thing: developing cryptographic technology isn't cheap, and it isn't fast. It takes time, love, and a community of dedicated developers. But more importantly, it requires&amp;nbsp;&lt;i&gt;subject matter experts&lt;/i&gt;. These people often have families and kids, and kids can't eat dreams. This means you need a way to pay them. (The parents, that is. You can usually exploit the kids as free labor and call it an 'internship'.)&lt;br /&gt;
&lt;br /&gt;
Across the board, commercialization of privacy technologies has been something of a bust. David Chaum gave it a shot with his &lt;a href="http://en.wikipedia.org/wiki/DigiCash"&gt;anonymous electronic cash company&lt;/a&gt;. Didn't work. Hushmail had a good run. &lt;a href="https://silentcircle.com/"&gt;These guys&lt;/a&gt; are giving it a shot right now -- and I wish them enormous luck. But I'm not sure how they're going to make people pay for it.&lt;br /&gt;
&lt;br /&gt;
In fact, when you look at the &lt;i&gt;most&lt;/i&gt;&amp;nbsp;successful privacy technologies -- things like PGP or Tor or Bitcoin &amp;nbsp;-- you notice that these are the exceptions that prove the rule. &lt;a href="https://www.torproject.org/"&gt;Tor&lt;/a&gt; was developed with US &lt;a href="http://www.onion-router.net/History.html"&gt;military funding&lt;/a&gt; and continues to exist thanks to generous NGO and government donations. PGP was a labor of love. Bitcoin is... well, I mean, nobody really understands what Bitcoin is&lt;i&gt;. &lt;/i&gt;But it's unique and not likely to be repeated.&lt;br /&gt;
&lt;br /&gt;
I could think of at least two privacy technologies that would be wonderful to have &lt;i&gt;right now&lt;/i&gt;, and yet implementing them would be impossible without millions in seed funding. And where would you recover that money? I can't quite figure it out. Maybe Kickstarter is the answer to this sort of thing, but I'll have to let someone else prove it to me.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;Problem #4: It doesn't matter anyway. You're using software, and you're screwed.&lt;/b&gt;&lt;/blockquote&gt;
Some of the best days of the crypto dream were spent fighting government agencies that legitimately believed that crypto software would render them powerless. We generally pat ourselves on the back for 'winning' this fight (although in point of fact, export regulations still exist). But it's more accurate to say that governments decided to walk away.&lt;br /&gt;
&lt;br /&gt;
With hindsight it's pretty obvious that they got the better end of the deal. It's now legal to obtain strong crypto software, but the proportion of (non-criminal) people who &lt;i&gt;actually&amp;nbsp;do this&lt;/i&gt;&amp;nbsp;is quite small. Worse, governments have a trump card that can circumvent the best cryptographic algorithm. No, it's not a &lt;a href="http://www.schneier.com/blog/archives/2012/03/can_the_nsa_bre.html"&gt;giant machine that can crack AES&lt;/a&gt;. It's the fact that you're implementing the &lt;a href="http://web.nvd.nist.gov/view/vuln/statistics"&gt;damned thing in software&lt;/a&gt;. And software vulnerabilities will overcome all but the most paranoid users, provided that the number of people worth tracking is small enough.&lt;br /&gt;
&lt;br /&gt;
Arvind points this out in his talk, and refers to a wonderful talk by &lt;a href="http://www.youtube.com/watch?v=3ijjHZHNIbU"&gt;Jonathan Zittrain&lt;/a&gt;&amp;nbsp;called 'The End of Crypto' -- in which Jonathan points out how serious the problem is. Moreover, he notes that&amp;nbsp;we're increasingly losing control of our devices (thanks to the walled garden model), and argues that such control is a pre-condition for secure&amp;nbsp;communications&amp;nbsp; This may be true, but let me play devil's advocate: the following chart shows a price list for 0days in commercial software. You tell me which ones the government has the hardest time breaking into.&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://blogs-images.forbes.com/andygreenberg/files/2012/07/exploitpricechart.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="146" src="http://blogs-images.forbes.com/andygreenberg/files/2012/07/exploitpricechart.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Estimated price list for 0-days in various software products. (Source: &lt;a href="http://www.forbes.com/sites/andygreenberg/2012/03/23/shopping-for-zero-days-an-price-list-for-hackers-secret-software-exploits/"&gt;Forbes&lt;/a&gt;)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
Whatever the details, it seems increasingly unlikely that we're going to live the dream while using the software we use today. And sadly nobody seems to have much of an answer for that.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;Problem #5: The whole premise of this post is wrong -- the dream &lt;i&gt;is&lt;/i&gt;&amp;nbsp;alive!&lt;/b&gt;&lt;/blockquote&gt;
Of course, another possibility is that the whole concept is just mistaken. Maybe the dream did arrive and we were all just looking the other way.&lt;br /&gt;
&lt;br /&gt;
Sure, GPG adoption may be negligible, and yes, most crypto products are a disaster. Yet with a few clicks I can get on a user-friendly (and secure!)&amp;nbsp;&lt;a href="https://www.torproject.org/"&gt;anonymous communications network&lt;/a&gt;, where my web connections will be routed via an onion of encrypted tunnels to a machine on the other side of the planet. Once there I can pay for things using a &lt;a href="http://bitcoin.org/"&gt;pseudonymous electronic cash service&lt;/a&gt; that bases its currency on nothing more than the price of a GPU.&lt;br /&gt;
&lt;br /&gt;
If secure communications is what I'm after, I can communicate through &lt;a href="http://www.cypherpunks.ca/otr/"&gt;OTR&lt;/a&gt; or &lt;a href="http://www.whispersys.com/"&gt;RedPhone&lt;/a&gt; or one of a dozen encrypted chat programs that've recently arrived on the scene. And as long as &lt;a href="http://www.slideshare.net/grugq/opsec-for-hackers"&gt;I'm not stupid&lt;/a&gt;, there's surprisingly little that anyone can do about any of it.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;In conclusion&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This has been a very non-technical post, and that's ok -- you don't have to get deeply technical in order to answer this particular question. (In fact, this one place I slightly disagree with Arvind, who also brings up the &lt;i&gt;efficiency&lt;/i&gt;&amp;nbsp;of certain advanced technologies like &lt;a href="http://en.wikipedia.org/wiki/Secure_multi-party_computation"&gt;Secure Multiparty Computation&lt;/a&gt;.&amp;nbsp;I truly don't think this is a story about efficiency, because we have lots of &lt;a href="http://en.wikipedia.org/wiki/Direct_Anonymous_Attestation"&gt;efficient privacy protocols,&lt;/a&gt; and people &lt;i&gt;still&lt;/i&gt;&amp;nbsp;don't use them.)&lt;br /&gt;
&lt;br /&gt;
What I do know is that there's so much we can do now, and there are so many promising technologies that have now reached maturity and are begging to be deployed. These include better techniques for anonymizing networks, adding &lt;i&gt;real&lt;/i&gt;&amp;nbsp;privacy to currencies like Bitcoin, and providing user authentication that actually works. The crypto dream can still live. Maybe all we need is a new generation of people to dream it.&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/ie4x0_jgO58" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/2602160329753554751/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/10/the-crypto-dream.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/2602160329753554751?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/2602160329753554751?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/ie4x0_jgO58/the-crypto-dream.html" title="The crypto dream" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/10/the-crypto-dream.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEAEQXo6fip7ImA9WhNTEEo.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-9149272059612621920</id><published>2012-10-09T09:09:00.002-07:00</published><updated>2012-10-12T13:11:40.416-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-12T13:11:40.416-07:00</app:edited><title>So you want to use an alternative cipher...</title><content type="html">&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://www.secretcodebreaker.com/ciphrdsk.gif" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="198" src="http://www.secretcodebreaker.com/ciphrdsk.gif" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Not this cipher.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Once in a while I run into discussions that hinge on the following dubious proposition: that AES is bad and we need to replace it. These discussions always make me leery, since they begin with facts not in evidence, and rarely inspire any confidence that the &lt;i&gt;solution&lt;/i&gt;&amp;nbsp;is going to be any better than the 'problem'.&lt;br /&gt;
&lt;br /&gt;
In fact, this whole point of view is so rarified that I've debated whether to even write this post, since my opinion is that AES is the &lt;i&gt;last&lt;/i&gt;&amp;nbsp;place your system is going to break down -- and you should be focusing your attention on fixing all the other broken things first.&lt;br /&gt;
&lt;br /&gt;
Moreover, the simple advice on AES mirrors the ancient wisdom about IBM: nobody ever got fired for choosing it. Not only is AES is the NIST standard (certified in &lt;a href="http://en.wikipedia.org/wiki/FIPS_140"&gt;FIPS 140&lt;/a&gt; and &lt;a href="http://www.nsa.gov/ia/programs/suiteb_cryptography/"&gt;NSA's Suite B&lt;/a&gt;), but there are hundreds of solid implementations to choose from. If that's not enough for you, many processors now support AES operations natively, meaning that your application can now offload most of the work to hardware &lt;i&gt;without&lt;/i&gt;&amp;nbsp;the help of an expensive co-processor.&lt;br /&gt;
&lt;br /&gt;
So why not just stick with AES? People who have these discussions generally give a variety of reasons, some of which are more valid than others.&amp;nbsp;First, there's what I call the 'slight paranoia' viewpoint, which holds that AES has been around for a long time and could (soon/someday) fail. In just the last few years we've seen a few &lt;i&gt;impractical&lt;/i&gt;&amp;nbsp;attacks on the construction, which could be beginning of a trend. Or maybe not.&lt;br /&gt;
&lt;br /&gt;
The second (less&amp;nbsp;paranoid) objection is that AES is somewhat troublesome to implement in software. To make it run fast you have to expand the key and pre-compute a series of tables -- all of which increases key setup time and potentially&amp;nbsp;makes you vulnerable to &lt;a href="http://cr.yp.to/antiforgery/cachetiming-20050414.pdf"&gt;cache timing attacks&lt;/a&gt;. Good implementations take this into account, but even the best ones aren't perfect. And in a few cases your performance constraints are so tight that AES just isn't fast enough.&lt;br /&gt;
&lt;br /&gt;
Now I'm not saying that any of these (except possibly for the last reason) are good reasons to ditch AES. In fact, ditching AES would be the &lt;i&gt;opposite&lt;/i&gt;&amp;nbsp;of my recommendation. But let's say that you've already made the decision to explore more recent, modern alternatives. What are they? Should you trust them? And most importantly: what will they buy you?&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Salsa20&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Based on an informal (and totally unscientific poll), the consensus among &lt;i&gt;advanced&lt;/i&gt; AES-switchers is that &lt;a href="http://www.ecrypt.eu.org/stream/salsa20pf.html"&gt;Salsa20&lt;/a&gt; has a lot going for it. This is mostly due to Salsa20's performance characteristics, but also because people are growing increasingly confident in its security.&lt;br /&gt;
&lt;br /&gt;
Now, just for the record, Salsa20 is a &lt;i&gt;stream cipher, &lt;/i&gt;while AES is a block cipher.&amp;nbsp;This distinction is important: stream ciphers produce a string of pseudo-random output bits which are XORed with the message to be encrypted. Block ciphers can be configured to do the same thing (&lt;i&gt;e.g.,&lt;/i&gt;&amp;nbsp;by running them in CTR or OFB mode), but they can also process plaintext blocks in other ways.&lt;br /&gt;
&lt;br /&gt;
One important difference -- and a reason implementers have historically preferred block ciphers -- is that many block cipher modes allow you to &lt;i&gt;randomly access &lt;/i&gt;just&amp;nbsp;a portion of an encrypted message, without wasting time decrypting the whole thing. A second advantage is that block ciphers can be used to construct both encryption&amp;nbsp;&lt;i&gt;and&lt;/i&gt;&amp;nbsp;message authentication (MACs), which makes them a wonderful building block for constructing &lt;a href="http://en.wikipedia.org/wiki/Authenticated_encryption"&gt;authenticated encryption&lt;/a&gt; modes.&lt;br /&gt;
&lt;br /&gt;
Salsa20 takes care of the first issue by providing a means to randomly access&amp;nbsp;any block of the generated keystream. Each invocation of the Salsa20 keystream generator takes a key, a nonce (serving as an IV), and a &lt;i&gt;block&lt;/i&gt;&amp;nbsp;&lt;i&gt;position &lt;/i&gt;in the stream. It then outputs the 512-bit block corresponding to that position. This makes it easy to, for example, seek to the last block of a multi-gigabyte file.&lt;br /&gt;
&lt;br /&gt;
It's also possible to use Salsa20 in an authenticated encryption mode -- but it's not trivial. And to do this the cipher must be composed with a polynomial-based MAC like Dan Bernstein's &lt;a href="http://cr.yp.to/mac.html"&gt;poly1305&lt;/a&gt;. I won't lie and say that this usage is standardized and well-defined -- certainly not in the way that, say, &lt;a href="http://en.wikipedia.org/wiki/EAX_mode"&gt;EAX&lt;/a&gt; or &lt;a href="http://en.wikipedia.org/wiki/Galois/Counter_Mode"&gt;GCM&lt;/a&gt; modes are with AES.&lt;br /&gt;
&lt;br /&gt;
On the positive side, Salsa20 is &lt;i&gt;fast &lt;/i&gt;in software. The key setup time is negligible and it has one of the lowest cycles-per-byte counts of any reputable ciphers. &lt;a href="http://cr.yp.to/streamciphers/timings.html"&gt;Current figures&lt;/a&gt;&amp;nbsp;show Salsa20/12 to be 2-3x as fast as a heavily optimized AES-CTR, and maybe even faster for the implementation that you would actually use (of course, hardware implementations of AES could make up for a lot of this advantage).&lt;br /&gt;
&lt;br /&gt;
The basic limitation a cipher like Salsa20 is the same as with &lt;i&gt;any&lt;/i&gt; non-standard cipher -- no matter how good the design, you're using an alternative. Alternatives don't get the same attention that standards do. To its credit, Salsa20 has received a &lt;a href="http://www.ecrypt.eu.org/stream/salsa20p3.html"&gt;decent amount of academic cryptanalysis&lt;/a&gt;, most of it positive, but still nothing compared to AES.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Threefish&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Threefish is another recent contribution to the 'alternative ciphers' canon, and hails from Schneier, Ferguson, Lucks, Whiting, Bellare, Kohno, Callas, and Walker. (With a list of authors this long, how could it not be excellent?)&lt;br /&gt;
&lt;br /&gt;
Threefish's distinction is that it's one of a relatively small number of ciphers that recently passed through &amp;nbsp;(most of) a NIST competition. The dubious aspect is that the competition &lt;i&gt;wasn't a competition for designing a cipher. &lt;/i&gt;Rather, Threefish was submitted as a building block for the SHA3 candidate&amp;nbsp;&lt;a href="http://www.skein-hash.info/"&gt;Skein&lt;/a&gt;,&amp;nbsp;which made it to the final round of the competition but was ultimately passed over in favor of&amp;nbsp;&lt;a href="http://keccak.noekeon.org/"&gt;Keccak&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Threefish is a wide-block cipher that can be configured to operate on 256, 512 or 1024-bit blocks. Right off the bat this seems useful for applications like disk encryption, where ciphers are typically used to encrypt large blocks of material (sometimes in 'wide block cipher modes' like CMC or EME). But it seems like a nice choice for security and performance reasons.&lt;br /&gt;
&lt;br /&gt;
While Threefish has seen some cryptanalysis, this is still relatively limited (a few major results). None of these results are 'successful', which is noteworthy and confidence-inspiring. But even with this work, it's hard to say where the cipher stands in relation to AES.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;The AES could-have-beens: Twofish, Serpent, etc.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
AES seems like it's always been AES, so it's easy to forget that just a few years ago it was called&amp;nbsp;Rijndael and there were four other finalists that could just as easily have taken the title. Those finalists all received a lot of cryptanalytic attention, and none of them went away when AES was selected.&lt;br /&gt;
&lt;br /&gt;
The two ciphers I occasionally run into are Bruce Schneier's Twofish and Anderson/Biham/Knudsen's Serpent. Both have decent performance in software, and both have stood up relatively well to cryptanalysis. On the flipside, neither of the two ciphers has received very much in the way of analysis since the AES competition ended (Twofish's most recent &lt;i&gt;significant&lt;/i&gt; result was in 2000).&lt;br /&gt;
&lt;br /&gt;
Any of these ciphers &lt;i&gt;could&lt;/i&gt;&amp;nbsp;be a worthy alternative to AES if you were desperate, but I wouldn't go out of my way to use one.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;In conclusion&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I realize none of the above actually tells you &lt;i&gt;which&lt;/i&gt;&amp;nbsp;AES alternative to use, and that's mostly because I don't want to legitimize the question. Unless your adversary is the NSA &lt;i&gt;or&lt;/i&gt;&amp;nbsp;you have some serious performance constraints that AES can't satisfy, my recommendation is to stick with AES -- it's the one standard cipher that nobody gets fired for using.&lt;br /&gt;
&lt;br /&gt;
But if you are in the latter category (meaning, you have performance constraints) I'm pretty impressed by Salsa20/12's performance in software, &lt;i&gt;provided&lt;/i&gt;&amp;nbsp;you have a good strategy for providing authentication. Even better, while Salsa20 is not standardized by NIST, standardization efforts &lt;i&gt;are&lt;/i&gt; ongoing in the &lt;a href="http://www.ecrypt.eu.org/stream/"&gt;eCRYPT eStream&lt;/a&gt; project. The result could be increasing adoption of this cipher.&lt;br /&gt;
&lt;br /&gt;
If your concern is with the &lt;i&gt;security&lt;/i&gt;&amp;nbsp;of AES, I have less advice to give you. The beautiful thing about AES is that it's so widely studied and used that we'll almost certainly have plenty of notice should the cipher really start to fail. That is, provided the people attacking it are doing so in the public, academic literature. (If your enemy is the NSA I'm just not sure what to tell you. Just &lt;i&gt;run.&lt;/i&gt;)&lt;br /&gt;
&lt;br /&gt;
That still leaves a class of folks who worry about encrypting things for the long-haul. For these folks the best I can propose is to &lt;i&gt;securely&amp;nbsp;combine&lt;/i&gt;&amp;nbsp;AES with another well-studied cipher like Salsa20, Threefish or one of the AES finalists. This will cost you -- and there's no guarantee that &lt;i&gt;both&lt;/i&gt;&amp;nbsp;ciphers will stand over the long term. But the probability of two significant breaks seems lower than the probability of one.&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/XCuvZq9tW0k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/9149272059612621920/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/10/so-you-want-to-use-alternative-cipher.html#comment-form" title="8 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/9149272059612621920?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/9149272059612621920?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/XCuvZq9tW0k/so-you-want-to-use-alternative-cipher.html" title="So you want to use an alternative cipher..." /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><thr:total>8</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/10/so-you-want-to-use-alternative-cipher.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkECQHc7fyp7ImA9WhJaE0o.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-106372836202509197</id><published>2012-10-03T07:28:00.002-07:00</published><updated>2012-10-04T11:17:41.907-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-04T11:17:41.907-07:00</app:edited><title>SHA3 is over. Long live SHA3!</title><content type="html">&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-Be9E4wFcYag/UGxGtODfzAI/AAAAAAAAAN0/KPABfiVeCCg/s1600/sponge.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;img border="0" height="89" src="http://4.bp.blogspot.com/-Be9E4wFcYag/UGxGtODfzAI/AAAAAAAAAN0/KPABfiVeCCg/s200/sponge.png" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;The Keccak 'sponge'&lt;br /&gt;
(Wikipedia/CC)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
The news today is all about hash functions, and specifically, the &lt;i&gt;new&lt;/i&gt;&amp;nbsp;hash function we're all going to be calling SHA3. After six long years NIST has &lt;a href="http://nisttechbeat.blogs.govdelivery.com/2012/10/nist-selects-winner-of-secure-hash-algorithm-sha-3-competition/"&gt;finally announced&lt;/a&gt; the winner of the SHA3 competition: it's &lt;a href="http://keccak.noekeon.org/specs_summary.html"&gt;Keccak&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
This isn't a total shock: the scuttlebut is that Keccak got most of the 'hums' in NIST's informal 'hum if you like this hash function' poll at the SHA3 conference this year, followed closely by BLAKE. (&lt;i&gt;Yes, seriously, this is how we do things&lt;/i&gt;.)&amp;nbsp;Obviously hums aren't the only criteria NIST uses to pick a standard, but they do us an idea where the community stands on things. Moreover, Keccak sports a radically different design than SHA2 and its competitors -- something that appears to have given it a strong competitive advantage.&lt;br /&gt;
&lt;br /&gt;
Now please let me stipulate (&lt;i&gt;&lt;a href="http://blog.cryptographyengineering.com/2012/07/indifferentiability.html"&gt;again&lt;/a&gt;&lt;/i&gt;!) that I'm no expert in hash function design. And sadly, many of the leading hash function experts had 'losing' submissions of their own, which means they're still in the first stages of the grieving process -- the one where&lt;i&gt;&amp;nbsp;&lt;/i&gt;they say &lt;a href="http://www.schneier.com/blog/archives/2012/10/keccak_is_sha-3.html"&gt;nice things about the winner&lt;/a&gt;&amp;nbsp;while secretly plotting its demise. (I'm only kidding. Sort of.)&lt;br /&gt;
&lt;br /&gt;
So while I'm no expert in the deep internals of the design, I can sum up a few things that others -- both expert and non-expert -- are saying about the process and the decision.&lt;br /&gt;
&lt;br /&gt;
To begin with, nobody really thinks that NIST blew it here. All of the finalists were strong designs, and each provides a substantial security margin over the previous state of the art. Each was evaluated under a base standard of&amp;nbsp;&lt;i&gt;'indifferentiability from a random oracle'&lt;/i&gt;, and each possesses a security proof to that effect (for more on what this means, see &lt;a href="http://blog.cryptographyengineering.com/2012/07/indifferentiability.html"&gt;this post&lt;/a&gt;.) This is a great turn for NIST, which has been been iffy on provable security in the past. Concretely, this means no more &lt;a href="http://www.vnsecurity.net/t/length-extension-attack/"&gt;length-extension attacks&lt;/a&gt; as in SHA1/2, though admittedly some &lt;a href="http://www.schneier.com/blog/archives/2011/02/nist_defines_ne.html"&gt;SHA2 variants&lt;/a&gt;&amp;nbsp;already satisfy this requirement.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
Moreover, I hear nobody complaining about the security of Keccak. The major gripes appear to be centered around its performance in software, a concern that really does have some grounding. But more on that in a second.&lt;br /&gt;
&lt;br /&gt;
So what do we know about Keccak/SHA3? This list is by no means comprehensive (nor does it represent my own thoughts alone), but it will hopefully provide a few insights:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;The name 'Keccak' comes from '&lt;a href="http://en.wikipedia.org/wiki/Kecak"&gt;Kecak&lt;/a&gt;', a Balinese dance. (h/t JP Aumasson)&lt;/li&gt;
&lt;li&gt;Keccak differs from the other SHA3 finalists in that it uses a 'sponge' construction. Where other designs rely on a 'compression function' which is extended to larger domains, Keccak uses a &lt;i&gt;non-compressing&lt;/i&gt; function to absorb and then 'squeeze out' a short digest.&amp;nbsp;It's unclear whether this design is radically better or worse than the existing approaches. But it is&amp;nbsp;&lt;i&gt;different.&lt;/i&gt;&amp;nbsp;NIST clearly felt that in this case, different is better.&lt;/li&gt;
&lt;li&gt;Keccak doesn't blaze in software. In fact, Keccak/512 is estimated to be as much as &lt;i&gt;half as fast&lt;/i&gt; in software as SHA-512. This &lt;a href="http://bench.cr.yp.to/results-sha3.html"&gt;fantastic table of tables&lt;/a&gt;&amp;nbsp;sums up the results across all of the finalists. Needless to say they are &lt;i&gt;highly&lt;/i&gt;&amp;nbsp;processor dependent. I'm already seeing the first signs of pushback from security developers on mailing lists.&lt;/li&gt;
&lt;li&gt;Keccak &lt;i&gt;is&lt;/i&gt;&amp;nbsp;quite speedy on hardware, something NIST cited in its decision. It also looks like it will be very GPU-friendly.&lt;/li&gt;
&lt;li&gt;'Attacks' on Keccak include a&amp;nbsp;&lt;a href="http://eprint.iacr.org/2011/023.pdf"&gt;full distinguisher&lt;/a&gt; that applies to all 24 rounds of the hash function. But don't worry, the numbers in this attack are completely ridiculous, and&amp;nbsp;this is in no way an actual attack.&lt;/li&gt;
&lt;li&gt;Keccak includes relatively few non-linear bit operations per CPU instruction. The round function has algebraic degree 2, which facilitates some of the theoretical &lt;a href="https://www.131002.net/data/papers/AM09.pdf"&gt;'zero-sum' attacks&lt;/a&gt; on reduced-round Keccak (due to Aumasson and Meier).&lt;/li&gt;
&lt;li&gt;No, it is not pronounced 'Ketchup', despite my best attempts to convince people of this. (Though there actually&amp;nbsp;&lt;i&gt;is&lt;/i&gt;&amp;nbsp;a reduced-round variant called&amp;nbsp;&lt;a href="http://www.hyperelliptic.org/DIAC/slides/PermutationDIAC2012.pdf"&gt;Keccup&lt;/a&gt;.)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-3pA0znXy_E0/UGxSzhz6c-I/AAAAAAAAAOI/XKwFNQjh9Vw/s1600/ketchup.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="160" src="http://4.bp.blogspot.com/-3pA0znXy_E0/UGxSzhz6c-I/AAAAAAAAAOI/XKwFNQjh9Vw/s320/ketchup.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;My contribution to the SHA3&amp;nbsp;competition.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
The full Keccak specification (including pseudocode and &lt;a href="http://keccak.noekeon.org/readable_code.html"&gt;'readable' C code&lt;/a&gt;) can be found&amp;nbsp;&lt;a href="http://keccak.noekeon.org/specs_summary.html"&gt;here&lt;/a&gt;. A series of implementations exist for the &lt;a href="http://bench.cr.yp.to/supercop.html"&gt;SUPERCOP project&lt;/a&gt;. Unfortunately I know of no public or commercial implementations, at least not on major cryptographic libraries. I expect that to change quickly, and I also expect a whole bunch of further optimizations -- particularly on the GPU side.&lt;br /&gt;
&lt;br /&gt;
It's not clear how the adoption of SHA3 will proceed. Right now there are no significant clouds on the horizon for the SHA2 series, and for the moment it seems like many people will continue to use those -- at least, those who aren't still using SHA1 or (god help us) MD5. I'm not sure what my recommendation is on switching, except that nobody's in a rush. If you absolutely must worry about long-term security, my recommendation is to consider using SHA2 and SHA3 in a &lt;a href="http://homepages.cwi.nl/~pietrzak/publications/FLP08.pdf"&gt;secure composition&lt;/a&gt;. But I doubt anyone reading this blog needs to be that paranoid.&lt;br /&gt;
&lt;br /&gt;
Even if you were rooting for another function, there is one major bright side to the selection of Keccak. Now that the SHA3 competition is behind us, cryptographers will have time to get back to the real task: putting holes in SHA1 and SHA2. I very much look forward to the results.&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/aKlJzmhEP6g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/106372836202509197/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/10/long-live-sha3.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/106372836202509197?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/106372836202509197?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/aKlJzmhEP6g/long-live-sha3.html" title="SHA3 is over. Long live SHA3!" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-Be9E4wFcYag/UGxGtODfzAI/AAAAAAAAAN0/KPABfiVeCCg/s72-c/sponge.png" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/10/long-live-sha3.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0IASHY9eyp7ImA9WhJaE00.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-4863933530784447856</id><published>2012-09-28T01:05:00.003-07:00</published><updated>2012-10-03T16:05:49.863-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-03T16:05:49.863-07:00</app:edited><title>On the (provable) security of TLS: Part 2</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://i.technet.microsoft.com/dynimg/IC197149.gif" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="130" src="http://i.technet.microsoft.com/dynimg/IC197149.gif" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;i&gt;This is the second post in a series on the provable security of &lt;a href="http://en.wikipedia.org/wiki/Transport_Layer_Security"&gt;TLS&lt;/a&gt;. If you haven't read the first part, you &lt;a href="http://blog.cryptographyengineering.com/2012/09/on-provable-security-of-tls-part-1.html"&gt;really should&lt;/a&gt;!&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The goal of this series is to try to answer an age-old question that is often asked and rarely answered. Namely: is the TLS protocol&lt;i&gt;&amp;nbsp;provably&lt;/i&gt;&amp;nbsp;secure?&lt;br /&gt;
&lt;br /&gt;
While I find the question interesting in its own right, I hope to convince you that it's of more than academic interest. TLS is one of the &lt;i&gt;fundamental&lt;/i&gt; security protocols on the Internet, and if&amp;nbsp;&lt;i&gt;it&lt;/i&gt;&amp;nbsp;breaks lots of other things will too. Worse, it has broken -- repeatedly. Rather than&amp;nbsp;simply patch and hope for the best, it would be fantastic if we could actually&amp;nbsp;&lt;i&gt;prove&lt;/i&gt; that the current specification is the right one.&lt;br /&gt;
&lt;br /&gt;
Unfortunately this is easier said than done. In the &lt;a href="http://blog.cryptographyengineering.com/2012/09/on-provable-security-of-tls-part-1.html"&gt;first part of this series&lt;/a&gt; I gave an overview of the issues that crop up when you try to prove TLS secure. They come at you from all different directions, but most stem from TLS's use of ancient, archaic cryptography; gems like, for example, the ongoing use of&amp;nbsp;&lt;a href="http://tools.ietf.org/html/rfc2313"&gt;RSA-PKCS#1v1.5&lt;/a&gt; encryption &lt;i&gt;fourteen years&lt;/i&gt; after it was &lt;a href="http://en.wikipedia.org/wiki/Adaptive_chosen-ciphertext_attack#Practical_attacks"&gt;shown to be insecure&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Despite these challenges, cryptographers have managed to come up with a handful of nice security results on portions of the protocol. In the &lt;a href="http://blog.cryptographyengineering.com/2012/09/on-provable-security-of-tls-part-1.html"&gt;previous post&lt;/a&gt; I discussed Jonnson and Kaliski's proof of security for the RSA-based TLS handshake. This is an important and confidence-inspiring result, given that the RSA handshake is used in almost all TLS connections.&lt;br /&gt;
&lt;br /&gt;
In this post we're going to focus on a &lt;a href="http://www.isg.rhul.ac.uk/~kp/mee-comp.pdf"&gt;similarly reassuring finding&lt;/a&gt;&amp;nbsp;related to the the TLS &lt;i&gt;record encryption &lt;/i&gt;protocol -- and the 'mandatory' ciphersuites used by the record protocol in TLS 1.1 and 1.2 (&lt;i&gt;nb:&lt;/i&gt; TLS 1.0 is broken beyond redemption). What this proof tells us is that TLS's CBC mode ciphersuites are secure, assuming... well, a &lt;i&gt;whole bunch of things&lt;/i&gt;, really.&lt;br /&gt;
&lt;br /&gt;
The bad news is that the result is extremely fragile, and owes its existence more to a series of happy accidents than from any careful security design. In other words, it's just like TLS itself.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Records and handshakes&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
Let's warm up with a quick refresher.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://en.wikipedia.org/wiki/Transport_Layer_Security"&gt;TLS&lt;/a&gt; is a layered protocol, with different components that each do a different job. In the previous post I mostly focused on the&amp;nbsp;&lt;i&gt;handshake&lt;/i&gt;, which is&amp;nbsp;a beefed-up&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Key-agreement_protocol"&gt;authenticated key agreement&lt;/a&gt;&amp;nbsp;protocol. Although the handshake does several things, its main purpose is&amp;nbsp;to negotiate a shared encryption key between a client and a server -- parties who up until this point may be complete strangers.&lt;br /&gt;
&lt;br /&gt;
The handshake gets lots of attention from cryptographers because it's exciting. Public key crypto! Certificates! But really, this portion of the protocol only lasts for a moment. Once it's done,&amp;nbsp;control heads over to the unglamorous&amp;nbsp;&lt;i&gt;record encryption layer &lt;/i&gt;which handles the real business of the protocol: securing application data.&lt;br /&gt;
&lt;br /&gt;
Most kids don't grow up dreaming about a chance to work on the TLS record encryption layer, and &lt;i&gt;that's fine&lt;/i&gt; -- they shouldn't have to. All the record encryption layer does is, well,&amp;nbsp;&lt;i&gt;encrypt stuff&lt;/i&gt;. In 2012 that should be about as exciting as mailing a package.&lt;br /&gt;
&lt;br /&gt;
And yet TLS record encryption still manages to be a source of endless excitement! In &lt;i&gt;the past year&amp;nbsp;alone&lt;/i&gt;&amp;nbsp;we've seen&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/2011/09/brief-diversion-beast-attack-on-tlsssl.html"&gt;three&lt;/a&gt;&amp;nbsp;&lt;a href="http://www.computerworld.com/s/article/9231281/_CRIME_attack_abuses_SSL_TLS_data_compression_feature_to_hijack_HTTPS_sessions"&gt;critical&lt;/a&gt;&amp;nbsp;(and exploitable!)&amp;nbsp;&lt;a href="http://www.isg.rhul.ac.uk/~kp/dtls.pdf"&gt;vulnerabilities&lt;/a&gt;&amp;nbsp;in this part of TLS. Clearly, before we can even talk about the &lt;i&gt;security&lt;/i&gt; of record&amp;nbsp;encryption, we have to figure out what's wrong with it.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Welcome to 1995&lt;/b&gt;&lt;br /&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://www.artclon.com/OtherFile/Gabor_Bethlen_among_his_Scholars_(sketch)_1870.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="145" src="http://www.artclon.com/OtherFile/Gabor_Bethlen_among_his_Scholars_(sketch)_1870.jpg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Development of the SSLv1 &lt;br /&gt;
record encryption layer&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
The problem (again) is TLS's penchant for using prehistoric cryptography, usually justified on some pretty&amp;nbsp;shaky '&lt;i&gt;backwards compatibility&lt;/i&gt;' grounds. This excuse is somewhat bogus, since the designers have actually changed the algorithms in ways that break compatibility with previous versions -- and yet retained many of the worst features of the originals.&lt;br /&gt;
&lt;br /&gt;
The most widely-used ciphersuites employ a block cipher configured in&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29"&gt;CBC mode&lt;/a&gt;, along with a &lt;a href="http://en.wikipedia.org/wiki/Message_authentication_code"&gt;MAC&lt;/a&gt; to ensure record authenticity. This mode can be used with various ciphers/MAC algorithms, but encryption always involves the following steps:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;If both sides support TLS compression, first compress the plaintext.&lt;/li&gt;
&lt;li&gt;Next compute a MAC over the plaintext, record type, sequence number and record length. Tack the MAC onto the end of the plaintext.&lt;/li&gt;
&lt;li&gt;Pad the result with up to 256 bytes of padding, such that the padded length is a multiple of the cipher's block size. The last byte of the padding should contain the padding length (excluding this byte), and all padding bytes must also contain the same value. A padded example (with AES) might look like:&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;0x MM MM MM MM MM MM MM MM MM 06 06 06 06 06 06 06&lt;br /&gt;&amp;nbsp;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Encrypt the padded message using CBC mode. In TLS 1.0 the last block of the previous ciphertext (called the 'residue') is used as the Initialization Vector. Both TLS 1.1 and 1.2 generate a fresh random IV for each record.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Upon decryption the attacker verifies that the padding is correctly structured, checks the MAC, and outputs an error if either condition fails.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To get an idea of what's wrong with the CBC ciphersuite, you can start by looking at the appropriate section of the&amp;nbsp;&lt;a href="http://tools.ietf.org/html/rfc5246#section-6.2.3.2"&gt;TLS 1.2 spec&lt;/a&gt;&amp;nbsp;-- which reads more like the warning label on a bottle of nitroglycerin than a cryptographic spec. Allow me sum up the problems.&lt;br /&gt;
&lt;br /&gt;
First, there's the compression. It's long been known that compression can leak information about the contents of a plaintext, simply by allowing the adversary to see &lt;i&gt;how well&lt;/i&gt;&amp;nbsp;it compresses.&amp;nbsp;The&amp;nbsp;&lt;a href="http://www.computerworld.com/s/article/9231281/_CRIME_attack_abuses_SSL_TLS_data_compression_feature_to_hijack_HTTPS_sessions"&gt;CRIME&lt;/a&gt;&amp;nbsp;attack recently showed how nasty this can get, but the problem is not really&amp;nbsp;&lt;a href="http://www.iacr.org/cryptodb/archive/2002/FSE/3091/3091.pdf"&gt;news&lt;/a&gt;. Any analysis of TLS encryption&amp;nbsp;&lt;i&gt;begins&lt;/i&gt; with the assumption that compression is turned&amp;nbsp;off.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Next there's the issue of the Initialization Vectors. TLS 1.0 uses the last block of the previous ciphertext, which is absurd, insecure and -- worse -- actively exploitable&amp;nbsp;by the&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/2011/09/brief-diversion-beast-attack-on-tlsssl.html"&gt;BEAST attack&lt;/a&gt;.&amp;nbsp;Once again, the issue has been &lt;a href="http://www.openssl.org/~bodo/tls-cbc.txt"&gt;known for years&lt;/a&gt;&amp;nbsp;yet&amp;nbsp;was mostly ignored until it was exploited.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
So ok: no TLS 1.0, no compression. Is that all?&lt;br /&gt;
&lt;br /&gt;
Well, we still haven't discussed the TLS MAC, which turns out to be in the wrong place -- it's applied&amp;nbsp;&lt;i&gt;before&lt;/i&gt;&amp;nbsp;the message is padded and encrypted. This placement can make the protocol vulnerable to&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Padding_oracle_attack"&gt;padding oracle attacks&lt;/a&gt;, which (amazingly) will even&amp;nbsp;&lt;a href="http://www.mics.org/getDocum.pdf?docid=449&amp;amp;docnum=1"&gt;work&lt;/a&gt;&lt;i&gt;&amp;nbsp;across handshakes. &lt;/i&gt;This last fact is significant, since TLS will abort the connection (and initiate a new handshake) whenever a decryption error occurs in the record layer. It turns out that this countermeasure is not sufficient.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To deal with this, recent versions of TLS have added the following patch: they require implementers to &lt;i&gt;hide&lt;/i&gt;&amp;nbsp;the cause of each decryption failure -- &lt;i&gt;i.e.,&lt;/i&gt;&amp;nbsp;make MAC errors indistinguishable from padding failures. And this isn't just a question of changing your error codes, since clever attackers can learn this information by measuring the &lt;i&gt;time&lt;/i&gt;&amp;nbsp;it takes to receive an error.&amp;nbsp;From the TLS 1.2 spec:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: Courier New, Courier, monospace; font-size: x-small;"&gt;In general, the best way to do this is to compute the MAC even if the padding is incorrect, and only then reject the packet.  For instance, if the pad appears to be incorrect, the implementation might assume a zero-length pad and then&amp;nbsp;compute the MAC.  &lt;b&gt;This&amp;nbsp;leaves a small timing channel, since MAC performance depends to some extent on the size of the data fragment, but it is not believed to be large enough to be exploitable&lt;/b&gt;.&lt;/span&gt;&lt;/blockquote&gt;
To sum up: TLS is insecure if your implementation leaks the cause of a decryption error, but careful implementations&amp;nbsp;can avoid leaking &lt;i&gt;much,&lt;/i&gt;&amp;nbsp;although&amp;nbsp;admittedly they probably will leak&amp;nbsp;&lt;i&gt;some --&lt;/i&gt; but hopefully not enough to be exploited.&amp;nbsp;Gagh!&lt;br /&gt;
&lt;br /&gt;
At this point, just take a deep breath and say '&lt;a href="http://everything2.com/title/spherical+horse"&gt;all horses are spherical&lt;/a&gt;' three times fast, cause that's the only way we're going to get through this.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Accentuating the positive&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Having been through the negatives, we're almost ready to say nice things about TLS. Before we do, let's just take a second to catch our breath and restate some of our basic assumptions:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;We're not using TLS 1.0 because it's broken.&lt;/li&gt;
&lt;li&gt;We're not using compression because &lt;i&gt;it's&lt;/i&gt;&amp;nbsp;broken.&lt;/li&gt;
&lt;li&gt;Our TLS implementation is &lt;i&gt;perfect&lt;/i&gt;&amp;nbsp;-- &lt;i&gt;i.e.,&lt;/i&gt;&amp;nbsp;doesn't leak any information about why a decryption failed&lt;i&gt;.&lt;/i&gt;&amp;nbsp;This is probably bogus, yet we've decided to look the other way.&lt;/li&gt;
&lt;li&gt;Oh yeah: we're using a secure block cipher and MAC (in the&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Pseudorandom_permutation"&gt;PRP&lt;/a&gt;&amp;nbsp;and UF-CMA sense).&lt;/li&gt;
&lt;/ol&gt;
And &lt;i&gt;now&lt;/i&gt;&amp;nbsp;we can say nice things. In fact, thanks to a &lt;a href="http://www.isg.rhul.ac.uk/~kp/mee-comp.pdf"&gt;recent paper&lt;/a&gt; by Kenny Paterson, Thomas Ristenpart and Thomas Shrimpton, we can say a few surprisingly positive things about TLS record encryption.&lt;br /&gt;
&lt;br /&gt;
What Paterson/Ristenpart/Shrimpton show is that TLS record encryption satisfies a notion they call '&lt;i&gt;length-hiding authenticated encryption&lt;/i&gt;', or LHAE. This new (and admittedly made up) notion not only guarantees the confidentiality and authenticity of records, but ensures that the attacker can't tell &lt;i&gt;how long&lt;/i&gt;&amp;nbsp;they are. The last point seems a bit extraneous, but it's important in the case of certain TLS libraries like &lt;a href="http://www.gnu.org/software/gnutls/"&gt;GnuTLS&lt;/a&gt;, which actually add random amounts of padding to messages in order to disguise their length.&lt;br /&gt;
&lt;br /&gt;
There's one caveat to this proof: it only works in cases where the MAC has an output size that's&amp;nbsp;&lt;i&gt;greater or equal&lt;/i&gt;&amp;nbsp;to the cipher's block size. This is, needless to say, a totally bizarre and fragile condition for the security of a major protocol to hang on. And while the condition &lt;i&gt;does&lt;/i&gt;&amp;nbsp;hold for all of the real TLS ciphersuites we use -- &lt;i&gt;yay! --&lt;/i&gt;&amp;nbsp;this is more a happy accident than the result of careful design on anyone's part. It could easily have gone the other way.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;So how does the proof work?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Good question. Obviously the best way to understand the proof is to read&amp;nbsp;&lt;a href="http://www.isg.rhul.ac.uk/~kp/mee-comp.pdf"&gt;the paper itself&lt;/a&gt;. But I'd like to try to give an intuition.&lt;br /&gt;
&lt;br /&gt;
First of all, we can save a lot of time by starting with the fact that CBC-mode encryption is already known to be &lt;a href="http://www.isg.rhul.ac.uk/~kp/mee-comp.pdf"&gt;IND-CPA secure&lt;/a&gt;&amp;nbsp;if implemented with a secure block cipher (&lt;a href="http://en.wikipedia.org/wiki/Pseudorandom_permutation"&gt;PRP&lt;/a&gt;). This result tells us only that CBC is secure against &lt;i&gt;passive&lt;/i&gt; attackers who can request the encryption of chosen messages. (In fact, a properly-formed CBC mode ciphertext should be indistinguishable from a string of random bits.)&lt;br /&gt;
&lt;br /&gt;
The problem with plain CBC-mode is that these security results &lt;i&gt;don't&lt;/i&gt;&amp;nbsp;hold&amp;nbsp;in cases where the attacker can ask for the &lt;a href="http://en.wikipedia.org/wiki/Adaptive_chosen-ciphertext_attack"&gt;decryption of chosen ciphertexts&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
This limitation is due to CBC's&amp;nbsp;&lt;i&gt;&lt;a href="http://crypto.stackexchange.com/questions/3654/malleability-attacks-against-encryption-without-authentication"&gt;malleability&lt;/a&gt;&lt;/i&gt;&amp;nbsp;-- specifically, the&amp;nbsp;fact that an attacker can tamper with a ciphertext, then gain useful information by sending the result to be decrypted.&amp;nbsp;To show that TLS record encryption is secure, what we really want to prove is that tampering gives no useful results. More concretely, we want to show that asking for the decryption of a tampered ciphertext will always produce an error.&lt;br /&gt;
&lt;br /&gt;
We have a few things working in our favor. First, remember that the underlying&amp;nbsp;TLS record has a MAC on it. If the MAC is (UF-CMA) secure, then any ciphertext tampering that results in a change to this record data or its MAC will be immediately detected (and rejected) by the decryptor. This is good.&lt;br /&gt;
&lt;br /&gt;
Unfortunately the TLS MAC doesn't cover the padding. To continue our argument, we need to show that no attacker can produce a legitimate ciphertext, and that includes tampering that messes with the padding section of the message. Here again things look intuitively good for TLS. During decryption, the decryptor checks the last byte of the padded message to see how much padding there is, then verifies that all padding bytes contain the same numeric value. Any tampering that affects this section of the plaintext should either:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Produce inconsistencies in some padding bytes, resulting in a padding error, or&lt;/li&gt;
&lt;li&gt;Cause the wrong amount of padding to be stripped off, resulting in a MAC error.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Both of these error conditions will appear the same to the attacker, thanks to the requirement that TLS implementations &lt;i&gt;hide the reason for a decryption failure&lt;/i&gt;. Once again, the attacker should learn nothing useful.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This all seems perfectly intuitive, and you can imagine the TLS developers making exactly this argument as they wrote up the spec. However there's one small exception to the rule above, which can turn TLS implementations that add an unnecessarily &lt;i&gt;large&lt;/i&gt;&amp;nbsp;amount of padding to the plaintext. (For example, GnuTLS.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To give an example, let's say the unpadded record + MAC is 15 bytes. If we're using AES, then this plaintext can be padded with a single byte. Of course, if we're inclined to add extra padding, it could also be padded with &lt;i&gt;seventeen&lt;/i&gt;&amp;nbsp;bytes -- both are valid padding strings. The two possible paddings are presented below:&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-5pqza6vnJNE/UGVH88LwS8I/AAAAAAAAANU/_zU5di510z0/s1600/ciphertext.png" imageanchor="1"&gt;&lt;img border="0" height="64" src="http://2.bp.blogspot.com/-5pqza6vnJNE/UGVH88LwS8I/AAAAAAAAANU/_zU5di510z0/s640/ciphertext.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If the extra-long padding is used, the attacker could maul the longer ciphertext by &lt;i&gt;truncating it&lt;/i&gt;&amp;nbsp;-- throwing away the last 16-byte ciphertext block. Truncation is a viable way to maul CBC ciphertexts, since it has the same effect on the underlying plaintext. The CBC decryption of the truncated ciphertext would yield:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-SfMRSr3SetE/UGVIs-N7VOI/AAAAAAAAANc/w3ebXoSsA44/s1600/ciphertext2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="36" src="http://4.bp.blogspot.com/-SfMRSr3SetE/UGVIs-N7VOI/AAAAAAAAANc/w3ebXoSsA44/s320/ciphertext2.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Which not very useful, since the invalid padding would lead to a decryption error. However, the attacker could fix this -- this time, using the fact that TLS can be mauled by flipping bits in the last byte of the Initialization Vector. Such an attack would allow the attacker to convert that trailing 0x10 into an 0x00. This result&amp;nbsp;is now&amp;nbsp;valid ciphertext that will&amp;nbsp;&lt;i&gt;not&lt;/i&gt;&amp;nbsp;produce an error on decryption.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-Iqvlqk9hR-0/UGVJtczDHEI/AAAAAAAAANk/fQDhKw4lNek/s1600/ciphertext3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="36" src="http://3.bp.blogspot.com/-Iqvlqk9hR-0/UGVJtczDHEI/AAAAAAAAANk/fQDhKw4lNek/s320/ciphertext3.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So what has the attacker learned by this attack? In practice, not very much. Mostly what they know is the length of the original ciphertext -- so much for GnuTLS's attempt to disguise the length. But more fundamentally: this attacker of 'mauling' the ciphertext totally screws up the nice idea we were going for in our proof.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So the question is: can this attack be used against real TLS? And this is where the funny restriction about MAC size comes into play.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You see, if TLS MACs are always bigger than a ciphertext block, then all messages will obey a strict rule: no padding will ever appear in the first block of the CBC ciphertext.&lt;br /&gt;
&lt;br /&gt;
Since the padding is now guaranteed to start in the second (or later) block of the CBC ciphertext, the attacker cannot 'tweak' it by modifying the IV (this attack only works against the first block of the plaintext).&amp;nbsp;Instead, they would have to tamper with&lt;i&gt;&amp;nbsp;a ciphertext block.&lt;/i&gt;&amp;nbsp;And in CBC mode, tampering with ciphertext blocks has consequences! Such a tweak &lt;i&gt;will&lt;/i&gt;&amp;nbsp;allow the attacker to change padding bytes, but as a side effect it will cause one entire block of the record or MAC to be randomized when decrypted. And what Paterson/Ristenpart/Shrimpton prove is that this 'damage' will inevitably lead to a MAC error.&lt;br /&gt;
&lt;br /&gt;
This 'lucky break' means that an attacker &lt;i&gt;can't &lt;/i&gt;successfully tamper with a&amp;nbsp;CBC-mode TLS ciphertext. And that allows us to push our way to a true proof of the CBC-mode TLS ciphersuites. By contrast, if the MAC was only 80 bits (as it is in some &lt;a href="http://en.wikipedia.org/wiki/IPsec"&gt;IPSEC&lt;/a&gt; configurations), the proof would not be possible. So it goes.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now I realize this has all been pretty wonky, and that's kind of the point! The moral to the story is that we shouldn't need this proof in the first place! What it illustrates is how&amp;nbsp;fragile and messy the TLS design really is, and how (once again) it achieves security by luck and the skin of its teeth, rather than secure design.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What about stream ciphers?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The good news -- to some extent -- is that none of the above problems apply to stream ciphers, which don't attempt to hide the record length, and don't use padding in the first place. So the security of these modes is much 'easier' to argue.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
Of course, this is only 'good news' if you believe that the stream ciphers included with TLS are good in the first place. The problem, of course, is that the major supported stream cipher is RC4. I will leave it to the reader to decide if that's a&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/2011/12/whats-deal-with-rc4.html"&gt;worthwhile tradeoff&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;In conclusion&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
There's probably a lot more that can be said about TLS record encryption, but really... I think this post is probably more than anyone (outside of the academic community and a few TLS obsessives) has ever wanted to read on the subject.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
In the next posts I'm going to come back to the much more exciting Diffie-Hellman handshake and then try to address the $1 million and $10 million questions respectively. First: does anyone really implement TLS securely? And second: when can we replace this thing?&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;Notes:&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;*&lt;/i&gt; One thing I don't mention in this post is the TLS 1.0 'empty fragment' defense, which actually works against BEAST and has been deployed in OpenSSL for several years. The basic idea is to encrypt an empty record of length 0 before each record goes over the wire. In practice, this results in a full record structure with a MAC, and prevents attackers from exploiting the residue bug. Although nobody I know of has ever proven it secure, the proof is relatively simple and can be arrived at using standard techniques.&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/MGF42Uw8Mj8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/4863933530784447856/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/09/on-provable-security-of-tls-part-2.html#comment-form" title="8 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/4863933530784447856?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/4863933530784447856?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/MGF42Uw8Mj8/on-provable-security-of-tls-part-2.html" title="On the (provable) security of TLS: Part 2" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-5pqza6vnJNE/UGVH88LwS8I/AAAAAAAAANU/_zU5di510z0/s72-c/ciphertext.png" height="72" width="72" /><thr:total>8</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/09/on-provable-security-of-tls-part-2.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MMRHY-fCp7ImA9WhJbGEk.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-8973531406988295253</id><published>2012-09-06T15:40:00.000-07:00</published><updated>2012-09-28T08:18:05.854-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-28T08:18:05.854-07:00</app:edited><title>On the (provable) security of TLS: Part 1</title><content type="html">&lt;div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.ibm.com/developerworks/webservices/library/ws-ssl-security/flow.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="182" src="http://www.ibm.com/developerworks/webservices/library/ws-ssl-security/flow.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
If you sit a group of cryptographers down and ask them whether &lt;a href="http://en.wikipedia.org/wiki/Transport_Layer_Security"&gt;TLS&lt;/a&gt; is &lt;i&gt;provably&amp;nbsp;&lt;/i&gt;secure, you're liable to get a whole variety of answers. Some will just giggle. Others&amp;nbsp;will give a long explanation that hinges on the definitions of '&lt;i&gt;prove&lt;/i&gt;' and '&lt;i&gt;secure&lt;/i&gt;'. What you will probably not get&amp;nbsp;is a clear, straight answer.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
In fairness, this is because there &lt;i&gt;is&lt;/i&gt;&amp;nbsp;no clear, straight answer. Unfortunately, like all the things you really need to know in life,&amp;nbsp;&lt;i&gt;it's&amp;nbsp;complicated.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Still, just because something's complicated doesn't mean that we get to ignore it. And the security of TLS is something we really shouldn't ignore&amp;nbsp;-- &amp;nbsp;because&amp;nbsp;TLS has quietly become the most important and trusted security protocol on the Internet. While plenty of security experts will point out the danger of &lt;i&gt;improperly configured&lt;/i&gt;&amp;nbsp;TLS setups, most tend to see (properly configured) TLS as a kind of gold standard -- and it's now used in all kinds of applications that its designers would probably never have envisioned.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
And this is a problem, because (as &lt;a href="https://twitter.com/marshray"&gt;Marsh&lt;/a&gt; points out) TLS (or rather, SSL) was originally designed to secure $50 credit card transactions, something it didn't always do very well. Yes, it's improved over the years. On the other hand, gradual improvement is no substitute for correct and &lt;i&gt;provable&lt;/i&gt; security design.&lt;br /&gt;
&lt;br /&gt;
All of which brings us to the subject of this -- and subsequent -- posts: even though TLS &lt;i&gt;wasn't&lt;/i&gt; designed to be a provably-secure protocol, what can we say about it today? More specifically, can we &lt;i&gt;prove&lt;/i&gt;&amp;nbsp;that the current version of TLS is cryptographically secure? Or is there something fundamental that's holding it back?&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;The world's briefest overview of TLS&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If you're brand new to TLS, this may not be the right post for you. Still, if you're looking for a brief refresher, here it is:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;TLS is a protocol for establishing secure (Transport layer) communications between two parties, usually denoted as a Client and a Server.&lt;/i&gt;&lt;/blockquote&gt;
The protocol consists of several phases. The first is a negotiation, in which the two peers agree on which cryptographic capabilities they mutually support -- and try to decide whether a connection is even possible. Next, the parties engage in a Key Establishment protocol that (if successful) &lt;i&gt;authenticates&lt;/i&gt;&amp;nbsp;one or both of the parties, typically using &lt;a href="http://en.wikipedia.org/wiki/Public_key_certificate"&gt;certificates&lt;/a&gt;, and allows the pair to establish a shared Master Secret. This is done using a handful of key agreement protocols, including various flavors of Diffie-Hellman key agreement and an RSA-based protocol.&lt;br /&gt;
&lt;br /&gt;
Finally, the parties use this secret to derive encryption and/or authentication keys for secure communication. The rest of the protocol is very boring -- all data gets encrypted and sent over the wire in a (preferably) secure and authenticated form. This image briefly sums it up:&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://publib.boulder.ibm.com/infocenter/wmqv7/v7r1/topic/com.ibm.mq.doc/sy10660a.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="299" src="http://publib.boulder.ibm.com/infocenter/wmqv7/v7r1/topic/com.ibm.mq.doc/sy10660a.gif" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Overview of TLS (&lt;a href="http://publib.boulder.ibm.com/infocenter/wmqv7/v7r1/index.jsp?topic=%2Fcom.ibm.mq.doc%2Fsy10660_.htm"&gt;source&lt;/a&gt;)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;b&gt;So why can't we prove it secure?&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
TLS sounds very simple. However, it turns out that you run into a few serious problems when you try to assemble a security proof for the protocol.&amp;nbsp;Probably the most serious holdup stems from the &lt;i&gt;age&lt;/i&gt; of the cryptography used in TLS. To borrow a term from&amp;nbsp;&lt;a href="http://2011.indocrypt.org/slides/rescorla.pdf"&gt;Eric Rescorla&lt;/a&gt;: TLS's crypto is downright&lt;i&gt;&amp;nbsp;prehistoric.&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
This can mostly be blamed on TLS's predecessor &lt;a href="http://en.wikipedia.org/wiki/Transport_Layer_Security#SSL_1.0.2C_2.0_and_3.0"&gt;SSL&lt;/a&gt;, which was designed in the mid-90s -- a period better known as '&lt;i&gt;the dark ages of industrial crypto&lt;/i&gt;'.&amp;nbsp;All sorts of &lt;a href="http://en.wikipedia.org/wiki/MS-CHAP"&gt;bad stuff&lt;/a&gt; went down during this time, much of which we've (thankfully) forgotten about. But TLS is the exception! Thanks to years of&amp;nbsp;backwards compatibility requirements, it's become a sort of time capsule for all sorts of&amp;nbsp;embarrassing&amp;nbsp;practices that should have died a long slow death in a moonlit graveyard.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
For example:&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;The vast majority of TLS handshakes use an RSA padding scheme known as&amp;nbsp;&lt;a href="http://www.iacr.org/archive/eurocrypt2000/1807/18070374-new.pdf"&gt;PKCS#1v1.5&lt;/a&gt;. PKCS#1v1.5 is awesome -- if you're teaching a class on how to attack cryptographic protocols. In all other circumstances it sucks. The scheme was &lt;a href="http://spar.isi.jhu.edu/~mgreen/bleichenbacher.pdf"&gt;first broken&lt;/a&gt; all the way back in&amp;nbsp;&lt;i&gt;1998&lt;/i&gt;. The attacks have&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/2012/06/bad-couple-of-years-for-cryptographic.html"&gt;gotten better&lt;/a&gt;&amp;nbsp;since.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;The (AES)-&lt;a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29"&gt;CBC&lt;/a&gt; encryption used by SSL and TLS 1.0 is just plain broken, a fact that was recently exploited by the &lt;a href="http://ssl.entrust.net/blog/?p=977"&gt;BEAST attack.&lt;/a&gt; TLS 1.1 and 1.2 fix the glaring bugs, but&amp;nbsp;&lt;i&gt;still&lt;/i&gt; use non-standard message&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/2011/11/bram-cohen-corrects-me.html"&gt;authentication&lt;/a&gt;&amp;nbsp;techniques, that have &lt;a href="http://www.isg.rhul.ac.uk/~kp/dtls.pdf"&gt;&lt;i&gt;themselves&lt;/i&gt;&amp;nbsp;been attacked&lt;/a&gt;.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Today -- in the year 2012 -- the 'recommended' patch for the above issue is to switch to &lt;a href="http://blog.cryptographyengineering.com/2011/12/whats-deal-with-rc4.html"&gt;RC4&lt;/a&gt;. Really, the less said about this the better.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Although each of these issues have all been exploited in the past, I should be clear that&amp;nbsp;&lt;i&gt;current &lt;/i&gt;implementations do address them. Not by fixing the bugs, mind you -- but&lt;i&gt;&amp;nbsp;&lt;/i&gt;rather&lt;i&gt;,&amp;nbsp;&lt;/i&gt;by applying band-aid patches to thwart the known attacks. This &lt;i&gt;mostly&lt;/i&gt; works in practice, but&lt;i&gt;&amp;nbsp;&lt;/i&gt;it makes security proofs an exercise in frustration.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
The second obstacle to proving things about TLS is the sheer &lt;i&gt;complexity &lt;/i&gt;of the protocol. In fact, TLS&amp;nbsp;is&amp;nbsp;less a 'protocol'&amp;nbsp;than it is a Frankenstein monster of of options and sub-protocols, all of which provide a breeding ground for &lt;a href="http://www.schneier.com/paper-ssl.pdf"&gt;bugs and attacks&lt;/a&gt;. Unfortunately, the vast majority of academic security analyses just ignore all of the 'extra junk' in favor of addressing the core crypto.&amp;nbsp;Which is good! But also&amp;nbsp;too bad -- since these options where practically every &lt;a href="http://www.cosic.esat.kuleuven.be/publications/thesis-208.pdf"&gt;&lt;i&gt;real&lt;/i&gt;&amp;nbsp;attack&lt;/a&gt; on TLS has taken place.&lt;br /&gt;
&lt;br /&gt;
Lastly, it's not clear quite&amp;nbsp;which &lt;i&gt;definition of security&lt;/i&gt;&amp;nbsp;we should even use in our analysis. In part this is because the TLS specification doesn't exactly scream '&lt;i&gt;I want to be analyzed&lt;/i&gt;'. In part it's because definitions have been evolving over the years.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;So you're saying TLS is unprovable?&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
No. I'm just lowering expectations.&lt;br /&gt;
&lt;br /&gt;
The truth is there's a lot we &lt;i&gt;do&lt;/i&gt;&amp;nbsp;know about the security of TLS, some of it surprisingly positive. Several academic works have even given us formal 'proofs' of certain aspects of the protocol. The devil here lies mainly in the definitions of&amp;nbsp;'&lt;i&gt;proof&lt;/i&gt;' and -- worryingly -- '&lt;i&gt;TLS&lt;/i&gt;'.&lt;br /&gt;
&lt;br /&gt;
For those who don't live for the details, I'm going to start off by listing a few of the major known results here. In no particular order, these are:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;If&amp;nbsp;&lt;i&gt;properly&lt;/i&gt; &lt;i&gt;implemented &lt;/i&gt;with a secure block cipher,&amp;nbsp;the&amp;nbsp;TLS 1.1/1.2 record encryption protocol&amp;nbsp;&lt;a href="http://www.isg.rhul.ac.uk/~kp/mee-comp.pdf"&gt;meets a strong definition of (chosen ciphertext attack) security&lt;/a&gt;. Incidentally, the mechanism is also capable of hiding the &lt;i&gt;length&lt;/i&gt;&amp;nbsp;of the encrypted records. (&lt;i&gt;Nobody&lt;/i&gt;&amp;nbsp;even bothers to claim this for TLS 1.0 -- which&amp;nbsp;&lt;i&gt;everybody&lt;/i&gt; agrees &lt;a href="http://blog.cryptographyengineering.com/2011/09/brief-diversion-beast-attack-on-tlsssl.html"&gt;is busted&lt;/a&gt;.)&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;A shiny &lt;a href="http://eprint.iacr.org/2011/219.pdf"&gt;new result&lt;/a&gt; from CRYPTO 2012 tells us that (a stripped-down version of) the&amp;nbsp;Diffie-Hellman handshake&amp;nbsp;(DHE)&amp;nbsp;is provably secure in the 'standard model' of computation. Moreover, combined with result &lt;i&gt;(1)&lt;/i&gt;, the authors prove that TLS provides a &lt;i&gt;secure channel&lt;/i&gt; for exchanging messages. Yay! &lt;br /&gt;&lt;br /&gt;This result is important -- or would be, if more people actually used DHE. Unfortunately, at this point more people bike to work with their &lt;i&gt;cat&lt;/i&gt; than use TLS-DHE.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;At least &lt;a href="http://eprint.iacr.org/2008/236.pdf"&gt;two&lt;/a&gt;&amp;nbsp;&lt;a href="http://eprint.iacr.org/2008/251.pdf"&gt;excellent&lt;/a&gt; works have tackled the &lt;a href="http://en.wikipedia.org/wiki/RSA_(algorithm)"&gt;RSA&lt;/a&gt;-based handshake, which is the one most people actually use. Both works succeed in proving it secure, under one condition:&lt;i&gt;&amp;nbsp;you don't actually use it!&lt;/i&gt;&amp;nbsp;To be more explicit: both proofs quietly replace the PKCS#v1.5 padding (in actual use) with something better. If only the real world worked this way.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;All is not lost, however: back in 2003 Jonnson and Kaliski were able to&amp;nbsp;&lt;a href="http://www.iacr.org/archive/crypto2002/24420127/24420127.pdf"&gt;prove security for the&amp;nbsp;&lt;i&gt;real&amp;nbsp;&lt;/i&gt;RSA handshake&lt;/a&gt;&lt;i&gt;&amp;nbsp;without&lt;/i&gt;&amp;nbsp;changing the protocol. Their proof is in the&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/2011/09/what-is-random-oracle-model-and-why.html"&gt;random oracle model&lt;/a&gt;&amp;nbsp;(no biggie),&amp;nbsp;but unfortunately it requires a &lt;i&gt;new&lt;/i&gt; &lt;a href="http://en.wikipedia.org/wiki/Computational_hardness_assumption"&gt;number-theoretic hardness assumption&lt;/a&gt;&amp;nbsp;that nobody has talked about or revisited since. In practice this may be fine! Or it may not be. Nobody's been able to investigate it further, since every researcher who tried to look into it...&amp;nbsp;&lt;i&gt;wound up dead. &lt;/i&gt;(No, I'm just kidding. Although that would be cool.)&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;A handful of works have attempted to analyze the &lt;i&gt;entirety&lt;/i&gt;&amp;nbsp;of SSL or TLS using machine-assisted proof techniques.&amp;nbsp;This is incredibly ambitious, and moreover it's probably the only real way to tackle the problem. Unfortunately, the proofs hugely simplify the underlying cryptography, and thus don't cover the full range of attacks. Moreover, only computers can read them.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
While I'm sure there are some important results I'm missing here, this is probably enough to take us 95% of the way to the 'provable' results on TLS. What remains is the details.&lt;br /&gt;
&lt;br /&gt;
And oh boy, are there details. More than I can fit in one post. So I'm going to take this one chunk at a time, and see how many it takes.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;An aside: what are we trying to prove, anyway?&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
One thing I've been a bit fast-and-loose on is: what are we actually&amp;nbsp;&lt;i&gt;proving&lt;/i&gt;&amp;nbsp;about these protocols in the first place, anyway? The question deserves at least a few words -- since it's received thousands in the academic literature.&lt;br /&gt;
&lt;br /&gt;
One obvious definition of security can be summed up as 'an attacker on the wire can't intercept modify data', or otherwise learn the key being established. But simply keeping the data secret isn't enough; there's also a matter of freshness. Consider the following attack:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;I record communications between a legitimate client and his bank's server, in which the client requests $5,000 to be transferred from her account to mine.&lt;/li&gt;
&lt;li&gt;Having done this, I&amp;nbsp;&lt;i&gt;replay&lt;/i&gt;&amp;nbsp;the client's messages to the server a hundred times. If all goes well, I'm &lt;i&gt;&amp;nbsp;a whole lot&lt;/i&gt;&amp;nbsp;richer.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Now this is just one example, but it shows that the protocol does require a bit of thinking. Taking this a step farther, we might also want to ensure that the master secret is &lt;i&gt;random, &lt;/i&gt;meaning even&amp;nbsp;if (one of) the Client or Server are dishonest, they can't force the key to a chosen value. And beyond that, what we &lt;i&gt;really&lt;/i&gt;&amp;nbsp;care about is that the protocol data exchange is secure.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Various works take different approaches to defining security for TLS. This is not surprising, given the '&lt;a href="http://tools.ietf.org/html/rfc5246#appendix-F"&gt;security analysis&lt;/a&gt;' provided in the TLS spec itself is so incomplete that &lt;i&gt;we don't quite know what the protocol was intended to do in the first place&lt;/i&gt;. We'll come back to these definitional issues in a bit.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;The RSA handshake&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
TLS supports a number of different ciphersuites and handshake protocols. As I said above, the RSA-based handshake is the most popular one -- almost an absurd margin. Sure, a few sites&amp;nbsp;(notably &lt;a href="http://googleonlinesecurity.blogspot.com/2011/11/protecting-data-for-long-term-with.html"&gt;Google&lt;/a&gt;) have recently begun supporting DHE and ECDH across the board. For everyone else there's RSA.&lt;br /&gt;
&lt;br /&gt;
So RSA seems as good a place as any to start. Even better, if you ignore client authentication and strip the handshake down to its core, it's a pretty simple protocol:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-z_9MsafFfG4/UEkSodWR4bI/AAAAAAAAAM8/1N-P2y9Wwtk/s1600/TLSDiagram3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="174" src="http://3.bp.blogspot.com/-z_9MsafFfG4/UEkSodWR4bI/AAAAAAAAAM8/1N-P2y9Wwtk/s320/TLSDiagram3.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
Clearly the 'engine' of this protocol is the third step, where the Client picks a random 48-byte pre-master secret (PMS) and encrypts it under the server's key. Since the Master Secret is derived from this (plus the Client and Server Randoms), an attacker who can't 'break' this encryption shouldn't be able to derive the Master Key and thus produce the correct check messages at the bottom.&lt;br /&gt;
&lt;br /&gt;
So now for the $10,000,000 question: can we prove that the RSA encryption secure? And the simple answer is &lt;i&gt;no, we can't&lt;/i&gt;. This is because the encryption scheme used by TLS is RSA-PKCS#1v1.5, which is not -- by itself -- provably secure.&lt;br /&gt;
&lt;br /&gt;
Indeed, it's worse than that. Not only is PKCS#1v1.5 not provably secure, but it's actually provably &lt;i&gt;insecure. &lt;/i&gt;All the way back in 1998 Daniel Bleichenbacher demonstrated that PKCS#1v1.5 ciphertexts can be gradually &lt;i&gt;decrypted&lt;/i&gt;, by repeatedly modifying them and sending the modified versions to be decrypted. If the decryptor (the server in this case) reveals whether the ciphertext is correctly formatted, the attacker can actually recover the encrypted PMS.&lt;br /&gt;
&lt;br /&gt;
&lt;b style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 12.800000190734863px; line-height: 14.399999618530273px; text-align: center;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0x 00 02 { at least 8 non-zero random bytes } 00 { two-byte length } { 48-byte PMS }&lt;/b&gt;&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;span style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"&gt;&lt;span style="font-size: 12.727272033691406px; line-height: 14.393939018249512px;"&gt;&lt;i&gt;RSA-PKCS #1v1.5 encryption padding for TLS&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
Modern SSL/TLS servers are wise to this attack, and they deal with it in a simple way. Following decryption of the RSA ciphertext they check the padding. If it does &lt;i&gt;not&lt;/i&gt;&amp;nbsp;have the form above, they select a &lt;i&gt;random&lt;/i&gt; PMS and go forward with the calculation of the Master Secret using this bogus replacement value. In principle, this means that the server calculates a basically random key -- and the protocol doesn't fail until the very end.&lt;br /&gt;
&lt;br /&gt;
In practice this seems to work, but proving it is tricky! For one thing, it's not enough to treat the RSA encryption as a black box -- all of these extra steps &lt;i&gt;and&lt;/i&gt;&amp;nbsp;the subsequent&amp;nbsp;calculation of the Master Secret are now intimately bound up with the security of the protocol, in a not-necessarily-straightforward way.&lt;br /&gt;
&lt;br /&gt;
There are basically two ways to deal with this. Approach #1, taken by&amp;nbsp;&lt;a href="http://eprint.iacr.org/2008/236"&gt;Morrisey, Smart and Warinschi&lt;/a&gt;&amp;nbsp;and &lt;a href="http://eprint.iacr.org/2008/251.pdf"&gt;Gajek &lt;i&gt;et al.&lt;/i&gt;&lt;/a&gt;, follows what I call the '&lt;i&gt;wishful thinking&lt;/i&gt;' paradigm. Both show that if you&amp;nbsp;&lt;i&gt;modify&lt;/i&gt; the encryption scheme used in TLS -- for example, by eliminating the 'random' encryption padding, or swapping in a CCA-secure scheme like&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Optimal_asymmetric_encryption_padding"&gt;RSA-OAEP&lt;/a&gt;&amp;nbsp;-- the handshake is secure under a reasonable definition. This is very interesting from an academic point of view; it just doesn't tell us much about&amp;nbsp;&lt;i&gt;TLS.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Fortunately there's also the '&lt;i&gt;realist&lt;/i&gt;' approach. This is embodied by an older CRYPTO paper by&amp;nbsp;&lt;a href="http://www.iacr.org/archive/crypto2002/24420127/24420127.pdf"&gt;Jonnson and Kaliski&lt;/a&gt;. These authors&amp;nbsp;considered the entirety of the&amp;nbsp;TLS handshake, and showed that &lt;i&gt;(1) &lt;/i&gt;if you model the PRF (or part of it) as a random oracle, and &lt;i&gt;(2) &lt;/i&gt;assume some very non-standard number-theoretic assumptions, &lt;i&gt;and&lt;/i&gt;&amp;nbsp;(more importantly)&lt;i&gt;&amp;nbsp;(3) the TLS implementation is perfect, then&amp;nbsp;&lt;/i&gt;you can actually prove that the RSA handshake is secure.&lt;br /&gt;
&lt;br /&gt;
This is a big deal!&lt;br /&gt;
&lt;br /&gt;
Unfortunately it has a few problems. First, it's highly inelegant, and basically depends on all the parts working in tandem. If any part &lt;i&gt;fails&lt;/i&gt;&amp;nbsp;to work properly -- if for example, the server leaks any information that could indicate whether the encryption padding is valid or not -- then the entire thing crashes down. That the combined protocol works is in fact, more an accident of fate than the result of any real security engineering.&lt;br /&gt;
&lt;br /&gt;
Secondly, the reduction extremely 'loose'. This means that &lt;i&gt;a literal interpretation&lt;/i&gt;&amp;nbsp;would imply that we should be using ginormous RSA keys, much bigger than we do today. We obviously don't pay attention to this result, and we're probably right not to. Finally, it requires that we adopt odd number-theoretic assumption involving a 'partial-RSA decision oracle', something that quite frankly, feels kind of funny. While we're all guilty of making up an assumption from time to time, I've never seen this assumption either before or since, and it's significant that the scheme has no straightforward reduction the&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/RSA_problem"&gt;RSA problem&lt;/a&gt;&amp;nbsp;(even in the random oracle model), something we would get if we used RSA-OAEP.&lt;br /&gt;
&lt;br /&gt;
If your response is: &lt;i&gt;who cares -- &lt;/i&gt;well, you may be right. But this is where we stand.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;So where are we?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Good question. We've learned quite a lot actually. When I started this post my assumption was that TLS was going to be a giant unprovable mess. Now that I'm halfway through this summary, my conclusion is that TLS is, well, still mostly a giant mess -- but one that smacks of potential.&lt;br /&gt;
&lt;br /&gt;
Of course so far I've only covered a small amount of ground. We still have yet to cover the big results, which deal with the Diffie-Hellman protocol, the &lt;i&gt;actual encryption of data &lt;/i&gt;(yes, important!) and all the other crud that's in the real protocol.&lt;br /&gt;
&lt;br /&gt;
But those results will have to wait until the next post: I've hit my limit for today.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://blog.cryptographyengineering.com/2012/09/on-provable-security-of-tls-part-2.html"&gt;Click here for Part 2.&lt;/a&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/z5arvxElHoI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/8973531406988295253/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/09/on-provable-security-of-tls-part-1.html#comment-form" title="14 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/8973531406988295253?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/8973531406988295253?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/z5arvxElHoI/on-provable-security-of-tls-part-1.html" title="On the (provable) security of TLS: Part 1" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-z_9MsafFfG4/UEkSodWR4bI/AAAAAAAAAM8/1N-P2y9Wwtk/s72-c/TLSDiagram3.jpg" height="72" width="72" /><thr:total>14</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/09/on-provable-security-of-tls-part-1.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4ESXw5eyp7ImA9WhJVFkQ.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-7580854160892813113</id><published>2012-09-02T21:56:00.001-07:00</published><updated>2012-09-03T11:45:08.223-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-03T11:45:08.223-07:00</app:edited><title>Hey Amazon: Banning Security Researchers Isn't Making Us Safer</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://img356.imageshack.us/img356/3516/i000772big5dz.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="150" src="http://img356.imageshack.us/img356/3516/i000772big5dz.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
Readers of this blog may recall that I'm a&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/2012/02/rsa-keys-no-insight-whatsoever.html"&gt;big fan&lt;/a&gt;&amp;nbsp;of the RSA-key 'cracking' research of Nadia Heninger, Zakir Durumeric, Eric Wustrow and Alex Halderman. To briefly sum it up: these researchers scanned the entire Internet, discovering&amp;nbsp;&lt;a href="http://it.slashdot.org/story/12/02/15/1540212/factorable-keys-twice-as-many-but-half-as-bad"&gt;nearly &lt;i&gt;30,000&lt;/i&gt; weak RSA keys&lt;/a&gt;&amp;nbsp;installed on real devices. Which they then factored.&lt;br /&gt;
&lt;br /&gt;
In the fast-paced world of security, this is already yesterday's news. The problems&amp;nbsp;&lt;a href="http://it.slashdot.org/story/12/02/15/1540212/factorable-keys-twice-as-many-but-half-as-bad"&gt;have been responsibly disclosed and repaired&lt;/a&gt;, and the&amp;nbsp;manufacturers have promised not to make, well, &lt;i&gt;this&lt;/i&gt; particular set of mistakes again. &lt;a href="https://factorable.net/weakkeys12.extended.pdf"&gt;The research&lt;/a&gt;&amp;nbsp;even received the Best Paper award at &lt;a href="https://www.usenix.org/conference/usenixsecurity12"&gt;Usenix Security&lt;/a&gt;.** So you might ask why I'm writing about it now. And the answer is: I'm not.&lt;br /&gt;
&lt;br /&gt;
What I'm writing about today is not the research itself, but rather: &lt;i&gt;the&amp;nbsp;blowback from the research&lt;/i&gt;. You see, Heninger &lt;i&gt;et al. &lt;/i&gt;were able to conduct their work mostly thanks resources rented from Amazon's &lt;a href="http://aws.amazon.com/ec2/"&gt;Elastic Compute Cloud&lt;/a&gt; (EC2). And in response, Amazon has booted them off the service.&lt;br /&gt;
&lt;br /&gt;
This is a real drag, and not just for the researchers in question.&lt;br /&gt;
&lt;br /&gt;
Cloud services like EC2 are a huge resource for ethical security researchers. They help us to learn things about the Internet on a scale that we could never accomplish with the limited resources in most university labs. Cloud services also give us access to software and hardware that would be nigh on impossible to justify to a grant committee, stuff like&amp;nbsp;&lt;a href="http://aws.amazon.com/about-aws/whats-new/2010/11/15/announcing-cluster-gpu-instances-for-amazon-ec2/"&gt;GPU cluster instances&lt;/a&gt; which are invaluable to cryptographers who want to run specialized cracking tasks.&lt;br /&gt;
&lt;br /&gt;
But more importantly: the rise of cloud computing has given rise to a &lt;i&gt;whole new class of security threat&lt;/i&gt;:&amp;nbsp;things we never had to worry about before, like&amp;nbsp;&lt;a href="https://www.usenix.org/conference/usenixsecurity12/stealthmem-system-level-protection-against-cache-based-side-channel"&gt;side-channel&lt;/a&gt; and &lt;a href="https://www.usenix.org/conference/usenixsecurity12/whispers-hyper-space-high-speed-covert-channel-attacks-cloud"&gt;covert channel&lt;/a&gt; attacks between co-located VMs. Securing the &lt;i&gt;cloud itself&lt;/i&gt;&amp;nbsp;requires real-world analysis, and this means that researchers have to be trusted to do some careful, non-malicious work on actual platforms like EC2. Unfortunately this is just kind of research that the Heninger &lt;i&gt;et al. &lt;/i&gt;ban could serve to&amp;nbsp;discourage.&lt;br /&gt;
&lt;br /&gt;
Now, I don't pretend that I know all the details of this particular case. I haven't spoken to the researchers about it, and although the paper makes their scan&amp;nbsp;&lt;i&gt;seem&lt;/i&gt; pretty benign, it's always possible that it was more aggressive than it should have been.*&lt;br /&gt;
&lt;br /&gt;
Moreover, I can't challenge Amazon's right to execute this ban. In fact their&amp;nbsp;&lt;a href="http://aws.amazon.com/aup/"&gt;Acceptable Use Policy&lt;/a&gt;&amp;nbsp;explicitly prescribes security scans under a section titled 'No Security Violations':&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="background-color: white; font-family: verdana, arial, helvetica, clean, sans-serif; font-size: 12px; line-height: 18px; list-style: none; margin: 0px 0px 3px 20px; padding: 0px 0px 0px 30px;"&gt;
&lt;li style="background-image: url(http://d36cz9buwru1tt.cloudfront.net/orange_bullet.png); background-position: 0px 0.5em; background-repeat: no-repeat no-repeat; list-style: none outside; margin: 0px; padding: 0px 0px 0px 13px;"&gt;&lt;strong&gt;Unauthorized Access.&lt;/strong&gt;&amp;nbsp;Accessing or using any System without permission, including attempting to probe, scan, or test the vulnerability of a System or to breach any security or authentication measures used by a System.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
The question here is not whether Amazon &lt;i&gt;can&lt;/i&gt;&amp;nbsp;do this. It's whether their&amp;nbsp;-- or anyone else's -- interests are being served by actually going through with such a ban. The tangible result of this one particular research effort is that thousands of vulnerable systems became secure. The potential result of Amazon's ban is that &lt;i&gt;millions&lt;/i&gt;&amp;nbsp;of systems may remain insecure.&lt;br /&gt;
&lt;br /&gt;
Am I saying that Amazon should let researchers run amok on their network? Absolutely not. But there has to be a balance between unfettered access and an outright ban. I think we'll all be better off if Amazon can clearly articulate where that balance is, and provide us with a way to find it.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Update (9/3): &lt;/b&gt;Kenn White points me to this nice &lt;a href="http://conference.hitb.org/hitbsecconf2012ams/materials/D2T1%20-%20Marco%20Balduzzi%20-%20SatanCloud.pdf"&gt;analysis of the public EC2 image-set&lt;/a&gt;. The authors&amp;nbsp;mention that they worked closely with Amazon Security. So maybe this is a starting point.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;i&gt;Notes:&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
* Admittedly, this part is a little bit ambiguous in their paper. NMAP host discovery can be somewhere between gentle poke and 'active scrub' depending on the options you've set.&lt;br /&gt;
&lt;br /&gt;
** In case you haven't seen it, you may also want to check out Nadia's (NSFW?) Usenix/CRYPTO &lt;a href="http://crypto.2012.rump.cr.yp.to/87d4905b6d2fbc6ad2389debb73f7035.pdf"&gt;rump session talk&lt;/a&gt;.&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/quEoPCoWxWQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/7580854160892813113/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/09/amazons-acceptable-usage-policy-isnt.html#comment-form" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/7580854160892813113?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/7580854160892813113?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/quEoPCoWxWQ/amazons-acceptable-usage-policy-isnt.html" title="Hey Amazon: Banning Security Researchers Isn't Making Us Safer" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><thr:total>5</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/09/amazons-acceptable-usage-policy-isnt.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEMGR3gzeyp7ImA9WhJUF08.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-5915883735745399610</id><published>2012-08-27T10:05:00.000-07:00</published><updated>2012-09-15T08:20:26.683-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-15T08:20:26.683-07:00</app:edited><title>Reposted: A cryptanalysis of HDCP v2.1</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.benshoemate.com/wp-content/uploads/2008/11/hdcp-video-error.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="197" src="http://www.benshoemate.com/wp-content/uploads/2008/11/hdcp-video-error.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;Update 8/27:&lt;/b&gt;&lt;i&gt;&amp;nbsp;This post was originally published three weeks ago under a different title. I subsequently&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/2012/08/a-note-on-missing-post.html"&gt;took it down&lt;/a&gt; to give affected vendors time to patch the bugs. As a result of the notification, Digital Content Protection LLC (DCP) has updated the spec to v2.2.&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Contrary to my understanding when I wrote the original post, HDCP v2 actually &lt;/i&gt;is&lt;i&gt; used by a number of devices&lt;/i&gt;&lt;i&gt;.&amp;nbsp;&lt;/i&gt;&lt;i&gt;I would like to give credit to Alon Ziv at&amp;nbsp;&lt;a href="http://www.discretix.com/"&gt;Discretix&lt;/a&gt;, who had previously discovered the Locality Check issue, and to&amp;nbsp;&lt;/i&gt;&lt;i&gt;&lt;a href="http://www.kaiser.cx/"&gt;Martin Kaiser&lt;/a&gt;&amp;nbsp;who &lt;a href="http://www.kaiser.cx/hdcp2.html"&gt;experimentally verified the master secret issue&lt;/a&gt; on a&amp;nbsp;&lt;/i&gt;&lt;i&gt;European&amp;nbsp;&lt;/i&gt;&lt;i&gt;Samsung TV and a Galaxy S II.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Finally, I would like to thank Hanni Fakhoury and Marcia Hofmann at the &lt;a href="https://www.eff.org/"&gt;Electronic Frontier Foundation&lt;/a&gt; for all of their helpful advice. The EFF is one of the only organizations that represents security researchers. Please consider&amp;nbsp;&lt;a href="https://supporters.eff.org/donate"&gt;donating&lt;/a&gt;&amp;nbsp;so they can keep doing it!&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Over the past couple of weeks I've mostly been blogging about &lt;a href="http://blog.cryptographyengineering.com/2012/07/four-theories-on-cryptography-of-star.html"&gt;inconsequential things&lt;/a&gt;. Blame summer for this -- it's hard to be serious when it's 104 degrees out. But also, the world just hasn't been supplying much in the way of interesting stuff to write about.&lt;br /&gt;
&lt;br /&gt;
Don't get me wrong, this is a good thing! But in a (very limited) way it's also too bad. One of the best ways to learn about security systems is to take them apart and see &lt;i&gt;how they fail&lt;/i&gt;.&amp;nbsp;While individual systems can be patched, the knowledge we collect from the process is invaluable.&lt;br /&gt;
&lt;br /&gt;
Fortunately for us, we're not completely helpless. If we want to learn something about system analysis, there are plenty of opportunities right out there in the wild. The best place to start is by finding a public protocol that's been published, but not implemented yet. Download the spec and start poking!&lt;br /&gt;
&lt;br /&gt;
This will be our task today. The system we'll be looking at is completely public, and (to the best of my knowledge) has not yet been deployed anywhere (&lt;b&gt;Update: &lt;/b&gt;&lt;i&gt;see note above&lt;/i&gt;&lt;b&gt;)&lt;/b&gt;. It's good practice for protocol cryptanalysis because it includes all kinds of complicated crypto that hasn't been seriously reviewed by anyone yet.&lt;br /&gt;
&lt;br /&gt;
(Or at least, my Google searches aren't turning anything up. I'm very willing to be corrected.)&lt;br /&gt;
&lt;br /&gt;
Best of all, I've never looked at this system before. So whatever we find (or don't find), we'll be doing it together.&lt;br /&gt;
&lt;br /&gt;
A note: this obviously &lt;i&gt;isn't&lt;/i&gt; going to be a short post. And the TL;DR is that there &lt;i&gt;is&lt;/i&gt;&amp;nbsp;no TL;DR. This post isn't about finding bugs (although we certainly will), it's about learning how the process works. And that's something you do for its own sake.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;HDCPv2&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The protocol we'll be looking at today is the&amp;nbsp;&lt;a href="http://%28high%20bandwidth%20digital%20content%20protection%20protocol%29/"&gt;High Bandwidth Digital Content Protection&lt;/a&gt;&amp;nbsp;(HDCP)&amp;nbsp;protocol&amp;nbsp;&lt;i&gt;version&lt;/i&gt;&amp;nbsp;&lt;i&gt;2&lt;/i&gt;. Before you get excited, let&amp;nbsp;me sort out a bit of confusion. We are not going to talk about HDCP&amp;nbsp;&lt;i&gt;version 1&lt;/i&gt;, which is the famous protocol you probably have running in your TV right now.&lt;br /&gt;
&lt;br /&gt;
HDCP&lt;i&gt;v1&lt;/i&gt; was&amp;nbsp;&lt;a href="http://www.cypherpunks.ca/~iang/pubs/hdcp-drm01.pdf"&gt;analyzed way back in 2001&lt;/a&gt;&amp;nbsp;and found to be wanting. Things got much worse in 2010 when someone&amp;nbsp;&lt;a href="http://www.theinquirer.net/inquirer/news/1733749/intel-confirms-hdcp-cracked"&gt;leaked the HDCPv1 master key&lt;/a&gt;&amp;nbsp;-- effectively killing&amp;nbsp;the whole system.&lt;br /&gt;
&lt;br /&gt;
What we'll be looking at today is the&amp;nbsp;replacement:&lt;i&gt;&amp;nbsp;&lt;/i&gt;HDCP v2. This protocol is everything that its predecessor was not.&amp;nbsp;For one thing, it uses standard encryption: RSA, AES and HMAC-SHA256. It employs a certificate model with a revocation list. It also adds exciting features like 'localization', which allows an HDCP transmitter to determine &lt;i&gt;how far away&lt;/i&gt;&amp;nbsp;a receiver is, and stop people from piping HDCP content over the Internet. (In case they actually wanted to do that.)&lt;br /&gt;
&lt;br /&gt;
HDCPv2 has barely hit shelves yet (&lt;b&gt;Update:&lt;/b&gt;&amp;nbsp;though it was recently selected as the transport security for MiraCast). The Digital Content Protection licensing authority has been keeping a pretty up-to-date set of draft&amp;nbsp;&lt;a href="http://www.digital-cp.com/hdcp_technologies"&gt;protocol specifications on their site&lt;/a&gt;. The latest version at the time of this writing is&amp;nbsp;&lt;a href="http://www.digital-cp.com/files/static_page_files/DA8B373E-1A4B-B294-D097C162586197C7/HDCP%20Interface%20Independent%20Adaptation%20Specification%20Rev2_1.pdf"&gt;2.1&lt;/a&gt;, and it gives us a nice opportunity to see how industry 'does' protocols.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;An overview of the protocol&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
As cryptographic protocols go, HDCPv2 has a pretty simple set of requirements. It's designed to protect &amp;nbsp;high-value content running over a wire (or wireless channel) between a transmitter (&lt;i&gt;e.g., &lt;/i&gt;a&lt;i&gt; &lt;/i&gt;DVD player)&amp;nbsp;and a receiver (a TV). The protocol accomplishes the following operations:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Exchanging and verifying public key certificates.&lt;/li&gt;
&lt;li&gt;Establishing shared symmetric keys between the transmitter and receiver.&lt;/li&gt;
&lt;li&gt;Caching shared keys for use in later sessions.&lt;/li&gt;
&lt;li&gt;Verifying that a receiver is &lt;i&gt;local&lt;/i&gt;, i.e., you're not trying to proxy the data to some remote party via the Internet.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
These functions are accomplished via three (mostly) separate protocols: a public-key Authenticated Key Agreement (AKE) protocol,&amp;nbsp;a pairing protocol, where the derived key is cached for later use, and a &lt;i&gt;locality check protocol&lt;/i&gt;&amp;nbsp;to ensure that the devices are physically close.&lt;br /&gt;
&lt;br /&gt;
I'm going to take these protocols one at a time, since each one involves its own messages and assumptions.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Phase (1): Authenticated Key Agreement (AKE)&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
The core of HDCPv2 is a custom key exchange protocol, which looks quite a bit like TLS. (In fact, the resemblance is so strong that you wonder why the designers didn't just &lt;i&gt;use&lt;/i&gt;&amp;nbsp;TLS and save a lot of effort.) It looks like this:&lt;/div&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-NjOyVX2lxE8/UCBANtiVQLI/AAAAAAAAALs/joubo4MI7_s/s1600/hdcp_nostored.tiff" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="315" src="http://3.bp.blogspot.com/-NjOyVX2lxE8/UCBANtiVQLI/AAAAAAAAALs/joubo4MI7_s/s400/hdcp_nostored.tiff" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;HDCPv2 key agreement protocol (&lt;a href="http://www.digital-cp.com/files/static_page_files/DA8B373E-1A4B-B294-D097C162586197C7/HDCP%20Interface%20Independent%20Adaptation%20Specification%20Rev2_1.pdf"&gt;source&lt;/a&gt;). Click the image to enlarge.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Now, there's lots going on here. But if we only look at the crypto, the summary is this:&lt;br /&gt;
&lt;br /&gt;
The transmitter starts by sending 'AKE_Init' along with a random 64-bit nonce &lt;b&gt;R_tx&lt;/b&gt;.&amp;nbsp;In response, the receiver sends back its certificate, which contains its RSA public key and device serial number, all signed by the HDCP licensing authority.&lt;br /&gt;
&lt;br /&gt;
If the certificate checks out (and is not revoked), the transmitter generates a random 128-bit 'master secret' &lt;b&gt;K_m&lt;/b&gt; and encrypts it under the receiver's public key. The result goes back to the receiver, which decrypts it.&amp;nbsp;Now both sides share &lt;b&gt;K_m&lt;/b&gt; and &lt;b&gt;R_tx&lt;/b&gt;, and can&amp;nbsp;&lt;i&gt;combine&lt;/i&gt; them using a wacky custom&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Key_derivation_function"&gt;key derivation function&lt;/a&gt;. The result is a shared a session key &lt;b&gt;K_d&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
The last step is to&amp;nbsp;verify that both sides got the same&amp;nbsp;&lt;b&gt;K_d&lt;/b&gt;. The receiver computes a value H', using&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Hash-based_message_authentication_code"&gt;HMAC-SHA256&lt;/a&gt;&amp;nbsp;on inputs&amp;nbsp;&lt;b&gt;K_d,&amp;nbsp;&lt;/b&gt;&lt;b&gt;R_tx &lt;/b&gt;and some other stuff. If the receiver's H' matches a similar value computed at the transmitter, the protocol succeeds.&lt;br /&gt;
&lt;br /&gt;
Simple, right?&lt;br /&gt;
&lt;br /&gt;
Note that I've ignored one last message in the protocol, which turns out to be &lt;i&gt;very&lt;/i&gt; &lt;i&gt;important&lt;/i&gt;. Before we go there, let's pause and take stock.&lt;br /&gt;
&lt;br /&gt;
If you're paying close attention, you've noticed a couple of worrying things:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;The transmitter doesn't authenticate itself &lt;i&gt;at all. &lt;/i&gt;This means anyone can pretend to be a transmitter.&lt;/li&gt;
&lt;li&gt;None of the handshake messages (&lt;i&gt;e.g.,&lt;/i&gt; AKE_Transmitter_Info) appear to be authenticated. An attacker can modify them as they transit the wire.&lt;/li&gt;
&lt;li&gt;The session key &lt;b&gt;K_d&lt;/b&gt; is based solely on the inputs supplied by the transmitter. The receiver &lt;i&gt;does&lt;/i&gt;&amp;nbsp;generate a nonce &lt;b&gt;R_rx&lt;/b&gt;, but it isn't used in the above protocol.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
None of these things &lt;i&gt;by themselves&lt;/i&gt;&amp;nbsp;are a problem, but they make me suspicious.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Phase (2): Pairing&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Public-key operations are &lt;i&gt;expensive&lt;/i&gt;. And you only really need to do them once. The designers recognized this, and added a feature called 'pairing' to cache the derived&amp;nbsp;&lt;b&gt;K_m&lt;/b&gt;&amp;nbsp;for use in later sessions. This is quite a bit like what TLS does for session resumption.&lt;br /&gt;
&lt;br /&gt;
However, there's one catch, and it's where things get complicated: some receivers &lt;i&gt;don't have&lt;/i&gt; a secure non-volatile storage area for caching keys.&amp;nbsp;This didn't phase the designers, who came up with a 'clever' workaround for the problem: the receiver can simply ask the &lt;i&gt;transmitter&lt;/i&gt; to store &lt;b&gt;K_m&lt;/b&gt;&amp;nbsp;for it.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
To do this, the receiver &lt;i&gt;encrypts&lt;/i&gt; &lt;b&gt;K_m&lt;/b&gt; under a fixed internal AES key &lt;b&gt;K_h&lt;/b&gt;&amp;nbsp;(which is derived&amp;nbsp;by hashing the receiver's RSA private key). In the last message of the AKE protocol the receiver now sends this ciphertext back to the transmitter for storage. This appears in the protocol diagram as the ciphertext&amp;nbsp;&lt;b&gt;E(K_h, K_m).&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The obvious intuition here is that K_m is securely encrypted.&amp;nbsp;&lt;i&gt;What could possibly go wrong? &lt;/i&gt;The answer is to ask &lt;i&gt;how&lt;/i&gt;&amp;nbsp;&lt;b&gt;K_m&lt;/b&gt; is encrypted. And that's where things get worrying.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
According to the spec,&amp;nbsp;&lt;b&gt;K_m&lt;/b&gt; is encrypted using AES in what amounts to &lt;a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29"&gt;CTR mode&lt;/a&gt;, where the 'counter' value is defined as some value&amp;nbsp;&lt;b&gt;m.&amp;nbsp;&lt;/b&gt;On closer inspection,&lt;b&gt;&amp;nbsp;m&lt;/b&gt;&amp;nbsp;turns out to be just the transmitter nonce &lt;b&gt;R_tx&lt;/b&gt; padded with 0 bits&lt;i&gt;. &lt;/i&gt;So that's simple. Here's what it looks like:&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-KlrsFQYLCjY/UCEbcjRwHvI/AAAAAAAAAL8/7YEvAgsF93Q/s1600/km_encryption.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="200" src="http://2.bp.blogspot.com/-KlrsFQYLCjY/UCEbcjRwHvI/AAAAAAAAAL8/7YEvAgsF93Q/s200/km_encryption.png" width="153" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Encryption of the master key K_m with the receiver key K_h. The value &lt;i&gt;m&lt;/i&gt;&amp;nbsp;is equal to (R_tx || 0x000000000000000).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Now, CTR is a perfectly lovely encryption mode provided that you obey one unbreakable rule: the counter value must never be re-used. Is that satisfied here? Recall that the counter &lt;b&gt;m&lt;/b&gt;&amp;nbsp;is actually&amp;nbsp;&lt;i&gt;chosen&lt;/i&gt; by another party -- the transmitter. This is worrying. If the transmitter wants, it could certainly ask the receiver to encrypt anything it wants under the same counter.&lt;br /&gt;
&lt;br /&gt;
Of course, an honest transmitter won't do this. But what about a &lt;i&gt;dishonest&lt;/i&gt;&amp;nbsp;transmitter? Remember that the transmitter is &lt;i&gt;not&lt;/i&gt; authenticated by HDCP. The upshot is&lt;span style="background-color: white; color: #333333; font-family: inherit; line-height: 17.600000381469727px;"&gt;&amp;nbsp;that &lt;/span&gt;&lt;span style="color: #333333; font-family: inherit; line-height: 17.600000381469727px;"&gt;an attacker&lt;/span&gt;&lt;span style="background-color: white; color: #333333; font-family: inherit; line-height: 17.600000381469727px;"&gt;&amp;nbsp;can pretend to be a transmitter, and&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white; color: #333333; font-family: inherit; line-height: 17.600000381469727px;"&gt;submit &lt;/span&gt;&lt;i style="color: #333333; font-family: inherit; line-height: 17.600000381469727px;"&gt;her own&lt;/i&gt;&lt;span style="background-color: white; color: #333333; font-family: inherit; line-height: 17.600000381469727px;"&gt;&amp;nbsp;&lt;b&gt;K_m&lt;/b&gt; values to be encrypted under&amp;nbsp;&lt;b&gt;K_h &lt;/b&gt;and &lt;b&gt;m&lt;/b&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white; color: #333333; font-family: inherit; line-height: 17.600000381469727px;"&gt;Even this might be survivable, if it weren't for one last fact:&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;&amp;nbsp;&lt;/span&gt;&lt;i style="font-family: inherit;"&gt;in CTR mode,&amp;nbsp;encryption and decryption are the same operation.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;All of this leads to the following attack:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style="font-family: inherit;"&gt;Observe a legitimate communication between a transmitter and receiver. Capture the values &lt;b&gt;R_tx&lt;/b&gt; and &lt;b&gt;E(K_h, K_m) &lt;/b&gt;as they go over the wire.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: inherit;"&gt;Now: pretend to be a transmitter and initiate your &lt;i&gt;own&lt;/i&gt;&amp;nbsp;session&amp;nbsp;with the receiver.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: inherit;"&gt;Replay the captured &lt;b&gt;R_tx&lt;/b&gt; as your initial transmitter nonce. When you reach the point where you pick the master secret, &lt;i&gt;don't&lt;/i&gt;&amp;nbsp;use a random value for &lt;b&gt;K_m&lt;/b&gt;. Instead,&amp;nbsp;set &lt;b&gt;K_m&lt;/b&gt;&amp;nbsp;equal to&amp;nbsp;the ciphertext&amp;nbsp;&lt;b&gt;E(K_h, K_m) &lt;/b&gt;that you captured earlier. Recall that this ciphertext has the form:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;AES(K_h, R_Tx || 000...) ⊕ K_m&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;Now encrypt this value under the receiver's public key and send it along.&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: inherit;"&gt;Sooner or later the receiver will encrypt the 'master secret' you chose above under its internal key &lt;b&gt;K_h. &lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;The resulting ciphertext can be expanded to:&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;b style="font-family: inherit;"&gt;&lt;br /&gt;AES(K_h, R_Tx || 000...) ⊕&amp;nbsp;AES(K_h, R_Tx || 000...)&amp;nbsp;&lt;/b&gt;&lt;b style="font-family: inherit;"&gt;⊕&amp;nbsp;&lt;/b&gt;&lt;b style="font-family: inherit;"&gt;K_m&lt;/b&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;Thanks to the beauty of XOR, the first two terms of this ciphertext simply cancel out. The result is the original &lt;b&gt;K_m&lt;/b&gt; from the first session! &lt;i&gt;Yikes!&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;&lt;i&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: inherit;"&gt;This is a huge problem for two reasons. First, &lt;b&gt;K_m&lt;/b&gt; is used to derive the session keys used to encrypt HDCP content, which means that you may now be able to decrypt any past HDCP content traces. And even worse,&amp;nbsp;thanks to the 'pairing' process, you may be able to use this captured &lt;b&gt;K_m&lt;/b&gt; to initiate or respond to further sessions involving this transmitter.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;Did I mention that protocols are &lt;i&gt;hard&lt;/i&gt;?&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;&lt;b&gt;Phase (3): The Locality Check&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;For all practical purposes, the attack above should be our stopping point. Once you have the stored&amp;nbsp;&lt;b&gt;K_m&lt;/b&gt;&amp;nbsp;you can derive the session keys and basically do whatever you want. But just for fun, let's go on and see what else we can find.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;At its heart, the locality check is a pretty simple thing. Let's assume the transmitter and receiver are both trusted, and have successfully established a session key &lt;b&gt;K_d&amp;nbsp;&lt;/b&gt;by running the AKE protocol above. The locality check is designed to ensure that the receiver is nearby -- specifically, that it can provide a cryptographic response to a &lt;/span&gt;&lt;i style="font-family: inherit;"&gt;challenge, &lt;/i&gt;&lt;span style="font-family: inherit;"&gt;and can do it in &amp;lt; 7 milliseconds. This is a short enough time that it should prevent people from piping HDCP over a WAN connection.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;(Why anyone would want to do this is a mystery to me.)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;In principle the locality check should be simple. In practice, it turns out to be pretty complicated. &lt;/span&gt;&lt;span style="font-family: inherit;"&gt;Here's the 'standard' protocol:&lt;/span&gt;&lt;/div&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-5IOSyga3vLY/UCEyjN-GhVI/AAAAAAAAAMU/Mnje3j5z7NU/s1600/localitycheck_normal.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;img border="0" height="120" src="http://4.bp.blogspot.com/-5IOSyga3vLY/UCEyjN-GhVI/AAAAAAAAAMU/Mnje3j5z7NU/s400/localitycheck_normal.png" width="400" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;&lt;span style="font-family: inherit;"&gt;Simple version of the locality check. &lt;b&gt;K_d&lt;/b&gt; is a shared key and &lt;b&gt;R_rx&lt;/b&gt; is a receiver nonce.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;Now this isn't too bad: in fact, it's about the simplest challenge-response protocol you can imagine. The transmitter generates a random nonce &lt;b&gt;R_n&lt;/b&gt; and sends it to the receiver. The receiver has 7 milliseconds to kick back a response &lt;b&gt;L'&lt;/b&gt;, which is computed as HMAC-SHA256 of {the session key &lt;b&gt;K_d&lt;/b&gt;, challenge nonce&amp;nbsp;&lt;b&gt;R_n&lt;/b&gt;, and a&amp;nbsp;&lt;i&gt;'receiver nonce'&lt;/i&gt; &lt;b&gt;R_rx&lt;/b&gt;}. You may recall that the receiver nonce was chosen during the AKE.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;So far this looks pretty hard to beat.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;But here's a wrinkle: some devices are slow. Consider that the 7 milliseconds must the round-trip communication time,&amp;nbsp;&lt;i&gt;as well as&lt;/i&gt;&amp;nbsp;&lt;i&gt;the time required to compute the HMAC&lt;/i&gt;. There is a very real possibility that some slower, embedded devices might be not be able to respond in time.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: inherit;"&gt;Will HDCP provide a second, optional protocol to deal with those devices? You bet it will.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;The second protocol allows the receiver to&amp;nbsp;&lt;/span&gt;&lt;i style="font-family: inherit;"&gt;pre-compute&amp;nbsp;&lt;/i&gt;&lt;span style="font-family: inherit;"&gt;the HMAC response before the timer starts ticking. Here's what &lt;/span&gt;&lt;i style="font-family: inherit;"&gt;it&lt;/i&gt;&lt;span style="font-family: inherit;"&gt;&amp;nbsp;looks like:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-AB7SyqbLL10/UCEygi0QXVI/AAAAAAAAAMM/JIPozxPbeak/s1600/localitycheck_pc.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;img border="0" height="180" src="http://1.bp.blogspot.com/-AB7SyqbLL10/UCEygi0QXVI/AAAAAAAAAMM/JIPozxPbeak/s400/localitycheck_pc.png" width="400" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;&lt;span style="font-family: inherit;"&gt;'Precomputed' version of the protocol.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style="font-family: inherit;"&gt;This is &lt;i&gt;nearly&lt;/i&gt;&amp;nbsp;the same protocol, with a few small differences. Notably,&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;the transmitter gives the receiver all the time it wants to compute the HMAC. The timer doesn't start until the receiver says it's ready.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;Of course, there has to be &lt;i&gt;something&lt;/i&gt;&amp;nbsp;keeping the RTT under 7ms. In this case the idea is to keep the receiver from speaking until it's received some authenticator from the transmitter. This consists of the&amp;nbsp;&lt;/span&gt;&lt;i style="font-family: inherit;"&gt;least significant&lt;/i&gt;&lt;span style="font-family: inherit;"&gt; 128-bits of the expected HMAC result (&lt;b&gt;L'&lt;/b&gt;), which is computed in the same way as above. The receiver won't speak until it sees those bits. Then it&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;'ll it kick back its own response, which consists of&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;the &lt;i&gt;most-significant&lt;/i&gt; 128 bits of the same value.&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;Ok, so here we have a protocol that's much more complicated. But considered its own, this one looks pretty ok by me.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;But here's a funny question:&amp;nbsp;&lt;i&gt;what if&amp;nbsp;we try running both protocols at once&lt;/i&gt;?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;No, I'm not being ridiculous. You see, it turns out that the receiver and transmitter get to &lt;i&gt;negotiate &lt;/i&gt;which protocol they support. By default they run the 'simple' protocol above. If both support the pre-computed version, they must indicate this in the AKE_Transmitter_Info and AKE_Receiver_Info messages sent during the handshake.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;This leads to the following conjecture: what if, as a man-in-the-middle attacker, we can convince the transmitter to run the 'pre-computed' protocol. And at the same time, convince the receiver to run the 'simple' one? Recall that none of the protocol flags (transmitted during the AKE) are authenticated. We might be able to trick both sides into seeing a different view of the other's capabilities.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;Here's the setup: we have a receiver running in China, and a transmitter located in New York. We're a man-in-the-middle sitting next to the transmitter. We want to convince the transmitter that the receiver is close -- close enough to be on a LAN, for example. Consider the following attack:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style="font-family: inherit;"&gt;Modify the message flags so that the transmitter thinks we're running the pre-computed protocol. Since it thinks we're running the pre-computed protocol, it will hand us &lt;b&gt;R_n&lt;/b&gt; and then give us &lt;i&gt;all the time in the world&lt;/i&gt; to do our pre-computation.&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: inherit;"&gt;Now convince the receiver to run the 'simple' protocol. Send &lt;b&gt;R_n&lt;/b&gt; to it, and wait for the receiver to send back the HMAC result (L').&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: inherit;"&gt;Take a long bath, mow the lawn. Watch Season 1 of&amp;nbsp;Game of Thrones.&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: inherit;"&gt;At your leisure, send the RTT_READY message to the transmitter, which has been politely waiting for the receiver to finish the pre-computation&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: inherit;"&gt;The transmitter will now send us some bits. &lt;i&gt;Immediately&lt;/i&gt;&amp;nbsp;send it back the most significant bits of the value L', which we got in step (2).&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: inherit;"&gt;Send video to China.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;span style="font-family: inherit;"&gt;Now this attack may not always work -- it hinges on whether we can convince the two parties to run different protocols.&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;Still, this is a great teaching example in that it illustrates a key problem in cryptographic protocol design:&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;parties &lt;i&gt;may not share the same view of what's going on&lt;/i&gt;.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: inherit;"&gt;A protocol designer's most important job is to ensure that such disagreements can never happen. The best way to do this is to ensure that there's only one view to be had -- in other words, dispense with all the options and write a single clear protocol. But if you must have options, make sure that the protocol only succeeds if both sides &lt;i&gt;agree&lt;/i&gt;&amp;nbsp;on what those options are. This is usually accomplished by authenticating the negotiation messages, but even this can be a hard, hard problem.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;Compared to the importance of learning those lessons, actually breaking localization is pretty trivial. It's a stupid feature anyway.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b style="font-family: inherit;"&gt;In Conclusion&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;This has been a long post. To the readers I have left at this point: thanks for sticking it out.&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;The only remaining thing I'd like to say is that this post is not intended to judge HDCPv2, or to make it look bad. It may or it may not be a good protocol, depending on whether I've understood the specification properly &lt;/span&gt;&lt;i style="font-family: inherit;"&gt;and&lt;/i&gt;&lt;span style="font-family: inherit;"&gt;&amp;nbsp;depending on whether the above flaws make it into real devices. Which, hopefully they won't now.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;What I've been trying to do is teach a basic lesson: &lt;/span&gt;&lt;i style="font-family: inherit;"&gt;protocols are hard&lt;/i&gt;&lt;span style="font-family: inherit;"&gt;. They can fail in ruinous, subtle, unexpected, exciting ways. The best cryptographers -- working with BAN logic analyzers and security proofs -- still make mistakes. If you don't have those tools,&amp;nbsp;&lt;/span&gt;steer&amp;nbsp;clear&lt;span style="font-family: inherit;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;The best 'fix' for the problem is to recognize how dangerous protocols can be,and to avoid designing your own. If you absolutely must do so, please try to make yours&amp;nbsp;&lt;/span&gt;&lt;i style="font-family: inherit;"&gt;as simple as possible&lt;/i&gt;&lt;span style="font-family: inherit;"&gt;. Too many people fail to grok this lesson, and the result is, well, HDCPv2.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;===&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: inherit;"&gt;&lt;b&gt;Update 8/27: &lt;/b&gt;As I mentioned above, DCP has released a new version of the specification. Version 2.2 includes several updates: it changes the encryption of Km to incorporate &lt;i&gt;both&lt;/i&gt;&amp;nbsp;the Transmitter and Receiver nonces. It also modifies the locality check to patch the bug described above. Both of these changes appear to mitigate the bugs above, at least in &lt;i&gt;new&lt;/i&gt;&amp;nbsp;devices.&lt;/span&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/u7puoCEPK94" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/5915883735745399610/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/08/reposted-cryptanalysis-of-hdcp-v2.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/5915883735745399610?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/5915883735745399610?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/u7puoCEPK94/reposted-cryptanalysis-of-hdcp-v2.html" title="Reposted: A cryptanalysis of HDCP v2.1" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-NjOyVX2lxE8/UCBANtiVQLI/AAAAAAAAALs/joubo4MI7_s/s72-c/hdcp_nostored.tiff" height="72" width="72" /><thr:total>6</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/08/reposted-cryptanalysis-of-hdcp-v2.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak4NSX47fip7ImA9WhJWE0U.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-93196339007504711</id><published>2012-08-18T23:29:00.003-07:00</published><updated>2012-08-19T08:09:58.006-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-19T08:09:58.006-07:00</app:edited><title>Dear Apple: Please set iMessage free</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.blogcdn.com/www.engadget.com/media/2011/06/stevejobswwdc2011liveblogkeynote0819.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="211" src="http://www.blogcdn.com/www.engadget.com/media/2011/06/stevejobswwdc2011liveblogkeynote0819.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
Normally I avoid complaining about Apple because &lt;i&gt;(a)&lt;/i&gt; there are plenty of other people carrying that flag, and &lt;i&gt;(b)&lt;/i&gt; I honestly like Apple and own numerous lovely iProducts. I'm even using one to write this post.&lt;br /&gt;
&lt;br /&gt;
Moroever, from a security point of view, there isn't that much to complain about.&amp;nbsp;Sure, Apple&amp;nbsp;has a few irritating habits -- &lt;a href="http://arstechnica.com/apple/2012/04/mac-trojan-exploits-unpatched-java-vulnerability-no-password-needed/"&gt;shipping old, broken versions of libraries&lt;/a&gt;&amp;nbsp;in its software, for example. But on the continuum of security crimes this stuff is at best a misdemeanor, maybe a half-step above '&lt;a href="http://en.wikipedia.org/wiki/Naming_law_in_Sweden"&gt;improper baby naming&lt;/a&gt;'. Everyone's software sucks, news at 11.&lt;br /&gt;
&lt;br /&gt;
There is, however,&amp;nbsp;&lt;i&gt;one&amp;nbsp;&lt;/i&gt;thing&amp;nbsp;that drives me absolutely nuts about Apple's security posture. You see, starting about a year ago Apple began operating one of the most widely deployed encrypted text message services in the history of mankind. So far so good. The problem is that&amp;nbsp;&lt;i&gt;they still won't properly explain how it works.&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
And nobody seems to care.&lt;br /&gt;
&lt;br /&gt;
I am, of course, referring to &lt;a href="http://en.wikipedia.org/wiki/IMessage"&gt;iMessage&lt;/a&gt;, which was deployed last year in &lt;a href="http://www.apple.com/ios/"&gt;iOS Version 5&lt;/a&gt;.&amp;nbsp;It allows --&amp;nbsp;nay, &lt;i&gt;encourages&lt;/i&gt;&amp;nbsp;-- users to avoid normal carrier &lt;a href="http://en.wikipedia.org/wiki/Short_Message_Service"&gt;SMS&lt;/a&gt;&amp;nbsp;text messages and to route their texts through Apple instead.&lt;br /&gt;
&lt;br /&gt;
Now, this is not a particularly new idea. But iMessage is special for two reasons. First it's built into the normal iPhone texting application and turned &lt;i&gt;on&lt;/i&gt; by default. When my Mom texts another Apple user, iMessage will automatically route her message over the Internet. She doesn't have to approve this, and honestly, probably won't even know the difference.&lt;br /&gt;
&lt;br /&gt;
Secondly, iMessage claims to bring '&lt;a href="http://www.apple.com/pr/library/2012/06/11Mountain-Lion-Available-in-July-From-Mac-App-Store.html"&gt;secure end-to-end encryption&lt;/a&gt;' (and authentication) to text messaging. In principle this is huge! True end-to-end encryption should protect you from eavesdropping even by Apple, who carries your message. Authentication should protect you from spoofing attacks.&amp;nbsp;This&amp;nbsp;stands in contrast to normal SMS which is often not encrypted at all.&lt;br /&gt;
&lt;br /&gt;
So why am I looking a gift horse in the mouth? iMessage will clearly save you a ton in texting charges and it will secure your messages for free. Some encryption is better than none, right?&lt;br /&gt;
&lt;br /&gt;
Well maybe.&lt;br /&gt;
&lt;br /&gt;
To me, the disconcerting thing about iMessage is how rapidly it's gone from &lt;i&gt;no deployment&lt;/i&gt;&amp;nbsp;to securing billions of text messages for millions of users. And this despite the fact that&amp;nbsp;the full protocol &lt;i&gt;has never been published by Apple &lt;/i&gt;or (to my knowledge) vetted by security experts. (Note: if I'm wrong about this, let me know and I'll eat my words.)&lt;br /&gt;
&lt;br /&gt;
What's worse is that Apple has been hyping iMessage as a secure protocol; they even propose it as a &lt;i&gt;solution&lt;/i&gt;&amp;nbsp;to some serious SMS spoofing bugs. &lt;a href="http://www.engadget.com/2012/08/18/apple-responds-to-iphone-text-message-spoofing/"&gt;For example&lt;/a&gt;:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="background-color: white; color: #6e6e6e; font-family: georgia; font-size: 14.399999618530273px; font-style: italic; line-height: 19px;"&gt;Apple takes security very seriously. &lt;b&gt;When using iMessage instead of SMS, addresses are verified which protects against these kinds of spoofing attacks&lt;/b&gt;. One of the limitations of SMS is that it allows messages to be sent with spoofed addresses to any phone, so we urge customers to be extremely careful if they're directed to an unknown website or address over SMS.&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;
And this makes me nervous. While iMessage may very well be as secure as Apple makes it out to be, there are plenty of reasons to give the protocol a second look.&lt;br /&gt;
&lt;br /&gt;
For one thing, &lt;a href="http://imfreedom.org/wiki/IMessage"&gt;it's surprisingly complicated&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
iMessage&amp;nbsp;is not just two phones talking to each other with TLS. If this &lt;a href="http://imfreedom.org/wiki/IMessage"&gt;partial reverse-engineering of the protocol&lt;/a&gt; (based on the MacOS Mountain Lion Messages client) is for real, then there are &lt;i&gt;lots&lt;/i&gt; of moving parts. TLS. Client certificates. Certificate signing requests. New certificates delivered via XML. Oh my.&lt;br /&gt;
&lt;br /&gt;
As a general rule, lots of moving parts means lots of &lt;a href="http://blog.cryptographyengineering.com/2012/08/a-note-on-missing-post.html"&gt;places for things to go wrong&lt;/a&gt;. Things that could seriously reduce the security of the protocol. And as far as I know, nobody's given this much of &amp;nbsp;a look. It's surprising.&lt;br /&gt;
&lt;br /&gt;
Moreover, there are some &lt;i&gt;very real&lt;/i&gt; questions about what powers Apple has when it comes to iMessage. In principle 'end-to-end' encryption should mean that &lt;i&gt;only&lt;/i&gt;&amp;nbsp;the end devices can read the connection. In practice this is almost certainly not the case with iMessage. A quick glance at the protocol linked above is enough to tell me that Apple operates as a &lt;a href="http://en.wikipedia.org/wiki/Certificate_authority"&gt;Certificate Authority&lt;/a&gt; for iMessage devices. And as a Certificate Authority, it may be able to substantially undercut the security of the protocol. When would Apple do this? How would it do this? Are we allowed to know?&lt;br /&gt;
&lt;br /&gt;
Finally, there have been several reports of iMessages &lt;a href="http://www.theverge.com/2012/2/3/2766734/accidental-espionage-imessage-iphone-theft-issue"&gt;going astray and even being delivered to the wrong (or stolen) devices&lt;/a&gt;. This stuff may all have a reasonable explanation, but it's yet another set of reasons why we it would be nice to&amp;nbsp;&lt;i&gt;understand&lt;/i&gt;&amp;nbsp;iMessage better than we do now if we're going to go around relying on it.&lt;br /&gt;
&lt;br /&gt;
So what's my point with all of this?&lt;br /&gt;
&lt;br /&gt;
This is obviously not a technical post. I'm not here to present answers, which is disappointing. If I knew the protocol maybe I'd have some. Maybe I'd even be saying good things about it.&lt;br /&gt;
&lt;br /&gt;
Rather, consider this post as a plea for help. iMessage is important. People use it. We &lt;i&gt;ought&lt;/i&gt;&amp;nbsp;to know how secure it is and what risks those people are taking by using it.&amp;nbsp;The best solution would be for Apple to simply release a detailed specification for the protocol -- even if they need to hold back a few key details. But if that's not possible, maybe we in the community should be doing more to find out.&lt;br /&gt;
&lt;br /&gt;
Remember, it's not just our security at stake. People we know are using these products. It would be awfully nice to know what that means.&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/svgOeOmUk5U" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/93196339007504711/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/08/dear-apple-please-set-imessage-free.html#comment-form" title="53 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/93196339007504711?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/93196339007504711?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/svgOeOmUk5U/dear-apple-please-set-imessage-free.html" title="Dear Apple: Please set iMessage free" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><thr:total>53</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/08/dear-apple-please-set-imessage-free.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C04DQXw4fip7ImA9WhJWEkw.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-3761553563615707666</id><published>2012-08-15T09:07:00.004-07:00</published><updated>2012-08-17T06:59:30.236-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-17T06:59:30.236-07:00</app:edited><title>On Gauss</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://upload.wikimedia.org/wikipedia/commons/thumb/3/33/Bendixen_-_Carl_Friedrich_Gau%C3%9F,_1828.jpg/220px-Bendixen_-_Carl_Friedrich_Gau%C3%9F,_1828.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="200" src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/33/Bendixen_-_Carl_Friedrich_Gau%C3%9F,_1828.jpg/220px-Bendixen_-_Carl_Friedrich_Gau%C3%9F,_1828.jpg" width="169" /&gt;&lt;/a&gt;&lt;/div&gt;
If you pay attention to this sort of thing, you've probably heard about the new &lt;a href="http://www.kaspersky.com/about/news/virus/2012/Kaspersky_Lab_and_ITU_Discover_Gauss_A_New_Complex_Cyber_Threat_Designed_to_Monitor_Online_Banking_Accounts"&gt;state-sponsored malware&lt;/a&gt;&amp;nbsp;that's making the rounds in the Middle East. It's called 'Gauss', and like its big brother &lt;a href="http://en.wikipedia.org/wiki/Flame_(malware)"&gt;Flame&lt;/a&gt;, it was&amp;nbsp;&lt;a href="http://www.securelist.com/en/downloads/vlpdfs/kaspersky-lab-gauss.pdf"&gt;discovered by Kaspersky Labs&lt;/a&gt;&amp;nbsp;(analysis at the link).&lt;br /&gt;
&lt;br /&gt;
I don't have much to say about Gauss that hasn't been covered elsewhere. Still, for those who don't follow this stuff routinely, I thought I might describe a couple of the neat things we've learned about it.&lt;br /&gt;
&lt;br /&gt;
Here's the nutshell summary: Gauss is your basic run-of-the-mill government-issued malware, highly modularized and linked to the same C&amp;amp;C infrastructure that Flame used. It seems mainly focused on capturing banking data, but (as I'll mention in a second) it may do other things. Unlike Flame, there's no evidence that Gauss uses&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/2012/06/flame-certificates-collisions-oh-my.html"&gt;colliding MD5 certificates&lt;/a&gt;&amp;nbsp;to get itself onto a host system. Though, in fairness, we may not yet have the complete picture at this point.&lt;br /&gt;
&lt;br /&gt;
So if there are no colliding certificates, what's interesting about Gauss? So far as I can tell, only two things. First, it installs a mystery font. Second -- and far more interesting -- it contains an encrypted payload.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Palida Narrow.&lt;/i&gt;&amp;nbsp;&lt;/b&gt;Every Gauss-infected system gets set up with a new font called&amp;nbsp;Palida Narrow, which appears to be a custom-generated variant of &lt;a href="http://%28in%20fact%2C%20palida%20narrow%20appears%20to%20be%20a%20version%20of%20lucida%20bright%20with%20%20certain%20mathematical%20symbols%20added%20or%20modified./"&gt;Lucida Bright&lt;/a&gt; with some unusual glyphs in it. From Kaspersky's &lt;a href="http://www.securelist.com/en/analysis/204792238/Gauss_Abnormal_Distribution"&gt;report&lt;/a&gt;:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;[Gauss] creates a new TrueType font file “%SystemRoot%\fonts\pldnrfn.ttf” (62 668 bytes long) from a template and &lt;b&gt;using&amp;nbsp;randomized data from the ShutdownInterval key&lt;/b&gt;.&lt;/i&gt;&lt;/blockquote&gt;
Now this looks exciting! Unfortunately Kaspersky has not explained how the randomization works, or indeed if the data is truly random. This leaves us with nothing to do but speculate.&lt;br /&gt;
&lt;br /&gt;
And plenty of folks have. Theories range from the practical (&lt;a href="http://blog.crysys.hu/2012/08/on-the-palida-narrow-mystery-of-gauss-malware-and-possible-remote-detection/"&gt;remote host detection&lt;/a&gt;)&amp;nbsp;to the slightly wild (on-site vulnerability fuzzing).&amp;nbsp;My favorite is the speculation that Palida is used&amp;nbsp;to &lt;a href="http://en.wikipedia.org/wiki/Steganography"&gt;steganographically&lt;/a&gt; fingerprint the author of certain printed materials. While this theory is almost certainly wrong, it's not completely nuts, and even has some precedent&amp;nbsp;&lt;a href="http://ieeexplore.ieee.org/xpl/login.jsp?tp=&amp;amp;arnumber=4299822&amp;amp;url=http%3A%2F%2Fieeexplore.ieee.org%2Fiel5%2F4299731%2F4299732%2F04299822.pdf%3Farnumber%3D4299822"&gt;in the research literature&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b style="font-style: italic;"&gt;The 'Godel' payload. &lt;/b&gt;For all the excitement about fonts, the big news of&amp;nbsp;Gauss is the presence of an&amp;nbsp;&lt;a href="https://www.securelist.com/en/blog/208193781/The_Mystery_of_the_Encrypted_Gauss_Payload"&gt;encrypted module called 'Godel'&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Godel should be setting your hair on fire, if only because it attempts to replicate itself via a vulnerability in the code that Windows uses to handle USB sticks. This&amp;nbsp;&lt;a href="http://www.symantec.com/connect/blogs/stuxnet-lnk-file-vulnerability"&gt;the very same vector&lt;/a&gt; that Stuxnet used to infect the air-gapped centrifuge controllers at Natanz. It's a good indicator that Godel is targeted at a similarly air-gapped system.&lt;br /&gt;
&lt;br /&gt;
Of course the question is: &lt;i&gt;which system&lt;/i&gt;?&amp;nbsp;Godel goes to great lengths to ensure that we don't know.&lt;br /&gt;
&lt;br /&gt;
Presumably the designers made this decision based on some bitter experience with Stuxnet, which didn't protect its code at all. The result in Stuxnet's case was that researchers quickly decompiled the payload and identified the parameters that it looked for in a target systems. Somebody -- presumably Stuxnet's handlers -- were unhappy about this: on July 15, 2010 a &lt;a href="http://www.vanityfair.com/culture/features/2011/04/stuxnet-201104"&gt;distributed denial of service attack&lt;/a&gt;&amp;nbsp;crippled the industrial control mailing listservs where this was being discussed.&lt;br /&gt;
&lt;br /&gt;
To avoid a repeat of this episode, Gauss's designers chose to encrypt the Godel payload under a key derived from a specific configuration on the targeted computer.&lt;br /&gt;
&lt;br /&gt;
The details &lt;a href="https://www.securelist.com/en/blog/208193781/The_Mystery_of_the_Encrypted_Gauss_Payload"&gt;can be found in this Kaspersky post&lt;/a&gt;.&amp;nbsp;To make a long story short, Godel derives an encryption key by repeatedly MD5 hashing a series of (salted) executable filenames and paths located on the target system. Only a valid entry will unlock the program sections, allowing Godel to do its job.&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="https://www.securelist.com/en/images/pictures/klblog/208193783.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="124" src="https://www.securelist.com/en/images/pictures/klblog/208193783.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Example of the salted file path/executable name pair. From &lt;a href="https://www.securelist.com/en/blog/208193781/The_Mystery_of_the_Encrypted_Gauss_Payload"&gt;Kaspersky&lt;/a&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
The key derivation process is performed using &lt;strike&gt;1000&lt;/strike&gt;&amp;nbsp;10,000&amp;nbsp;iterations of MD5. The resulting key is fed to &amp;nbsp;RC4. While the use of RC4 and MD5 may seem a little bit archaic (c'mon guys, get with the 21st century!), it likely reflects a decision to use the Microsoft&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Microsoft_CryptoAPI"&gt;CryptoAPI&lt;/a&gt; across a broad range of Windows versions rather than some sort cryptographic retro-fetish.&lt;br /&gt;
&lt;br /&gt;
The real question is: how well does it work?&lt;br /&gt;
&lt;br /&gt;
Probably very well, with caveats.&amp;nbsp;Kaspersky says they're &lt;a href="http://www.securelist.com/en/blog/208193781/The_Mystery_of_the_Encrypted_Gauss_Payload"&gt;looking for a world-class cryptographer&lt;/a&gt; to help them crack the code. What they should really be looking for is someone with a world-class GPU.&lt;br /&gt;
&lt;br /&gt;
As best I can see, the only limitation of Gauss's approach is that the designers &lt;i&gt;should&amp;nbsp;&lt;/i&gt;have used a more time-intensive function to derive their keys. &lt;strike&gt;1000&lt;/strike&gt; 10,000 iterations of MD5 sounds like a lot, but really it isn't; not in a world with efficient GPUs that &lt;a href="http://aws.amazon.com/about-aws/whats-new/2010/11/15/announcing-cluster-gpu-instances-for-amazon-ec2/"&gt;you can rent&lt;/a&gt;.&amp;nbsp;This code won't be broken based on weaknesses in RC4 or MD5. It will be broken by exhaustively searching the file path/name space using a GPU (or even FPGA)-based system, or possibly just getting lucky.&lt;br /&gt;
&lt;br /&gt;
No doubt Kaspersky is working on such a project right now. If we learn anything more about the mystery of Godel, it will almost certainly come from that work.&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/ygPg6jdmPDE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/3761553563615707666/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/08/on-gauss.html#comment-form" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/3761553563615707666?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/3761553563615707666?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/ygPg6jdmPDE/on-gauss.html" title="On Gauss" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><thr:total>5</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/08/on-gauss.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak4NSHc6fyp7ImA9WhJVEEU.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-2956095134297786821</id><published>2012-08-07T19:00:00.003-07:00</published><updated>2012-08-27T10:36:39.917-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-27T10:36:39.917-07:00</app:edited><title>A missing post (updated)</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://5.mshcdn.com/wp-content/gallery/33-humorous-404-error-pages/Telltale%20Games%20404%20Page.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="119" src="http://5.mshcdn.com/wp-content/gallery/33-humorous-404-error-pages/Telltale%20Games%20404%20Page.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;Update (8/27):&lt;/b&gt; &lt;i&gt;I've put the original post &lt;a href="http://blog.cryptographyengineering.com/2012/08/reposted-cryptanalysis-of-hdcp-v2.html"&gt;back up&lt;/a&gt;.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Update (8/9): &lt;/b&gt;&lt;i&gt;I've re-written this post to include a vague, non-specific explanation of the bug. I've now confirmed the problem with one vendor, who has asked for a week to issue a patch. So far I haven't had a response from the DCP's technical people. And yes, I do realize someone PasteBinned the original post while it was up.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
A few people have asked what happened to the post that was in this space just a few hours ago. No, you're not going crazy. It was here.&lt;br /&gt;
&lt;br /&gt;
The post contained a long, detailed evaluation of the &lt;a href="http://www.digital-cp.com/files/static_page_files/DA8B373E-1A4B-B294-D097C162586197C7/HDCP%20Interface%20Independent%20Adaptation%20Specification%20Rev2_1.pdf"&gt;HDCP v2&lt;/a&gt; protocol. My idea was&amp;nbsp;to do real-time evaluation of an industry protocol that hasn't been deployed yet -- a kind of 'liveblogging' cryptanalysis. What I expected to find was some bad practices, which I would gently poke fun at. I didn't expect to find anything serious.&lt;br /&gt;
&lt;br /&gt;
I was wrong in that initial judgement, with some caveats. I'm going to give a vague and non-specific summary here, and I hope to re-post the detailed technical post in a few days when I've heard (&lt;i&gt;something, anything!&lt;/i&gt;) from &lt;a href="http://digital-cp.com/"&gt;DCP&lt;/a&gt;, the organization that maintains HDCP.&lt;br /&gt;
&lt;br /&gt;
In case you've never heard of it, &lt;a href="http://en.wikipedia.org/wiki/High-bandwidth_Digital_Content_Protection"&gt;HDCP&lt;/a&gt; is a security protocol used to 'protect' video traveling over wired and wireless networks. There are two versions. Version 1 is in your TV today, and was &lt;a href="https://freedom-to-tinker.com/blog/felten/understanding-hdcp-master-key-leak/"&gt;seriously compromised in 2010&lt;/a&gt;. Version 2 is much better, but has only been deployed in a few products -- including those that implement &lt;a href="http://www.forbes.com/sites/eliseackerman/2012/07/26/why-a-wireless-technology-called-miracast-may-be-manna-for-couch-potatoes/"&gt;MiraCast&lt;/a&gt; (formerly Wi-Fi Display).&lt;br /&gt;
&lt;br /&gt;
Version 2 contains a key agreement protocol that's designed to establish a session encryption key between a transmitter (your phone, for example) and a receiver (a TV). Once this key is established, the transmitter can encrypt all video data going over the wire.&lt;br /&gt;
&lt;br /&gt;
What I discovered in my brief analysis is a flaw in the key agreement protocol that &lt;i&gt;may&lt;/i&gt;&amp;nbsp;allow a man-in-the-middle to recover the session key (actually the 'master secret' used to derive the session key). This could potentially allow them to decrypt content. More on that in a minute, though.&lt;br /&gt;
&lt;br /&gt;
I also discovered some slightly less serious flaws elsewhere in the protocol. It turns out that the DCP already knows about those, thanks to some enterprising work by a smart guy at an unnamed vendor (who deserves credit, and will get it once I put the original post back up).&lt;br /&gt;
&lt;br /&gt;
Now for a few big caveats about the session key bug.&lt;br /&gt;
&lt;br /&gt;
The bug I found does &lt;i&gt;not&lt;/i&gt; get you all the way to decrypting HDCPv2 streams in practice, thanks to a tiny additional protection I missed while writing the original post. I don't think much of this protection, since it involves a secret that's stored in &lt;i&gt;every single&lt;/i&gt; HDCPv2-compliant device. That's a pretty lousy way to keep a secret.&lt;br /&gt;
&lt;br /&gt;
And of course I haven't personally verified this in any real HDCP devices, since I don't own any. Although if I did, I could use this &lt;a href="http://anonsvn.wireshark.org/wireshark/trunk/epan/dissectors/packet-hdcp.c"&gt;nifty HDCP plugin for WireShark&lt;/a&gt;&amp;nbsp;to do some of the work.&lt;br /&gt;
&lt;br /&gt;
The issue &lt;i&gt;has&lt;/i&gt; been confirmed by one vendor, who is working on a patch for their product. Their products are used in real things that you've heard of, so I'm trusting that they'd know.&lt;br /&gt;
&lt;br /&gt;
The last thing I want to address is why I published this, and why I subsequently pulled it.&lt;br /&gt;
&lt;br /&gt;
When I wrote the original post&amp;nbsp;&lt;i&gt;I thought&amp;nbsp;&lt;/i&gt;HDCP v2 was just a 'paper spec' -- that there were no devices actually using it. Shortly after posting, I came across one commercial product that does&amp;nbsp;claim to support HDCPv2. Later I discovered a few others. To be on the safe side, I decided to pull the post until I could notify the vendors. Then through sheer ineptitude I briefly re-posted it. Now I'm doing my best to put the toothpaste back in the tube.&lt;br /&gt;
&lt;br /&gt;
As soon as I get some feedback I intend to put the post back up. A post which, incidentally, was &lt;i&gt;not &lt;/i&gt;intended to break anything, but rather to serve as a lesson in&amp;nbsp;just how complicated it is to design your own protocol. I suppose it's achieved that goal.&lt;br /&gt;
&lt;br /&gt;
Anyway, I'm putting this up as a placeholder in case you're curious about what happened or why the heck I'm not blogging. Writing a long technical post and then having to can it is a drag. But hopefully we'll be back to our regularly-scheduled programming in no time at all.&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/El8tYcAcdK0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/2956095134297786821/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/08/a-note-on-missing-post.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/2956095134297786821?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/2956095134297786821?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/El8tYcAcdK0/a-note-on-missing-post.html" title="A missing post (updated)" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><thr:total>6</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/08/a-note-on-missing-post.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0UFR3g6eip7ImA9WhJQF0U.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-6399609291961670726</id><published>2012-07-24T08:23:00.001-07:00</published><updated>2012-07-31T19:46:56.612-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-31T19:46:56.612-07:00</app:edited><title>Four theories on the cryptography of Star Trek</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://www.bearotic.com/img/2009/04/star-trek-kirk-spock-face-off.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="188" src="http://www.bearotic.com/img/2009/04/star-trek-kirk-spock-face-off.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;"I'm sorry Captain. They rotated&lt;span style="background-color: white;"&gt;&amp;nbsp;by &lt;/span&gt;&lt;i style="background-color: white;"&gt;fourteen."&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style="background-color: white;"&gt;Over on ZDNet they're asking why &lt;a href="http://www.zdnet.com/how-cybersecurity-is-like-star-treks-transporter-7000001384/"&gt;cybersecurity is like Star Trek&lt;/a&gt;. I think this is the wrong question. A better one is: &lt;i&gt;why is&lt;/i&gt;&amp;nbsp;&lt;i&gt;the&amp;nbsp;cybersecurity&lt;/i&gt; &lt;i&gt;so &lt;/i&gt;&lt;i style="text-decoration: underline;"&gt;bad&lt;/i&gt;&amp;nbsp;on&lt;i&gt;&amp;nbsp;Star Trek&lt;/i&gt;?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;Please don't take this the wrong way. I'm a huge Trek fan. I've watched every episode ever made, and I'd do it again if I had time. Even the Holodeck ones.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;But I also teach computer security, and specifically, &lt;i&gt;cryptography&lt;/i&gt;. Which is ruining the show for me!&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;Ho&lt;/span&gt;&lt;span style="background-color: white;"&gt;w can I buy into a universe where the protagonists have starships,&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;transporters and&amp;nbsp;&lt;/span&gt;&lt;a href="http://en.memory-alpha.org/wiki/Sherlock_Holmes" style="background-color: white;"&gt;dorky positronic robots&lt;/a&gt;&lt;span style="background-color: white;"&gt;,&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;but still&amp;nbsp;&lt;/span&gt;&lt;a href="http://www.st-minutiae.com/academy/literature329/207.txt" style="background-color: white;"&gt;can't encrypt an email&lt;/a&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;to save their lives&lt;/span&gt;&lt;span style="background-color: white;"&gt;?&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;The Trek crew has never encountered an encryption scheme that didn't crack like an egg when faced with an 'adaptive algorithm' (whatever that is), or -- worse -- just&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;a dude&lt;/span&gt;&lt;i style="background-color: white;"&gt;&amp;nbsp;doing math in his head.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;But there's no reason to take my word for this. Thanks to the miracle of searchable Star Trek,&amp;nbsp;&lt;/span&gt;&lt;a href="https://www.google.com/search?sugexp=chrome,mod=14&amp;amp;sourceid=chrome&amp;amp;ie=UTF-8&amp;amp;q=encryption+site%3Ast-minutiae.com" style="background-color: white;"&gt;you can see for yourself.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;Cryptographers deserve better. Viewers deserve better. And while I can't fix bad screenwriting, I &lt;i&gt;can&lt;/i&gt; try to retcon us an explanation. And that will be the subject of this post: four&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;i style="background-color: white;"&gt;scientifically credible&lt;/i&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;explanations why 24th century crypto could legitimately be so awful.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Theory #1: A quantum leap&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://upload.wikimedia.org/wikipedia/commons/1/1d/BQP_complexity_class_diagram.svg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="159" src="http://upload.wikimedia.org/wikipedia/commons/1/1d/BQP_complexity_class_diagram.svg" width="200" /&gt;&lt;/a&gt;One answer to the mystery of Trek's bad crypto is so obvious it's mundane. It's the 24th century, and of course all the &lt;a href="http://en.wikipedia.org/wiki/Quantum_computer"&gt;computers are &lt;i&gt;quantum&lt;/i&gt;&lt;/a&gt;. Everyone knows that quantum computers are super-duper-powerful, and would blow through traditional encryption like a knife through butter.&lt;br /&gt;
&lt;br /&gt;
But not so fast! As I've written before on this blog, &lt;a href="http://blog.cryptographyengineering.com/2012/04/its-end-of-world-as-we-know-it-and-i.html"&gt;quantum computers are actually quite limited&lt;/a&gt; in what (we think) they can do. This even goes for quantum computers enhanced with &lt;a href="http://en.memory-alpha.org/wiki/Bio-neural_circuitry"&gt;bio-neural gel packs&lt;/a&gt;,&amp;nbsp;whatever the hell those are.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;Specifically: while QCs are very good at &lt;/span&gt;&lt;a href="http://en.wikipedia.org/wiki/Shor's_algorithm" style="background-color: white;"&gt;solving certain number-theoretic problems&lt;/a&gt;&lt;span style="background-color: white;"&gt; -- including the ones that power &lt;/span&gt;&lt;a href="http://en.wikipedia.org/wiki/RSA" style="background-color: white;"&gt;RSA&lt;/a&gt;&lt;span style="background-color: white;"&gt; and most public-key encryption schemes -- theorists &lt;/span&gt;&lt;i style="background-color: white;"&gt;don't&lt;/i&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;believe that they can efficiently solve &lt;/span&gt;&lt;a href="http://en.wikipedia.org/wiki/NP-complete" style="background-color: white;"&gt;NP-complete problems&lt;/a&gt;&lt;span style="background-color: white;"&gt;, which should still leave an opening for complexity-theoretic crypto to thrive in the 24th century. And yet we never hear about this in Trek.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Of course it's always possible that the theorists are wrong. But quantum computers &lt;i&gt;still&lt;/i&gt;&amp;nbsp;don't&amp;nbsp;explain why Spock can apparently crack encryption codes in his head. (And no, 'Vulcans are really good at math' is &lt;i&gt;not&lt;/i&gt;&amp;nbsp;a theory.)&lt;br /&gt;
&lt;br /&gt;
&lt;b style="background-color: white;"&gt;Theory #2: It's the warp drive, stupid&lt;/b&gt;&lt;b style="background-color: white;"&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://startswithabang.com/wp-content/uploads/2008/12/enterprise.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="151" src="http://startswithabang.com/wp-content/uploads/2008/12/enterprise.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
If there's a single technology that makes the Star Trek universe different from ours, it's the Warp drive. And this&amp;nbsp;tees up our next theory:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="background-color: white;"&gt;&lt;i&gt;Could it be that there's a conflict between faster-than-light travel and secure cryptography? Could &lt;a href="http://en.wikipedia.org/wiki/Zefram_Cochrane"&gt;Zephram Cochrane&lt;/a&gt; have done in crypto?&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;span style="background-color: white;"&gt;Shockingly, there might actually be something to this. Exhibit A is&amp;nbsp;&lt;a href="http://www.scottaaronson.com/papers/ctc.pdf"&gt;this paper&lt;/a&gt;&amp;nbsp;by&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;Scott Aaronson and John Watrous -- two honest-to-god complexity theorists -- on the implications of a physical structure called a&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;'&lt;/span&gt;&lt;a href="http://en.wikipedia.org/wiki/Closed_timelike_curve" style="background-color: white;"&gt;closed timelike curve&lt;/a&gt;&lt;span style="background-color: white;"&gt;' (CTC) and what would happen if you used one to go back in time and kill your grandfather.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;Aaronson and Watrous aren't really interested in killing anyone. What they're interested in is &lt;/span&gt;&lt;a href="http://en.wikipedia.org/wiki/Grandfather_paradox" style="background-color: white;"&gt;paradoxes&lt;/a&gt;&lt;span style="background-color: white;"&gt;, and particularly, what it means if the Universe &lt;/span&gt;&lt;i style="background-color: white;"&gt;resolves&lt;/i&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;paradoxes. It turns out that this resolution power has huge implications for computing.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;It seems that computers with access to paradox-resolving time travel would be dramatically more powerful than any of the computers we can envision today, regardless of whether they're quantum &lt;i&gt;or&lt;/i&gt; classical. In fact, CTC-enhanced computers would be powerful enough to efficiently solve problems in&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;the complexity class&amp;nbsp;&lt;/span&gt;&lt;a href="http://en.wikipedia.org/wiki/PSPACE" style="background-color: white;"&gt;PSPACE&lt;/a&gt;. This would&lt;span style="background-color: white;"&gt;&amp;nbsp;utterly doom the type of complexity-theoretic crypto we rely on today.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;But this still leaves a question: does the Warp drive necessarily imply the existence of CTCs?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;One clue comes from Einstein's&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Special_relativity"&gt;special theory of relativity&lt;/a&gt;, which implies that&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;faster-than-light travel would imply violation of&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Retrocausality"&gt;causality&lt;/a&gt;. For those without the physics background:&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Star_Trek_IV:_The_Voyage_Home"&gt;Star Trek IV&lt;/a&gt;.&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b style="background-color: white;"&gt;Theory #3: Complexity theory is dead&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;Do you remember the episode in Deep Space Nine where O'Brien and Bashir discussed the latest developments in Ferengi computer science? How about the episode that took place at a Vulcan complexity theory conference&lt;/span&gt;&lt;span style="background-color: white;"&gt;? No, I don't either. &lt;/span&gt;&lt;i&gt;These things never happened&lt;/i&gt;&lt;span style="background-color: white;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;This all by itself is suspicious. Trek characters could waste hours blabbering about subspace fields or trying to convince &lt;/span&gt;&lt;a href="http://www.youtube.com/watch?v=73nl8mbAoWE" style="background-color: white;"&gt;Data he's a real boy&lt;/a&gt;&lt;span style="background-color: white;"&gt;.&amp;nbsp;But something as central as the computers that run their ship and keep them alive? Not a peep, not even in a&amp;nbsp;&lt;/span&gt;&lt;a href="http://en.wikipedia.org/wiki/Treknobabble" style="background-color: white;"&gt;"TECH&lt;tech&gt;" scene&lt;/tech&gt;&lt;/a&gt;&lt;span style="background-color: white;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;It's almost as though by the end of the 24th century, complexity theory has fallen off of the list of things people care about. Which brings me to my next theory&lt;/span&gt;&lt;i style="background-color: white;"&gt;:&lt;/i&gt;&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;In the Star Trek Universe, &lt;a href="http://en.wikipedia.org/wiki/P_versus_NP_problem"&gt;P = NP&lt;/a&gt;.&lt;/i&gt;&lt;/blockquote&gt;
In one sense this would be huge and mostly great news for computer scientists. But it would be a disaster for the efficient (complexity-theoretic) encryption we use on a daily basis.&amp;nbsp;For things like RSA and AES to be truly secure, we require the existence of '&lt;a href="http://en.wikipedia.org/wiki/One-way_function"&gt;one-way functions&lt;/a&gt;'. And those can &lt;i&gt;only&lt;/i&gt;&amp;nbsp;exist if P does not equal NP (P != NP).&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;Fortunately for cryptography, most computer scientists are convinced that P != NP. They just haven't been able to to prove it. The &lt;a href="http://science.slashdot.org/story/10/08/08/226227/claimed-proof-that-p--np"&gt;most recent attempt&lt;/a&gt; was made by Vinay Deolalikar of HP Labs, and his proof foundered on subtleties just like every one before it&lt;/span&gt;. This means the problem is still open, and technically could go either way.&lt;br /&gt;
&lt;br /&gt;
If P &lt;i&gt;did&lt;/i&gt;&amp;nbsp;turn out to be equal to NP, it's conceivable that result would look exactly like Star Trek! A few algorithms could still be quite difficult to break (&lt;i&gt;i.e.,&lt;/i&gt;&amp;nbsp;the attacks would have huge polynomial runtimes). But maybe not. People might instead fall back on&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Security_through_obscurity"&gt;&lt;i&gt;obscurity&lt;/i&gt;&lt;/a&gt;&amp;nbsp;to overcome the mathematical impossibility of building strong complexity-theoretic encryption. &lt;a href="http://en.wikipedia.org/wiki/One-time_pad" style="background-color: white;"&gt;One-time pads&lt;/a&gt;&lt;span style="background-color: white;"&gt; would still work, of course, and&amp;nbsp;&lt;/span&gt;&lt;a href="http://en.wikipedia.org/wiki/Quantum_cryptography" style="background-color: white;"&gt;quantum key distribution&lt;/a&gt;&lt;span style="background-color: white;"&gt; might allow for point-to-point transmission. Everything else would become a massive joke.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Now, this theory still doesn't explain the 'breaking crypto in your head' thing, or why it takes &lt;a href="http://en.memory-alpha.org/wiki/Authorization_code"&gt;like six hours to change the Enterprise's command codes&lt;/a&gt;. But it would go a long way to repairing the damage wrought by years of bad scriptwriting.&lt;br /&gt;
&lt;br /&gt;
&lt;b style="background-color: white;"&gt;Theory #4: The Stallman effect&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://upload.wikimedia.org/wikipedia/commons/thumb/4/46/Richard_Stallman_2005_(chrys).jpg/220px-Richard_Stallman_2005_(chrys).jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="200" src="http://upload.wikimedia.org/wikipedia/commons/thumb/4/46/Richard_Stallman_2005_(chrys).jpg/220px-Richard_Stallman_2005_(chrys).jpg" width="182" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Live long and publish your source.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style="background-color: white;"&gt;This last theory is the most mindbending. It's also not mine (I ripped it off from Chris Long).&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;To get a fix on it, you first have to think about this Federation we hold so dear. Here we have a society where the cost of making something is simply the marginal cost of replicating a copy.&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;Money isn't necessary, and&amp;nbsp;people are&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;free to devote themselves to activities that are fun&lt;i&gt;, &lt;/i&gt;after spending the necessary ten hours a week on required tasks such as legislation, family counseling, robot repair and asteroid prospecting.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Does any of this sound familiar to you? Yes.&amp;nbsp;&lt;i&gt;Th&lt;/i&gt;&lt;i style="background-color: white;"&gt;e Federation was founded on the teachings of Richard M. Stallman.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;A society based on the teachings of RMS &lt;/span&gt;&lt;a href="http://stallman.org/articles/on-hacking.html" style="background-color: white;"&gt;can't possibly get security right&lt;/a&gt;&lt;span style="background-color: white;"&gt;.&amp;nbsp;To such a society, security is simply a tool that prevents you&amp;nbsp;you from accessing the full capabilities of your&amp;nbsp;&lt;/span&gt;&lt;strike style="background-color: white;"&gt;computer&lt;/strike&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;replicator.&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;How could we expect serious crypto in a society that worships the legacy of RMS?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;A minor problem with this theory is that it doesn't explain why bad cryptography crosses species lines: even the &lt;a href="http://en.memory-alpha.org/wiki/Encryption#Romulan"&gt;Romulans have terrible encryption&lt;/a&gt;. Of course, the&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;Romulans have frigging&amp;nbsp;&lt;/span&gt;&lt;i style="background-color: white;"&gt;cloaking devices&lt;/i&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;and still haven't managed to wipe us out. So maybe we can just chalk that one up to incompetence.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b style="background-color: white;"&gt;In conclusion&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I admit that there's only so far you can go with all of this. At a certain point you have to give in and admit that the Trek screenwriters don't know encryption from a &lt;a href="http://www.trektoday.com/reviews/voy/shattered.shtml"&gt;Chronoton field&lt;/a&gt;. And honestly, what they've done with cryptography is &lt;i&gt;nothing &lt;/i&gt;compared to what they've done to physics, electronics, and&amp;nbsp;&lt;a href="http://en.memory-alpha.org/wiki/Samuel_Clemens"&gt;historical drama&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
And please don't get me started on the Holodeck. Can't they just fit that thing with an OFF switch?&lt;br /&gt;
&lt;br /&gt;
Still, if nothing else, this post has given me another forum to bitch about my favorite grievance: &lt;a href="http://blog.cryptographyengineering.com/2012/01/bad-movie-cryptography-of-week.html"&gt;bad cryptography&lt;/a&gt; in movies and TV. And a chance to remind Hollywood (should any representatives be reading) that I am ready and willing to help you with your cryptographic script writing problems for a &lt;i&gt;very&lt;/i&gt;&amp;nbsp;reasonable fee. Just don't expect anyone to do crypto in their head.&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/O4WJefBFeaM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/6399609291961670726/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/07/four-theories-on-cryptography-of-star.html#comment-form" title="9 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/6399609291961670726?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/6399609291961670726?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/O4WJefBFeaM/four-theories-on-cryptography-of-star.html" title="Four theories on the cryptography of Star Trek" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="31" height="32" src="http://1.bp.blogspot.com/-YlQgQdhSBHo/T4JOQwyppqI/AAAAAAAAAJE/Aoy3HS4bt6s/s220/mdgphoto.jpg" /></author><thr:total>9</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/07/four-theories-on-cryptography-of-star.html</feedburner:origLink></entry></feed>
