NetBSD

NetBSD Security Advisory 2009-012: SHA2 implementation potential buffer overflow

29 july, 2009

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


         NetBSD Security Advisory 2009-012
         =================================

Topic:        SHA2 implementation potential buffer overflow

Version:    NetBSD-current:        affected prior to 2009-05-26
        NetBSD 5.0:        affected
        NetBSD 4.0.*:        affected
        NetBSD 4.0:        affected

Severity:    Denial of Service

Fixed:        NetBSD-current:        May 26, 2009
        NetBSD-5-0 branch:    Jul 11, 2009
        NetBSD-5 branch:    Jul 11, 2009
        NetBSD-4-0 branch:    Jul 22, 2009
        NetBSD-4 branch:    Jul 22, 2009

Please note that NetBSD releases prior to 4.0 are no longer supported.
It is recommended that all users upgrade to a supported release.


Abstract
========

An error initializing a SHA2 context causes vulnerable applications using
libcrypto to suffer from a 4- or 8-byte buffer overflow (for SHA256 and
SHA512 correspondingly) with fixed content, potentially causing
applications to crash.


Technical Details
=================

A program using the SHA2 implementation from sys/sha2.h in NetBSD and
linking against libcrypto is vulnerable to a 4- or 8-byte buffer
overflow (for SHA256 and SHA512 correspondingly) with fixed content.

The overflow occurs at the time the hash init function is called (e.g.
SHA256_Init). The init functions then pass the wrong size for the
context as an argument to the memset function which then overwrites
4 bytes of the memory buffer located after the one holding the context.

In the NetBSD base system, this affects the libssh library as well as
the pkg_install framework. In libssh, the overflow occurs on the heap
of the program using it, in pkg_install a stack overflow occurs.


Solutions and Workarounds
=========================

A workaround for this issue for programs in the NetBSD base system
is to disable SHA256 as a HMAC for the secure shell and to avoid
using the audit facility as well as signed packages.

To determine whether or not a package is signed, run the command

    % tar tzf package.tgz

on the package. If the first file of the package is +PKG_HASH,
then the package is signed.

The following instructions describe how to upgrade your libcrypto
and libc binaries by updating your source tree and rebuilding and
installing a new version of the three facilities.

* NetBSD-current:

    Systems running NetBSD-current dated from before 2009-05-26
    should be upgraded to NetBSD-current dated 2009-05-27 or later.

    The following files/directories need to be updated from the
    netbsd-current CVS branch (aka HEAD):
        common/lib/libc/hash/sha2
        distrib/sets/lists
        lib/libc
        lib/libcrypto
        sys/sys

    To update from CVS, re-build, and re-install lorem:
        # cd src
        # cvs update -d -P common/lib/libc/hash/sha2
        # cvs update -d -P distrib/sets/lists
        # cvs update -d -P lib/libc
        # cvs update -d -P lib/libcrypto
        # cvs update -d -P sys/sys
        # cd sys/sys
        # make USETOOLS=no cleandir
        # make USETOOLS=no includes
        # cd ../../lib/libc
        # make USETOOLS=no cleandir dependall
        # make USETOOLS=no install
        # cd ../libcrypt
        # make USETOOLS=no cleandir dependall
        # make USETOOLS=no install
        # cd ../libcrypto
        # make USETOOLS=no cleandir dependall
        # make USETOOLS=no install

