Bug 1101932 (CVE-2014-3466)

Summary: CVE-2014-3466 gnutls: insufficient session id length check in _gnutls_read_server_hello (GNUTLS-SA-2014-3)
Product: [Other] Security Response Reporter: Tomas Hoger <thoger>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: carnil, chorn, gianluca.varisco, jkurik, jrusnack, ksrot, ktietz, lbopf, magoldma, mattdm, mjc, ngalvin, nmavrogi, pablo.iranzo, patrick.d.mayo, pdwyer, security-response-team, tbowling
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: impact=important,public=20140530,reported=20140528,source=upstream,cvss2=6.8/AV:N/AC:M/Au:N/C:P/I:P/A:P,rhel-4/gnutls=wontfix,rhel-5/gnutls=affected,rhel-6/gnutls=affected,rhel-7/gnutls=affected,fedora-all/gnutls=affected,rhel-6/mingw32-gnutls=wontfix,fedora-all/mingw-gnutls=affected,epel-5/mingw32-gnutls=affected,cwe=CWE-130->CWE-119
Fixed In Version: gnutls 3.1.25, gnutls 3.2.15, gnutls 3.3.3 Doc Type: Bug Fix
Doc Text:
A flaw was found in the way GnuTLS parsed session IDs from ServerHello messages of the TLS/SSL handshake. A malicious server could use this flaw to send an excessively long session ID value, which would trigger a buffer overflow in a connecting TLS/SSL client application using GnuTLS, causing the client application to crash or, possibly, execute arbitrary code.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-10 08:29:42 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On: 1102024, 1102025, 1102027, 1102028, 1102355, 1102356, 1103046, 1103047, 1103048    
Bug Blocks: 1101736    
Attachments:
Description Flags
Patch from Nikos Mavrogiannopoulos none

Description Tomas Hoger 2014-05-28 04:12:50 EDT
A flaw was found in the way GnuTLS parsed session ids from Server Hello packets of the TLS/SSL handshake.  A malicious server could use this flaw to send an excessively long session id value and trigger a buffer overflow in a connecting TLS/SSL client using GnuTLS, causing it to crash or, possibly, execute arbitrary code.

The flaw is in read_server_hello() / _gnutls_read_server_hello(), where session_id_len is checked to not exceed incoming packet size, but not checked to ensure it does not exceed maximum session id length:
https://www.gitorious.org/gnutls/gnutls/source/8d7d6c6:lib/gnutls_handshake.c#L1747
Comment 1 Tomas Hoger 2014-05-28 04:14:20 EDT
Created attachment 899870 [details]
Patch from Nikos Mavrogiannopoulos
Comment 4 Tomas Hoger 2014-05-29 03:41:16 EDT
Acknowledgment:

Red Hat would like to thank GnuTLS upstream for reporting this issue. Upstream acknowledges Joonas Kuorilehto of Codenomicon as the original reporter.
Comment 7 Tomas Hoger 2014-05-30 02:57:05 EDT
Created mingw-gnutls tracking bugs for this issue:

Affects: fedora-all [bug 1103047]
Comment 8 Tomas Hoger 2014-05-30 02:57:08 EDT
Created gnutls tracking bugs for this issue:

Affects: fedora-all [bug 1103046]
Comment 9 Tomas Hoger 2014-05-30 02:57:11 EDT
Created mingw32-gnutls tracking bugs for this issue:

Affects: epel-5 [bug 1103048]
Comment 10 Gianluca Varisco 2014-06-02 02:49:18 EDT
Is 2.12.x also vulnerable?
Comment 11 Gianluca Varisco 2014-06-02 02:50:02 EDT
Err, I meant: 2.x (2.6? 2.8)
Comment 13 Tomas Hoger 2014-06-03 07:31:45 EDT
It seems the issue was first introduced via the following commit:

https://www.gitorious.org/gnutls/gnutls/commit/8a6517a2#lib/gnutls_handshake.c

which pre-dates 1.0.0 by few years.
Comment 14 errata-xmlrpc 2014-06-03 12:09:54 EDT
This issue has been addressed in following products:

  Red Hat Enterprise Linux 6

Via RHSA-2014:0595 https://rhn.redhat.com/errata/RHSA-2014-0595.html
Comment 15 errata-xmlrpc 2014-06-03 12:10:33 EDT
This issue has been addressed in following products:

  Red Hat Enterprise Linux 5

Via RHSA-2014:0594 https://rhn.redhat.com/errata/RHSA-2014-0594.html
Comment 16 Fedora Update System 2014-06-04 03:53:46 EDT
gnutls-3.1.25-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 17 Vincent Danen 2014-06-04 09:51:32 EDT
IssueDescription:

A flaw was found in the way GnuTLS parsed session IDs from ServerHello messages of the TLS/SSL handshake. A malicious server could use this flaw to send an excessively long session ID value, which would trigger a buffer overflow in a connecting TLS/SSL client application using GnuTLS, causing the client application to crash or, possibly, execute arbitrary code.
Comment 22 Fedora Update System 2014-06-09 23:08:16 EDT
mingw-gnutls-3.1.25-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 23 Fedora Update System 2014-06-09 23:11:36 EDT
mingw-gnutls-3.1.25-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 24 Fedora Update System 2014-06-09 23:11:47 EDT
gnutls-3.1.20-5.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 25 errata-xmlrpc 2014-06-10 08:24:09 EDT
This issue has been addressed in following products:

  Red Hat Enterprise Linux 7

Via RHSA-2014:0684 https://rhn.redhat.com/errata/RHSA-2014-0684.html
Comment 27 errata-xmlrpc 2014-06-30 13:29:08 EDT
This issue has been addressed in following products:

  RHEV-H and Agents for RHEL-6

Via RHSA-2014:0815 https://rhn.redhat.com/errata/RHSA-2014-0815.html