
         From: Simon Josefsson                                     
      Subject: GnuTLS 2.2.5 - Brown paper bag release              
         Date: Mon, 19 May 2008 22:54:43 +0200                     
   User-agent: Gnus/5.110009 (No Gnus v0.9) Emacs/22.2 (gnu/linux) 

     ----------------------------------------------------------------------------------------------------------------------

 We are embarrassed to announce a new stable GnuTLS release: Version 2.2.5.

 This release fixes a flaw in the patch for one of the security problems
 fixed by version 2.2.4.  The updated advisory is included below.  As
 always, further updates will be posted on:

 http://www.gnu.org/software/gnutls/security.html

 I'd also like to take the opportunity to correct another mistake made
 the announcement for v2.2.4: please send security analysis to
 address@hidden and not to any other address.

 GnuTLS is a modern C library that implement the standard network
 security protocol Transport Layer Security (TLS), for use by network
 applications.  GnuTLS is developed for GNU/Linux, but works on many
 Unix-like systems and comes with a binary installer for Windows.

 The core GnuTLS library is distribute under the terms of the GNU Lesser
 General Public License version 2.1 (or later).  The "extra" GnuTLS
 libraries -- which contains OpenPGP and TLS/IA support, LZO compression,
 the OpenSSL compatibility library -- and the self tests and command line
 tools are distributed under the GNU General Public License version 3.0
 (or later).  The manual is distributed under the GNU Free Documentation
 License version 1.2 (or later).

 The project page of the library is available at:
   http://www.gnutls.org/
   http://www.gnu.org/software/gnutls/
   http://josefsson.org/gnutls/

 What's New
 ==========

 * Version 2.2.5 (released 2008-05-19)

 ** Fix flaw in fix for GNUTLS-SA-2008-1-3.
 The flaw would result in incorrectly terminated sessions with the
 error "Decryption has failed" when the server sends a small packet
 (typically when the session is closed).  Reported by Andreas Metzler
 <address@hidden> in
 <http://permalink.gmane.org/gmane.comp.encryption.gpg.gnutls.devel/2807>.

 ** API and ABI modifications:
 No changes since last version.

 Getting the Software
 ====================

 GnuTLS may be downloaded from one of the mirror sites or direct from
 <ftp://ftp.gnutls.org/pub/gnutls/>.  The list of mirrors can be found at
 <http://www.gnu.org/software/gnutls/download.html>.

 Here are the BZIP2 compressed sources (4.8MB):

   ftp://ftp.gnutls.org/pub/gnutls/gnutls-2.2.5.tar.bz2
   http://josefsson.org/gnutls/releases/gnutls-2.2.5.tar.bz2

 Here are OpenPGP detached signatures signed using key 0xB565716F:

   ftp://ftp.gnutls.org/pub/gnutls/gnutls-2.2.5.tar.bz2.sig
   http://josefsson.org/gnutls/releases/gnutls-2.2.5.tar.bz2.sig

 Note, that we don't distribute gzip compressed tarballs.

 In order to check that the version of GnuTLS which you are going to
 install is an original and unmodified one, you should verify the OpenPGP
 signature.  You can use the command

      gpg --verify gnutls-2.2.5.tar.bz2.sig

 This checks whether the signature file matches the source file.  You
 should see a message indicating that the signature is good and made by
 that signing key.  Make sure that you have the right key, either by
 checking the fingerprint of that key with other sources or by checking
 that the key has been signed by a trustworthy other key.  The signing
 key can be identified with the following information:

 pub   1280R/B565716F 2002-05-05 [expires: 2008-06-30]
       Key fingerprint = 0424 D4EE 81A0 E3D1 19C6  F835 EDA2 1E94 B565 716F
 uid                  Simon Josefsson <address@hidden>
 uid                  Simon Josefsson <address@hidden>

 The key is available from:
   http://josefsson.org/key.txt
   dns:b565716f.josefsson.org?TYPE=CERT

 Alternatively, after successfully verifying the OpenPGP signature of
 this announcement, you could verify that the files match the following
 checksum values.  The values are for SHA-1 and SHA-224 respectively:

 7620d092c790f0a5ac5486c3563786ca8777083d  gnutls-2.2.5.tar.bz2

 d1cee353902a404a4b02fd0da981e8164c8b60356917abfc781b066c  gnutls-2.2.5.tar.bz2

 Documentation
 =============

 The manual is available online at:

   http://www.gnu.org/software/gnutls/documentation.html

 In particular the following formats are available:

  HTML: http://www.gnu.org/software/gnutls/manual/html_node/index.html
  PDF: http://www.gnu.org/software/gnutls/manual/gnutls.pdf

 For developers there is a GnuTLS API reference manual formatted using
 the GTK-DOC tools:

   http://www.gnu.org/software/gnutls/reference/gnutls-gnutls.html

 Community
 =========

 If you need help to use GnuTLS, or want to help others, you are invited
 to join our help-gnutls mailing list, see:
 <http://lists.gnu.org/mailman/listinfo/help-gnutls>.

 If you wish to participate in the development of GnuTLS, you are invited
 to join our gnutls-devel mailing list, see:
 <http://lists.gnu.org/mailman/listinfo/gnutls-devel>.

 Windows installer
 =================

 GnuTLS has been ported to the Windows operating system, and a binary
 installer is available.  The installer contains DLLs for application
 development, manuals, examples, and source code.  The installer consists
 of libgpg-error 1.6, libgcrypt 1.4.1, libtasn1 1.4, and GnuTLS 2.2.5.

 For more information about GnuTLS for Windows:
   http://josefsson.org/gnutls4win/

 The Windows binary installer and OpenPGP signature:
   http://josefsson.org/gnutls4win/gnutls-2.2.5.exe (13MB)
   http://josefsson.org/gnutls4win/gnutls-2.2.5.exe.sig

 A ZIP file with the installed tree of binaries:
   http://josefsson.org/gnutls4win/gnutls-2.2.5.zip (4.6MB)
   http://josefsson.org/gnutls4win/gnutls-2.2.5.zip.sig

 The checksum values for SHA-1 and SHA-224 are:

 02a84f3844b9376f65edfbb6f6cc377a239a6264  gnutls-2.2.5.exe
 1bff90ec17ad99bbf369d65719a1f25fa6d16cbe  gnutls-2.2.5.zip

 0a1b1687d7b542e3c41abaa9c321946db32487f936b45ec7bdb0d563  gnutls-2.2.5.exe
 8c07ceed8183efb561f99d393bcac6faf669a9c3936df5d5397686fe  gnutls-2.2.5.zip

 Internationalization
 ====================

 GnuTLS messages have been translated into Dutch, German, Malay, Polish
 and Swedish.  We welcome the addition of more translations.

 Support
 =======

 Improving GnuTLS is costly, but you can help!  We are looking for
 organizations that find GnuTLS useful and wish to contribute back.  You
 can contribute by reporting bugs, improve the software, or donate money
 or equipment.

 Commercial support contracts for GnuTLS are available, and they help
 finance continued maintenance.  Simon Josefsson Datakonsult, a Stockholm
 based privately held company, is currently funding GnuTLS maintenance.
 We are always looking for interesting development projects.  See
 http://josefsson.org/ for more details.

 The GnuTLS service directory is available at:

   http://www.gnu.org/software/gnutls/commercial.html

 Happy Hacking,
 Simon

   Attachment: pgpTt8mXjRp9n.pgp
   Description: PGP signature

 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1

 Three security vulnerabilities in GnuTLS [GNUTLS-SA-2008-1]
 - -----------------------------------------------------------

 Released 2008-05-19 12:00:00 UTC.  Updated 2008-05-19 20:00.

 Vulnerabilities were discovered by Ossi Herrala and Jukka Taimisto
 from the CROSS project at Codenomicon Ltd., and reported directly to
 the vendor through CERT-FI.  Problems reproduced and patches developed
 by Simon Josefsson and Nikos Mavrogiannopoulos.  Flaw in the initial
 advisory reported by Andreas Metzler.

 All updates with more details about these vulnerabilities will be
 added to <http://www.gnu.org/software/gnutls/security.html>.

 libgnutls: Fix crash when sending invalid server name
 - -----------------------------------------------------
 [GNUTLS-SA-2008-1-1]

 The crash can be triggered remotely before authentication, which can
 lead to a Denial of Service attack to disable the server.  The bug
 cause gnutls to store more session resumption data than what was
 allocated for, thus overwriting unallocated memory.  The fix is to
 patch ext_server_name.c as below.

 libgnutls: Fix crash when sending repeated client hellos
 - --------------------------------------------------------
 [GNUTLS-SA-2008-1-2]

 The crash can be triggered remotely before authentication, which can
 lead to a Denial of Service attack to disable the server.  The bug
 triggers a null-pointer dereference.  The fix is to patch
 gnutls_handshake.c as below.

 libgnutls: Fix crash in cipher padding decoding for invalid record lengths
 - --------------------------------------------------------------------------
 [GNUTLS-SA-2008-1-3]

 The crash can be triggered remotely before authentication, which can
 lead to a Denial of Service attack to disable the server.  The bug
 cause gnutls to read memory beyond the end of the received record.
 The fix is to patch gnutls_cipher.c as below.

 How to Apply the Patch
 - ----------------------

 This file has been verified to apply to the latest stable release of
 the recent stable branches: version 1.4.5, 1.6.3, 2.0.4, and 2.2.3.
 The patch will also work with version 1.2.11 but you will need to
 apply it manually.  The patch also apply to the latest development
 version 2.3.9 but keep in mind that this version is not intended for
 production systems.  (The patch will not work for the broken releases
 version 2.2.4 and 2.3.10 since they contained an incorrect patch.)

 The patch was created with 'git-diff', so you will need to use '-p 1'
 when invoking patch.  The following illustrate how you apply the patch
 against version 1.6.3.

 address@hidden:~/src$ gpg gnutls-sa-2008-01.txt.asc
 gpg: Signature made Mon 19 May 2008 12:03:18 PM CEST using RSA key ID B565716F
 gpg: Good signature from "Simon Josefsson <address@hidden>"
 gpg:                 aka "Simon Josefsson <address@hidden>"
 address@hidden:~/src$ tar xfj gnutls-1.6.3.tar.bz2
 address@hidden:~/src$ cd gnutls-1.6.3/
 address@hidden:~/src/gnutls-1.6.3$ patch -p 1 < ../gnutls-sa-2008-01.txt
 patching file lib/ext_server_name.c
 patching file lib/gnutls_cipher.c
 Hunk #1 succeeded at 495 (offset -8 lines).
 patching file lib/gnutls_handshake.c
 Hunk #1 succeeded at 929 (offset -74 lines).
 address@hidden:~/src/gnutls-1.6.3$

 Then build the package as normal.

 diff --git a/lib/ext_server_name.c b/lib/ext_server_name.c
 index 72e42ff..a2db949 100644
 - --- a/lib/ext_server_name.c
 +++ b/lib/ext_server_name.c
 @@ -74,10 +74,27 @@ _gnutls_server_name_recv_params (gnutls_session_t session,
           len = _gnutls_read_uint16 (p);
           p += 2;

 - -       DECR_LENGTH_RET (data_size, len, 0);
 - -       server_names++;
 +         if (len > 0)
 +           {
 +             DECR_LENGTH_RET (data_size, len, 0);
 +             server_names++;
 +             p += len;
 +           }
 +         else
 +           _gnutls_handshake_log
 +             ("HSK[%x]: Received zero size server name (under attack?)\n",
 +              session);

 - -       p += len;
 +       }
 +
 +      /* we cannot accept more server names.
 +       */
 +      if (server_names > MAX_SERVER_NAME_EXTENSIONS)
 +       {
 +         _gnutls_handshake_log
 +           ("HSK[%x]: Too many server names received (under attack?)\n",
 +            session);
 +         server_names = MAX_SERVER_NAME_EXTENSIONS;
         }

        session->security_parameters.extensions.server_names_size =
 @@ -85,10 +102,6 @@ _gnutls_server_name_recv_params (gnutls_session_t session,
        if (server_names == 0)
         return 0;               /* no names found */

 - -      /* we cannot accept more server names.
 - -       */
 - -      if (server_names > MAX_SERVER_NAME_EXTENSIONS)
 - -     server_names = MAX_SERVER_NAME_EXTENSIONS;

        p = data + 2;
        for (i = 0; i < server_names; i++)
 diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c
 index e930c1d..e16ad1f 100644
 - --- a/lib/gnutls_cipher.c
 +++ b/lib/gnutls_cipher.c
 @@ -504,17 +503,20 @@ _gnutls_ciphertext2compressed (gnutls_session_t session,
 
        pad = ciphertext.data[ciphertext.size - 1] + 1;  /* pad */
 
 - -      length = ciphertext.size - hash_size - pad;
 - -
 - -      if (pad > ciphertext.size - hash_size)
 +      if ((int)pad > (int)ciphertext.size - hash_size)
         {
           gnutls_assert ();
 +         _gnutls_record_log
 +           ("REC[%x]: Short record length %d > %d - %d (under attack?)\n",
 +            session, pad, ciphertext.size, hash_size);
           /* We do not fail here. We check below for the
            * the pad_failed. If zero means success.
            */
           pad_failed = GNUTLS_E_DECRYPTION_FAILED;
         }
 
 +      length = ciphertext.size - hash_size - pad;
 +
        /* Check the pading bytes (TLS 1.x)
         */
        if (ver >= GNUTLS_TLS1 && pad_failed == 0)
 diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c
 index 4ab6db6..d798180 100644
 - --- a/lib/gnutls_handshake.c
 +++ b/lib/gnutls_handshake.c
 @@ -1003,6 +1003,14 @@ _gnutls_recv_handshake_header (gnutls_session_t session,

        *recv_type = session->internals.handshake_header_buffer.recv_type;

 +      if (*recv_type != type)
 +       {
 +         gnutls_assert ();
 +         _gnutls_handshake_log
 +           ("HSK[%x]: Handshake type mismatch (under attack?)\n", session);
 +         return GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET;
 +       }
 +
        return session->internals.handshake_header_buffer.packet_length;
      }