* NetBSD 5.*:

    Systems running NetBSD 5.* sources dated from before
    2009-07-11 should be upgraded from NetBSD 5.* sources dated
    2009-07-12 or later.

    The following files/directories need to be updated from the
    netbsd-5 or netbsd-5-0 branches:
        common/lib/libc/hash/sha2
        distrib/sets/lists
        lib/libc
        lib/libcrypto
        sys/sys

    To update from CVS, re-build, and re-install libc and libcrypto:

        # cd src
        # cvs update -r <branch_name> -d -P common/lib/libc/hash/sha2
        # cvs update -r <branch_name> -d -P distrib/sets/lists
        # cvs update -r <branch_name> -d -P lib/libc
        # cvs update -r <branch_name> -d -P lib/libcrypto
        # cvs update -r <branch_name> -d -P sys/sys
        # cd sys/sys
        # make USETOOLS=no cleandir
        # make USETOOLS=no includes
        # cd ../../lib/libc
        # make USETOOLS=no cleandir dependall
        # make USETOOLS=no install
        # cd ../libcrypt
        # make USETOOLS=no cleandir dependall
        # make USETOOLS=no install
        # cd ../libcrypto
        # make USETOOLS=no cleandir dependall
        # make USETOOLS=no install

* NetBSD 4.*:

    Systems running NetBSD 4.* sources dated from before
    2009-07-22 should be upgraded from NetBSD 4.* sources dated
    2009-07-23 or later.

    The following files/directories need to be updated from the
    netbsd-4 or netbsd-4-0 branches:
        common/lib/libc/hash/sha2
        distrib/sets/lists
        lib/libc
        lib/libcrypto
        sys/sys

    To update from CVS, re-build, and re-install libc and libcrypto:

        # cd src
        # cvs update -r <branch_name> -d -P common/lib/libc/hash/sha2
        # cvs update -r <branch_name> -d -P distrib/sets/lists
        # cvs update -r <branch_name> -d -P lib/libc
        # cvs update -r <branch_name> -d -P lib/libcrypto
        # cvs update -r <branch_name> -d -P sys/sys
        # cd sys/sys
        # make USETOOLS=no cleandir
        # make USETOOLS=no includes
        # cd ../../lib/libc
        # make USETOOLS=no cleandir dependall
        # make USETOOLS=no install
        # cd ../libcrypt
        # make USETOOLS=no cleandir dependall
        # make USETOOLS=no install
        # cd ../libcrypto
        # make USETOOLS=no cleandir dependall
        # make USETOOLS=no install


Thanks To
=========

Joerg Sonnenberger for finding, reporting and fixing the issue.


Revision History
================

    2009-07-28    Initial release


More Information
================

Advisories may be updated as new information becomes available.
The most recent version of this advisory (PGP signed) can be found at
  http://ftp.NetBSD.org/pub/NetBSD/security/advisories/NetBSD-SA2009-012.txt.asc

Information about NetBSD and NetBSD security can be found at
http://www.NetBSD.org/ and http://www.NetBSD.org/Security/.

Copyright 2009, The NetBSD Foundation, Inc.  All Rights Reserved.
Redistribution permitted only in full, unmodified form.

$NetBSD: NetBSD-SA2009-012.txt,v 1.1 2009/07/28 18:29:29 tonnerre Exp $

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (NetBSD)

iQIcBAEBAgAGBQJKb0ijAAoJEAZJc6xMSnBuBEEP+wa1ybcKmHkq16evmfBdGIpM
9Z7fVSvx5fDHMvUDGKL5tST/CIoRU379yiBIj/VS0tlUV9TLo1TPdrLO9XON0ara
CaIP3DK766+hjya0PwuVuy8yVhUQ6Dz2rKTBjSpmz38qv8RfvR4G6iwF3W6YNvNu
pF3vjEJIbQdT6Fen3pzb4D9aiQ6SvEZdknGGR2HmebY2ig4un+bsIJc3x+Iv87Iw
qpuJ6KQSnfLxx5qFVO5Sax8SNdL3VmQQcFhVgO3tg/ddcFUVwngXS2Wg9ChczQWt
7wM7OVwXOL1Vr0s2NcRlsIppHXvKRQxu54CuEQM6gsPcleJhsBVFo9/AbeSw4SAx
rLiR/jQ6vsC9/28ZpKGQkrtnf5fxP2R7uQIN2nylCiB+s5UDmAHAYTt1tSTMt4ou
+xgCX0OnE9iB68FoJYq1YjHMc3n4GclJz3lijXsRBzgGaSHZJc3ywYtO6puS8yUI
mXKWPdGthCDVXWiKUOBZYcuS4dv7RoA+VhI3Q1P/kwFQ9xXqb9XWSQYmLycxleA8
BjjSEuIlw5tdAnufDJA8ZRXl4gP0qhrKfPtyYkLUj6pezcyPU1QD61yK0euMr3sq
lO97lYhYqtc2gMJaOgVYoHUqbsemuRNEOdHMBeqIoC8MYYH5La6Tuub26Dwz7eDV
Mxw6htX0zEm1S/1ld7ne
=GZuc
-----END PGP SIGNATURE-----

