TLS / SSL Session Renegotiation Vulnerability CVE-2009-3555
TLS / SSL Session Renegotiation Vulnerability CVE-2009-3555
G-SEC is a non-commercial and independent group of Information Security Specialists based in Luxembourg.
HTTPS .............................................................................................................................................. 7 5.1. 5.2. 5.3. 5.4. 5.5. 5.6. First method - Injecting commands into an HTTPS session ........................................................ 8 Details ...................................................................................................................................... 9 Second method - HTTPS to HTTP downgrade attack................................................................ 10 Details .................................................................................................................................... 11 Third method - Injecting custom responses through TRACE .................................................... 12 Details .................................................................................................................................... 13
6.
SMTPS ............................................................................................................................................ 14 Protocol vulnerability matrix .............................................................................................................. 14 The attacker does NOT have an account on the SMTP server ......................................................... 14 The Attacker has an account on the SMTP server ........................................................................... 14 Attack scenario - SMTP STARTTLS (110) .............................................................................................. 15 Details................................................................................................................................................ 16 Client side attack detection ................................................................................................................ 17 Important Note .................................................................................................................................. 17
7.
FTPS ............................................................................................................................................... 18 Client certificate based authentication (Control Channel)................................................................... 19 Renegotiations due to NAT support (Data Channel) ........................................................................... 19 Resetting the TCP connection and injecting in mid transfer ................................................................ 19
8. 9.
The Impact on other protocols using TLS ........................................................................................ 21 Summary........................................................................................................................................ 21 EAP-TLS .............................................................................................................................................. 22
2. Synopsis Around the 09/11/2009 Marsh Ray, Steve Dispensa and Martin Rex published details1 about a vulnerability affecting the TLS and the SSLv3 protocol. The vulnerability is being tracked under CVE-2009-35552 | VU#1205413 and affects a multitude of platforms and protocols, the impact of this vulnerability varies from protocol to protocol and from application to application. There is extensive research required in order to assess When speaking of a Man in the Middle attack, it is often assumed that data can be altered or changed. Indeed an attacker that sits in the middle of a connection (hence its name) is often able to do so. In this particular case however the attacker piggybacks an existing authenticated and encrypted TLS sessions in order to (prefix) inject arbitrary text of its choice. The attacker may not read/alter the other TLS session between the client and the server. This paper explains the vulnerability for a broader audience and summarizes the information that is currently available. The document is prone to updates and is believed to be accurate by the time of writing. Important: This vulnerability is not limited to HTTPS, this vulnerability potentially affects every application/protocol that implements TLS or SSLv3.
This paper is referenced by the US-CERT, DFN-CERT, BELNET-CERT, SWITCH-cert,Nessus, Qualys, c't Heise, and many more. Furthermore it has served as a internal Training paper for a major OS vendor.
1 2 3
Details
Client starts the TLS handshake Attacker does not forward these immediately
1.1
1.2
The attacker sends application level commands over the previously established TLS session (#2) Renegotiation is triggered either
1. because of Certificate based auth (server sees get /dir and decides it needs an certificate for directory) 2. due to different cipher requriements on different ressources (Server initiated) 3. by the client
The TLS handshake started at 1 and hold back by the attacker, is now being let to the server which performs a new TLS Handshake over the previously established encrypted TLS session #2 (Attacker<>Server) The TLS endpoint, due to the renegotiation has to take into the account the previously sent data (per spec), the endpoint believes the previous data (1.2) to have been send from the same client. As such this request is prefixed to the one issued by the client in 4 (See HTTPS example for a more explicit example)
http://www.pcworld.com/article/182720/security_pro_says_new_ssl_attack_can_hit_many_sites.html
The attacker negotiates a new session performs a full TLS exchange The attacker sends a GET request to a fictional weak e-banking application. Note that the attacker can add multiple requests due to HTTP1.1 pipelining but that only the last request usurps the cookie. Renegotiation is triggered The TLS handshake started at 1 and hold back by the attacker, is now being let to the server which performs a new TLS Handshake over the previously established encrypted TLS session #2 (Attacker<>Server) The TLS endpoint, due to the renegotiation has to take into the account the previously sent data (per spec), the endpoint believes the previous data (1.2) to have been send from the same client The requests 1.2 : Attacker -> server
GET /ebanking/ paymemoney.cgi?acc=LU00000000000000?amount=1000 Ignore-what-comes-now:
1.2
And 4: Client->server
GET /ebanking Cookie: AS21389:6812HSADI:3991238
The request is prefixed to the request issued by the client in (4) and is merged into
GET /ebanking/ paymemoney.cgi?acc=LU00000000000000?amount=1000 Ignore-what-comes-now: GET /ebanking Cookie: AS21389:6812HSADI:3991238
http://en.wikipedia.org/wiki/Cross-Site_Request_Forgery http://www.securegoose.org/2009/11/tls-renegotiation-vulnerability-cve.html
10
SSLstrip is a tool presented by Marlin Spikes at Blackhat 2009 - it allows to perform an active MITM attack by stripping of SSL from the connection of the victim. The attack had one particular drawback: it was not possible to downgrade an existing SSL session, and only worked if the user accesses his bank over HTTP first then trying to submit his credentials to HTTPS. Abusing the TLS renegotiation vulnerability however it is now possible to even apply SSLstrip to established SSL connections. The Proof of concept for this attack can be found at : http://www.g-sec.lu/tls-ssl-proof-ofconcept.html
1.2
The attacker sends a GET request he knows will redirect the HTTP client to a non HTTPS page on the server. Renegotiation is triggered The TLS handshake started at 1 and hold back by the attacker, is now being let to the server which performs a new TLS Handshake over the previously established encrypted TLS session #2 (Attacker<>Server) The TLS endpoint, due to the renegotiation has to take into the account the previously sent data (per spec), The request is prefixed to the request issued by the client in (4) and is merged into one request. The attacker effectively replaced the GET request. The server replies with a 302 redirecting the victim to an HTTP page The HTTP browser of the victim automatically follows the redirect the server has sent and requests the HTTP page. The attacker is now seeing the clear text requests and can rewrite the HTTP request from the victim to his liking from this point on the attacker continues the attack with SSLtrip
http://www.thoughtcrime.org/software/sslstrip/
11
12
The TRACE method can also be abused for example in situations where custom code is used that ignores the content-type and just parses for specific data. For instance one can imagine that several automatic updates protocols and server to server communications are vulnerable to this attack. As the client expects a response to a GET request it is likely that developers have not spend time to look into whether the response really comes from a GET request. Summary: The attacker injects a TRACE command, by doing so the attacker can control the content that is send from the server to the victim over HTTPS The Proof of concept for this attack can be found at : http://www.g-sec.lu/tls-ssl-proof-ofconcept.html
13
TLS private cert authentication without SASL SMTP over TLS without SASL
TLS private cert authentication without SASL TLS private cert authentication with SASL SMTP over TLS with SASL SMTP over TLS without SASL
http://www.porcupine.org/postfix-mirror/smtp-renegotiate.pdf
14
15
Attacker connects to the SMTP server and initiates a TLS session (STARTTLS)
1.1
1.2
The attacker sends SMTP commands to the server but does not end the SMTP session, in this example the attacker controls the source and destination e-mail addresses. Renegotiation is triggered Attacker initiates a TLS session (TLS HELLO) and the victim performs a new TLS Handshake over the previously established encrypted TLS session #2 (Attacker<>Server) The TLS endpoint, due to the renegotiation has to take into the account the previously sent data (per spec), the endpoint believes the previous data (1.2) to have been send from the same client As such the client now receives the answers from the attacker injected commands (note this is a way to detect this attack on the client-side). The victim SMTP client now issues his commands to send mail Those commands end up in the BODY of the mail previously started by the attacker. The SMTP server receives:
EHLO whatever AUTH PLAIN whatever MAIL FROM:<attacker-chosen-sender> RCPT TO:<attacker-chosen-recipient> attacker:DATA victim:EHLO victim:AUTH PLAIN whatever victim:MAIL FROM victim:whatever victiim:DATA<crlf>
As such the :<attacker-chosen-recipient> receives a mail containing the authentication data aswell as the other data.
16
Important Note
To our knowledge POSTFIX is not affected by this vulnerability.
17
http://msmvps.com/blogs/alunj/default.aspx
18
10 11
19
20
Summary
Protocol HTTPS Impact analysis available Yes Current status 1. Vulnerable to a certain degree, impact depends on application level logic and structure of the HTTP requests. 2. If server supports TRACE command, attacker can control the response 3. Attacker can downgrade to HTTP (sslstrip) Believed to not be vulnerable Unknown Unknown Unknown Vulnerable only if certain requirements are met Vulnerable - Further research required Current status Not vulnerable, does not rely on openssl session capabilities session handling was hardened after disclosure reports14 Vulnerable15 - mitigations exist Vulnerable short term patch available16 Vulnerable not vulnerable to client initiated renegotiation requests. Vulnerable patch status unknown, IETF proposal currently being implemented Vulnerable short term patches available
21
EAP-TLS
EAP-TLS is not believed to be vulnerable if implemented as per specification17.
There is no application layer protocol involved when EAP-TLS is executed Only the TLS key material is used, the tunnel is not used. EAP re-authentication not the same as TLS renegotiation which is executed in the previous TLS tunnel
17
http://www.ietf.org/mail-archive/web/tls/current/msg04109.html
22
11.
Patching TLS
From the conditions that emerged in Vulnerability conditions the patching requirements might be:
Client
Mid-term : Implement the IETF proposal for a TLS extension tracking and handling renegotiation requests18 (draft-rescorla-tls-renegotiation-00.txt)
Server
Short-term : Remove renegotiation capabilities altogether Mid-term : Implement the IETF proposal for a TLS extension tracking and handling renegotiation requests19 (draft-rescorla-tls-renegotiation-00.txt)
18 19
https://svn.resiprocate.org/rep/ietf-drafts/ekr/draft-rescorla-tls-renegotiate.txt https://svn.resiprocate.org/rep/ietf-drafts/ekr/draft-rescorla-tls-renegotiate.txt
23
Vulnerability requirements
The preconditions for a TLS or SSLv3 connection to be vulnerable are 1. The server acknowledges and accepts full TLS renegotiations in the middle of a connection and after the initial handshake and 2. The server assumes that both TLS sessions were negotiated with the same client and 3. The server treats both sessions as one and merges them at the application layer As such this vulnerability might not been seen as a vulnerability in TLS but the as the bad choice to merge two different requests together by the endpoint.
Generic Example
Openssl s_client connect yourserver.com:443 GET / HTTP/1.0 Host:yourserver.com R (Triggers renegotiation if this works, the server accepts
within an existing TLS session Req. #1)
renegotiations
20
http://www.openssl.org/
24
The vulnerability lies within the core of TLS and SSLv3, and will rear its ugly head for years to come; the custom applications that are potentially vulnerable are innumerable.
Servers
Servers that do allow mid-connection renegotiations are vulnerable Applications that handle 2 TLS sessions as coming from the same client are vulnerable
Clients
Clients have no means (pre TLS extension) to check if a renegotiation is happening and are vulnerable
Sources
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. http://www.securityfocus.com/bid/36935 https://svn.resiprocate.org/rep/ietf-drafts/ekr/draft-rescorla-tls-renegotiate.txt https://bugzilla.mozilla.org/show_bug.cgi?id=526689 http://blog.ivanristic.com/2009/11/ssl-and-tls-authentication-gap-vulnerability-discovered.html http://www.leviathansecurity.com/pdf/ssltlstest.zip http://extendedsubset.com/renegotiating_tls_20091104_pub.zip https://bugzilla.redhat.com/show_bug.cgi?id=533125 http://www.mail-archive.com/[email protected]/msg69335.html http://www.apache.org/dist/httpd/patches/apply_to_2.2.14/CVE-2009-3555-2.2.patch http://sid.rstack.org/blog/index.php/373-tls-tout-le-monde-en-parle-pourquoi-pas-moi https://www.mikestoolbox.net/ http://extendedsubset.com/ http://extendedsubset.com/Renegotiating_TLS.pdf http://extendedsubset.com/Renegotiating_TLS_pd.pdf http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3555 http://www.chappellseminars.com/files/nutter-stevedispensa-sslgap.mp3 http://www.phonefactor.com/sslgap/ssl-tls-authentication-patches
Thanks
We would like to thank Marsh Ray, Alun Jones, Wietse Venema, Alexandre Dulaunoy, Noam Rathaus, j.clausing and Simon Zuckerbraun.
15.
Disclaimer
Information is believed to be accurate by the time of writing. As this vulnerability is complex this document may be prone to revisions in the future.
25