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

===========================================================================
             AUSCERT External Security Bulletin Redistribution

                               ESB-2016.1015
          bozohttpd CGI handlers potential remote code execution
                               22 April 2016

===========================================================================

        AusCERT Security Bulletin Summary
        ---------------------------------

Product:           bozohttpd
Publisher:         NetBSD
Operating System:  NetBSD
Impact/Access:     Execute Arbitrary Code/Commands -- Remote/Unauthenticated
Resolution:        Patch/Upgrade
CVE Names:         CVE-2015-8212  

Original Bulletin: 
   http://ftp.NetBSD.org/pub/NetBSD/security/advisories/NetBSD-SA2016-005.txt.asc

- --------------------------BEGIN INCLUDED TEXT--------------------

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

                 NetBSD Security Advisory 2016-005
                 =================================

Topic:          bozohttpd CGI handlers potential remote code execution

Version:        NetBSD-current:         20160415
                NetBSD 7.0:             affected
                NetBSD 6.1 - 6.1.5:     affected
                NetBSD 6.0 - 6.0.6:     affected

Severity:       Potential execution of arbitrary commands as httpd user

Fixed:          NetBSD-current:         April 15, 2016
                NetBSD-7 branch:        April 15, 2016
                NetBSD-6 branch:        April 15, 2016
                NetBSD-6-1 branch:      April 15, 2016
                NetBSD-6-0 branch:      April 15, 2016
                pkgsrc:                 bozohttpd-20160415 corrects this issue

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

Abstract
========

Running programs as CGI handlers that were not designed to serve as such
may create a vulnerability since bozohttpd would pass any arguments
to the executed binary.  In the worst case scenario this may lead to
remote code execution.

This vulnerability has been assigned CVE-2015-8212.

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

bozohttpd supports option -C which can be used to add a CGI handler for a
particular file type. It was designed to support both CGI and non-CGI aware
programs to serve dynamic content. Binaries were executed using arguments
from the remote client. In case of non-CGI programs this can be abused
to exploit features of such programs and change their behaviour, which
in worst case scenario can lead to running attacker-provided code.

It was proven that arbitrary code can be executed in case of PHP-CLI
as CGI handler.


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

This problem only affects users which use not-CGI aware programs as
CGI handlers (such as sh, CLI version of PHP etc.) directly.
The simplest fix is to install the latest pkgsrc bozohttpd which fixes this
problem (and run it instead of the system one). Support for non-CGI handlers
has been removed as there's no way to securely handle user's requests.

cd /var/tmp
ftp http://nyftp.netbsd.org/pub/NetBSD-daily/<rel>/<build>/<arch>/binary/sets/base.tgz
cd /
tar xzpf /var/tmp/base.tgz ./usr/libexec/httpd

with the following replacements:
<rel>   = the release version you are using
<build> = the source date of the build. 20160416* and later will fit
<arch>  = your system's architecture

The following instructions describe how to upgrade your bozohttpd
binaries by updating your source tree and rebuilding and
installing a new version of bozohttpd.

The following instructions describe how to upgrade your bozohttpd
binary by updating your source tree and rebuilding and installing
a new version of bozohttpd.


* NetBSD-current:

        Systems running NetBSD-current dated from before 2016-04-15
        should be upgraded to NetBSD-current dated 2016-04-16 or later.

        The following files/directories need to be updated from the
        netbsd-current CVS branch (aka HEAD):
                src/libexec/httpd

        To update from CVS, re-build, and re-install bozohttpd:
                # cd src
                # cvs update -d -P libexec/httpd
                # cd libexec/httpd
                # make USETOOLS=no cleandir dependall
                # make USETOOLS=no install

* NetBSD 7.*:

        Systems running NetBSD 7.* sources dated from before
        2016-04-15 should be upgraded from NetBSD 7.* sources dated
        2016-04-16 or later.

        The following files/directories need to be updated from the
        netbsd-7, netbsd-7-0 branches:
                src/libexec/httpd

        To update from CVS, re-build, and re-install bozohttpd:

                # cd src
                # cvs update -r <branch_name> -d -P libexec/httpd
                # cd libexec/httpd
                # make USETOOLS=no cleandir dependall
                # make USETOOLS=no install



* NetBSD 6.*:

        Systems running NetBSD 6.* sources dated from before
        2016-04-15 should be upgraded from NetBSD 6.* sources dated
        2016-04-16 or later.

        The following files/directories need to be updated from the
        netbsd-6, netbsd-6-1 or netbsd-6-0 branches:
                src/libexec/httpd

        To update from CVS, re-build, and re-install bozohttpd:

                # cd src
                # cvs update -r <branch_name> -d -P libexec/httpd
                # cd libexec/httpd
                # make USETOOLS=no cleandir dependall
                # make USETOOLS=no install

Thanks To
=========

Thanks go to Mateusz Kocielski who found this problem and supplied
the fixes.

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

        2016-04-21     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-SA2016-005.txt.asc

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

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

$Id: NetBSD-SA2016-005.txt,v 1.1 2016/04/21 16:15:07 christos Exp $

- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJXGPzCAAoJEAZJc6xMSnBu/qcQALGoQF9v6u52UEBT+MhpC07A
LQpU+o6S447bSduvr7mshy31zjwDM9mmqS4l+1Sk0DphuoZU9sMupYvrx4KrJ6za
dcL9E8+4iZ3M+Zz6yCzdYqvN4NF+zeaPeOWMpxOjJn/YOO40V0sLCE9n74hl72OQ
NqNvbsOWrxP6Wa3Qs4AIi067yFmR2HFASFiRf7bvZuiC+x/4ODtir9mgKLUOROgj
qrEFhZoM5rPLEy+0oDCd9ouYuOy1iPgw2S+ssQlAtuHrIANQHPOU642clY8d4/cW
aSm3HgXPhJXugDZENQtgQ8UM1HdBjH7TCJA30D+ryw8rGoNaw2P8o1+K1j6fHuOC
SLsyenypB1HsKhD6TNHI0Tr15yBqtkVXwA6EHoerA92K2LmvtFZHNo0D5sQwNviu
isAZB8dL0rnHFyXi+vnsHzIC4lc7BDRArVS63MBAnDewRLk9eDYt9F1zUdO6YkKH
9mbwV05iXT1+I22KDp4j/bQDTiS0Llx2yhgwFHjglVKyEkrys9Y7P5fHOqTOHDCZ
1d+y98QsS3YO8XyuZdbo2AcYoaOXectZDFt/M0Pg7UF0W/lxTomGRwZDWZPpoFn3
bou9jIq+x+AlAUPaAYaJfZwQ9T7OktwgxuOB65ly/UWQ6N6Ztl+kBRc9RduwvUfL
cawd54WCtlmRWIuKeCmz
=aiei
- -----END PGP SIGNATURE-----

- --------------------------END INCLUDED TEXT--------------------

You have received this e-mail bulletin as a result of your organisation's
registration with AusCERT. The mailing list you are subscribed to is
maintained within your organisation, so if you do not wish to continue
receiving these bulletins you should contact your local IT manager. If
you do not know who that is, please send an email to auscert@auscert.org.au
and we will forward your request to the appropriate person.

NOTE: Third Party Rights
This security bulletin is provided as a service to AusCERT's members.  As
AusCERT did not write the document quoted above, AusCERT has had no control
over its content. The decision to follow or act on information or advice
contained in this security bulletin is the responsibility of each user or
organisation, and should be considered in accordance with your organisation's
site policies and procedures. AusCERT takes no responsibility for consequences
which may arise from following or acting on information or advice contained in
this security bulletin.

NOTE: This is only the original release of the security bulletin.  It may
not be updated when updates to the original are made.  If downloading at
a later date, it is recommended that the bulletin is retrieved directly
from the author's website to ensure that the information is still current.

Contact information for the authors of the original document is included
in the Security Bulletin above.  If you have any questions or need further
information, please contact them directly.

Previous advisories and external security bulletins can be retrieved from:

        http://www.auscert.org.au/render.html?cid=1980

===========================================================================
Australian Computer Emergency Response Team
The University of Queensland
Brisbane
Qld 4072

Internet Email: auscert@auscert.org.au
Facsimile:      (07) 3365 7031
Telephone:      (07) 3365 4417 (International: +61 7 3365 4417)
                AusCERT personnel answer during Queensland business hours
                which are GMT+10:00 (AEST).
                On call after hours for member emergencies only.
===========================================================================
-----BEGIN PGP SIGNATURE-----
Comment: http://www.auscert.org.au/render.html?it=1967

iQIVAwUBVxl2q36ZAP0PgtI9AQI5jBAAjtWd+bkr1qmVPaDYZD0q49eXtOW7jqPb
Hn8whkHT/ZZT7RHeIf60DeQorE+re1l3tTUiUsNOb+L+29E+58I23WNgb+wCXrsw
Z0TIYUh6UFEccp3rF7bFcYhWVXiWW1ntssmsS7RObA7ijP16uFsfzwE76q1mFrjj
oTnmjofwyRHtn2gfmxUdR6ggXdNI++vu6pKqTS2wGwfpp58WqrumdObrTsE5ZIvd
iXssA7vhIhzqe/mJUfXALx/1QdLa8b2VOalCcT5J2j7qP6ge6rmDhe/h35I8KvWb
a4wZ7N02GCb6ZezJnKh1Kpc4eFVYPmfffLX4ioaX6qp4CerZtaKYKh5A+WIso4Ag
vlqtGy1XS52quV/oi+oGRKwPNhsAzM7buTuZQE1b08ptK0fdx2naobmohUNg0Vie
azKmjGB3GZ06+mSVA2NSOUF4uJ8GDaVwSzyRKBmlVnGjtub2TGy/oOBdH/L6dW3k
UQtZcJE/Dt+38r3Q/gai76KTKvxjiT1ElCkjN0Av88oAGfvZX7CUWA+hnIEH1X9f
hLW/JhsDem9AqQ08lXHbGsQzm85Kp1fvbOOohCmlijVUaGKMNi/H0dTjc8VE35fF
Ftp0Yha1CrAc4Uzq+b2q6GuHlixE5cO5gTGh1L0XHOVYCKIcXNtWmMqoUuuAwGWl
/n9dooJgzAw=
=P4Xr
-----END PGP SIGNATURE-----