CVE-2012-0834

Cross-site scripting (XSS) vulnerability in lib/QueryRender.php in phpLDAPadmin 1.2.2 and earlier allows remote attackers to inject arbitrary web script or HTML via the base parameter in a query_engine action to cmd.php.

10 february, 2012

CVE-2012-0452

Use-after-free vulnerability in Mozilla Firefox 10.x before 10.0.1, Thunderbird 10.x before 10.0.1, and SeaMonkey 2.7 allows remote attackers to cause a denial of service (application crash) or possibly execute arbitrary code via vectors that trig ...

10 february, 2012

CVE-2012-0840

tables/apr_hash.c in the Apache Portable Runtime (APR) library through 1.4.5 computes hash values without restricting the ability to trigger hash collisions predictably, which allows context-dependent attackers to cause a denial of service (CP ...

10 february, 2012

CVE-2012-0831

PHP before 5.3.10 does not properly perform a temporary change to the magic_quotes_gpc directive during the importing of environment variables, which makes it easier for remote attackers to conduct SQL injection attacks via a crafted request, related to m ...

10 february, 2012

CVE-2011-4534

ZenSysSrv.exe in Ing. Punzenberger COPA-DATA zenon 6.51 SP0 allows remote attackers to cause a denial of service (service crash) or possibly execute arbitrary code via a series of connections and disconnections on TCP port 1101, aka Reference Numb ...

10 february, 2012

CVE-2011-4533

zenAdminSrv.exe in Ing. Punzenberger COPA-DATA zenon 6.51 SP0 allows remote attackers to cause a denial of service (daemon crash) or possibly execute arbitrary code via a crafted packet to TCP port 50777, aka Reference Number 25240.

10 february, 2012

CVE-2011-4039

Invensys Wonderware HMI Reports 3.42.835.0304 and earlier, as used in Ocean Data Systems Dream Report before 4.0 and other products, allows user-assisted remote attackers to execute arbitrary code via a malformed file that triggers a "write access vi ...

10 february, 2012

CVE-2011-4038

Cross-site scripting (XSS) vulnerability in Invensys Wonderware HMI Reports 3.42.835.0304 and earlier, as used in Ocean Data Systems Dream Report before 4.0 and other products, allows remote attackers to inject arbitrary web script or HTML via uns ...

10 february, 2012

CVE-2012-1046

Cross-site scripting (XSS) vulnerability in TM1 Web in IBM Cognos TM1 9.5.2 FP1 allows remote attackers to inject arbitrary web script or HTML via unspecified vectors, a different vulnerability than CVE-2012-0696.

10 february, 2012

CVE-2011-3972

The shader translator implementation in Google Chrome before 17.0.963.46 allows remote attackers to cause a denial of service (out-of-bounds read) via unspecified vectors.

08 february, 2012

MS12-004 midiOutPlayNextPolyEvent Heap Overflow Exploit

Target: Microsoft Windows Media
Impact: Code execution

ActFax Server FTP RETR Remote Buffer Overflow Exploit

Target: ActFax Server 4.27 Build 0223 and previous versions
Impact: Arbitrary commands execution

ActFax Server (LPD/LPR) Remote Buffer Overflow Exploit

Target: ActFax Server 4.27 Build 0223 and previous versions
Impact: Arbitrary commands execution