Developers › Security Group blog
The "BEAST" SSL/TLS issue
Researchers Thai Duong and Juliano Rizzo have come up with a novel way of extending and exploiting a well known issue in standard web encryption, and managed to write code which can guess at user's cookies, and thus steal a user's session to secure sites. Pulling off such an attack is not easy though, and a default installation of Opera cannot be exploited directly.
This weakness is present both in SSL and version 1.0 of TLS, the two most popular cryptographic protocols in use today. TLS versions 1.1 and 1.2 are not affected, but unfortunately only a few browsers support these newer versions, so servers cannot yet take advantage of this. Opera supports this, and this can be enabled in existing Opera versions as soon as other browsers and servers start upgrading.
We developed a fix for SSL and TLS 1.0, and tried shipping it in Opera 11.51. We quickly found that any change we made to how the browser connected to servers, however small, would be incomprehensible to thousands of servers around the world. Deploying this would mean users would be unable to connect to those servers, and we had to rethink our solution. This issue will have to be solved in close cooperation between browser vendors and webmasters. Since this cannot be directly exploited in Opera, we decided to wait until we have an industry agreement on how to move forwards.
We have test systems in place which can connect to millions of secure sites around the world, and detect how these sites will react to changes to the protocol. We will be sharing our results from these test runs with other browser vendors and affected parties, to give us a good basis for finding the best solution to the issue.
How the Attack works - a technical explanation
At its core, this is a chosen plaintext attack on the Cipher-block chaining (CBC) mode of encryption.
In pure CBC mode, the output cipher text from the previous encryption operation is used as "random" input into the next encryption operation. This is done to make sure that two identical blocks of plaintext are not encrypted into identical cipher text blocks.
However this mode opens up the possibility for an attack where the attacker may feed the encryption algorithm with a carefully constructed input, that can reveal other unknown parts of the plain text. Note that the encryption key can not be recovered, only plaintext. BEAST is a proof of concept that exploits this weakness, through what has been termed a "block-wise chosen-plaintext" attack, to attempt to gain access to credential cookies.
If a victim has logged into a site protected by SSL, where the session authentication is handled by cookies, any HTTPS request from the victim's browser to the site will contain this cookie. By serving some evil JavaScript to the victim's browser, the attacker can create a request and send it from the victim's browser to the protected site, and listen into the resulting ciphertext. This information can be used to carefully create plaintext which the attacker can append to the ongoing request via the attacking script. In this plaintext there would be a guess for character of the cookie. Listening again to the resulting ciphertext, the attack can determine if the guess was correct. When the correct character is found, the attacker can adjust the length of the request to attack the next character. Repeating this procedure may reveal the whole cookie.
Attempting to attack users
A few requirements must be met to successfully apply this attack against web browsers.
1) The attacker must be able to eavesdrop on network connections made from the victim's browser.
2) The attack must be able to insert JavaScript into the victim's browser.
3) The attacker must be able to send HTTPS requests at will.
4) After listening in on the request, the attack must be able to append more data to the very same request.
There are several methods for eavesdropping (one example is open wifi networks), thus requirement 1 can be met.
Requirement 2 can be met in several ways. For example, the client may visit an evil site that serves the JavaScript, or the JavaScript can be served in an advertisement.
Requirement 3 is met, as the attacker can create requests via the attack script.
However, requirement 4 is not met in default Opera. In Opera the whole request has to be made up front before sending it. It is not possible for JavaScript to append data to a request after it has been started - this is the case for form submissions, loading files, XMLHttpRequest and most other methods of creating network requests. Thus, the core part of the attack fails, as the attacker needs to send a request, listen to the resulting cipher text, and use that to append more plaintext to the request.
There are a couple of twists though.
WebSockets is a viable attack vector for requirement 4, because scripts using this have more control over what is sent on the connection. Fortunately WebSockets has been turned off by default since its introduction into Opera, as there have been other security concerns with this specification. WebSockets is not widely used yet, so in general there is no pressing need for it to be enabled. There is a new WebSockets specification in progress, without any of these security concerns, which will make it possible to enable this feature without worry. You can check if you have WebSockets enabled here.
Then there is Java. While applets do not have direct access to cookies from the browser, Java can request cookies, and add them to outgoing network requests, for authentication purposes. This is normally subject to a same-origin check in Java, so cookies are only added when sending requests back to the domain the applet was loaded from. However, due to a bug in Java's same-origin check, this can be bypassed, but requires an attacker to control your Internet connection. If you believe you are better safe than sorry, you may consider disabling Java, or avoiding untrusted Internet connections, until there is a Java update available.
Edit 2011-10-19: Java has released a patch to address this issue. Users are advised to upgrade their Java version for safe browsing with Java enabled.
This weakness is present both in SSL and version 1.0 of TLS, the two most popular cryptographic protocols in use today. TLS versions 1.1 and 1.2 are not affected, but unfortunately only a few browsers support these newer versions, so servers cannot yet take advantage of this. Opera supports this, and this can be enabled in existing Opera versions as soon as other browsers and servers start upgrading.
We developed a fix for SSL and TLS 1.0, and tried shipping it in Opera 11.51. We quickly found that any change we made to how the browser connected to servers, however small, would be incomprehensible to thousands of servers around the world. Deploying this would mean users would be unable to connect to those servers, and we had to rethink our solution. This issue will have to be solved in close cooperation between browser vendors and webmasters. Since this cannot be directly exploited in Opera, we decided to wait until we have an industry agreement on how to move forwards.
We have test systems in place which can connect to millions of secure sites around the world, and detect how these sites will react to changes to the protocol. We will be sharing our results from these test runs with other browser vendors and affected parties, to give us a good basis for finding the best solution to the issue.
How the Attack works - a technical explanation
At its core, this is a chosen plaintext attack on the Cipher-block chaining (CBC) mode of encryption.
In pure CBC mode, the output cipher text from the previous encryption operation is used as "random" input into the next encryption operation. This is done to make sure that two identical blocks of plaintext are not encrypted into identical cipher text blocks.
However this mode opens up the possibility for an attack where the attacker may feed the encryption algorithm with a carefully constructed input, that can reveal other unknown parts of the plain text. Note that the encryption key can not be recovered, only plaintext. BEAST is a proof of concept that exploits this weakness, through what has been termed a "block-wise chosen-plaintext" attack, to attempt to gain access to credential cookies.
If a victim has logged into a site protected by SSL, where the session authentication is handled by cookies, any HTTPS request from the victim's browser to the site will contain this cookie. By serving some evil JavaScript to the victim's browser, the attacker can create a request and send it from the victim's browser to the protected site, and listen into the resulting ciphertext. This information can be used to carefully create plaintext which the attacker can append to the ongoing request via the attacking script. In this plaintext there would be a guess for character of the cookie. Listening again to the resulting ciphertext, the attack can determine if the guess was correct. When the correct character is found, the attacker can adjust the length of the request to attack the next character. Repeating this procedure may reveal the whole cookie.
Attempting to attack users
A few requirements must be met to successfully apply this attack against web browsers.
1) The attacker must be able to eavesdrop on network connections made from the victim's browser.
2) The attack must be able to insert JavaScript into the victim's browser.
3) The attacker must be able to send HTTPS requests at will.
4) After listening in on the request, the attack must be able to append more data to the very same request.
There are several methods for eavesdropping (one example is open wifi networks), thus requirement 1 can be met.
Requirement 2 can be met in several ways. For example, the client may visit an evil site that serves the JavaScript, or the JavaScript can be served in an advertisement.
Requirement 3 is met, as the attacker can create requests via the attack script.
However, requirement 4 is not met in default Opera. In Opera the whole request has to be made up front before sending it. It is not possible for JavaScript to append data to a request after it has been started - this is the case for form submissions, loading files, XMLHttpRequest and most other methods of creating network requests. Thus, the core part of the attack fails, as the attacker needs to send a request, listen to the resulting cipher text, and use that to append more plaintext to the request.
There are a couple of twists though.
WebSockets is a viable attack vector for requirement 4, because scripts using this have more control over what is sent on the connection. Fortunately WebSockets has been turned off by default since its introduction into Opera, as there have been other security concerns with this specification. WebSockets is not widely used yet, so in general there is no pressing need for it to be enabled. There is a new WebSockets specification in progress, without any of these security concerns, which will make it possible to enable this feature without worry. You can check if you have WebSockets enabled here.
Then there is Java. While applets do not have direct access to cookies from the browser, Java can request cookies, and add them to outgoing network requests, for authentication purposes. This is normally subject to a same-origin check in Java, so cookies are only added when sending requests back to the domain the applet was loaded from. However, due to a bug in Java's same-origin check, this can be bypassed, but requires an attacker to control your Internet connection. If you believe you are better safe than sorry, you may consider disabling Java, or avoiding untrusted Internet connections, until there is a Java update available.
Edit 2011-10-19: Java has released a patch to address this issue. Users are advised to upgrade their Java version for safe browsing with Java enabled.
Readers' comments 13
Left under the original article, as archived.
About this article
| Published in | Security Group blog |
|---|---|
| Date | September 28, 2011 |
| Author | Sigbjørn Vik |
| Tags | 512-bit, browser, cabforum, Certificates, MD5, Opera, renego, renegotiation, RSA, Security, security changes, Security Issue |
| Original | Internet Archive |
Andrei Daniel TicleanWednesday, September 28, 2011 1:32:53 PM
Mağruf ÇolakoğluWednesday, September 28, 2011 1:59:10 PM
Cutting SpoonThursday, September 29, 2011 1:36:40 AM
THAT is a CLEVER behavior! I was concerned because I knew that Opera had disabled TLS1.1-1.2 again because many sites that claimed support couldn't actually use the newer protocols.
But.....the request structure limitations closed one vector. Disabling Websockets pending a security fix closed another. The remaining vector is Java, but few sites use the plugin and it generally pops that little icon in the system tray. Brilliant!
No emergency patch required. What an enviable position.
Swapnil RustagiThursday, September 29, 2011 12:41:39 PM
A sigh of relief that WebSockets will be enabled in Opera in the distant future. Those security concerns what you say were addressed long time ago if I am right. And both Mozilla and Google have updated their WebSocket implementation to a version in which the security issues no longer exist.
Leonardo AlassiaThursday, September 29, 2011 1:35:07 PM
I mean, in this article: http://www.filetransferconsulting.com/file-transferbeast-tls-vulnerability/
says that you have to disable tls 1.0 and ssl 3 as recommendation, but I'm not sure about it, because if I disable ssl 3 I cannot use "the web", so I'm very confused about my security.
Cutting SpoonFriday, September 30, 2011 12:08:22 AM
Charles SchlossFriday, September 30, 2011 12:52:52 PM
Link to this post
Nicholas WeaverMonday, October 3, 2011 2:55:41 PM
Namely, you observe that when the fix (of extra dummy frames/padding to make the IV non-predictable) causes the server to fail, you do notice a failure: It doesn't crash the server, just the connection.
In such a case, you then restart the TLS connection with the fix disabled, and resend the failed request.
As a result, all servers where the fix work see the fixed code. For servers where the fix breaks things, they see extra load from a renegotiated TLS session and a bit higher user latency.
(Nicholas Weaver, researcher, computer security, ICSI)
Yngve Nysæter PettersenTuesday, October 4, 2011 12:55:40 AM
Most of the failures occur at the application (HTTP) level, not the TLS level, because the server, or a frontend, expects a single HTTPS TLS Application Record to contain a full, complete HTTP request. One of the servers I have tested reports somthing like "ET is not a valid method", having discarded the record with the "G".
You can only detect a failing server if you connect to the server using both methods and then compare the results. Even testing I have done using the TLS Prober (which detects a 0.15% failure rate), does not seem to give a perfect result, and the prober requires two consecutive failures to get the same result as an unpatched request, and still some of the detected servers appear to work with the patched client. Doing such testing automatically in a browser is going to be very timeconsuming, and you can't be certain that you tested the server in the "correct" fashion.
And, unfortunately, performing a fallback to unpatched mode will give an attacker a perfect opportunity to make the attack possible in all cases: Make connections with the workaround fail, and the client will oblige the attacker by making all connections to a server vulnerable to the attack. A security patch that can be automatically disabled is not a security patch, it is a security vulnerability.
So, if this patch is implemented, it will be applied to all servers, and if they break, the servers will have to be upgraded.
Charles SchlossWednesday, October 19, 2011 3:46:18 AM
Cutting SpoonWednesday, October 19, 2011 4:27:39 AM
On an unrelated note there's something on Secunia about a bug involving SVG inside a frame? I doubt there will be an exploit for it in the wild, of course...
Charles SchlossWednesday, October 19, 2011 4:54:47 AM
Originally posted by hellspork:
On demand plug ins help
Cutting SpoonWednesday, October 19, 2011 4:09:36 PM