NetBSD Security Advisory 2014-007: bozohttpd basic http authentication bypass
18 July, 2014 by security-officer@NetBSD.org | netbsd
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 NetBSD Security Advisory 2014-007 ================================= Topic: bozohttpd basic http authentication bypass Version: NetBSD-current: 20140708 NetBSD 6.1*: affected NetBSD 6.0*: affected NetBSD 5.2*: affected NetBSD 5.1*: affected pkgsrc: bozohttpd package prior to 20140708. Severity: Remote user may access protected files Fixed: NetBSD-current: July 8th, 2014 NetBSD-6 branch: July 10th, 2014 NetBSD-6-1 branch: July 10th, 2014 NetBSD-6-0 branch: July 10th, 2014 NetBSD-5 branch: July 10th, 2014 NetBSD-5-2 branch: July 10th, 2014 NetBSD-5-1 branch: July 10th, 2014 pkgsrc: bozohttpd-20140708 corrects this issue Please note that NetBSD releases prior to 5.1 are no longer supported. It is recommended that all users upgrade to a supported release. Abstract ======== When checking for restricted access via .htpasswd files, bozohttpd fails to properly check for truncation, allowing specially crafted requests to bypass access control without a password. Files of length 10 or more are not affected. Technical Details ================= A call to snprintf() was not properly checking for truncation of a provided user path, allowing a later concatenation of the ".htpasswd" file name to exceed the maximum pathname length. This stops the check for .htpasswd file from working correctly, bypassing the basic HTTP authentication scheme. Files with names longer than ".htpasswd" are not visible as they require at least enough for a valid path to be available. Solutions and Workarounds ========================= This problem only affects users of .htpasswd files. The simplest fix is to install the latest pkgsrc bozohttpd which fixes this problem (and use it instead of the system httpd). Alternatively, to fetch a fitting base.tgz from the releng builds and install a fixed httpd from there: 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. 20140710* 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 2014-07-08 should be upgraded to NetBSD-current dated 2014-07-10 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 6.*: Systems running NetBSD 6.* sources dated from before 2014-07-10 should be upgraded from NetBSD 6.* sources dated 2014-07-10 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 * NetBSD 5.*: Systems running NetBSD 5.* sources dated from before 2014-07-10 should be upgraded from NetBSD 5.* sources dated 2014-07-10 or later. The following files/directories need to be updated from the netbsd-5, netbsd-5-2 or netbsd-5-1 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 ================ 2014-07-17 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-SA2014-007.txt.asc Information about NetBSD and NetBSD security can be found at http://www.NetBSD.org/ and http://www.NetBSD.org/Security/ . Copyright 2014, The NetBSD Foundation, Inc. All Rights Reserved. Redistribution permitted only in full, unmodified form. $NetBSD: NetBSD-SA2014-007.txt,v 1.1 2014/07/17 21:02:39 tonnerre Exp $ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJTyDn4AAoJEAZJc6xMSnBuUd0P/Ajzyj/d0ZmA882zLdkAcluN pZBeF/Qs26O70b9Ti5bsKKsy4kn/jZ7aoOKFU1G8Fw02M4+rqZ2pZmXWkoyUR5YY kO6c4S1NKxH3ETHdx4ZQs5rg84HLr+C536nYReiB3vUuoQK4DvftBzax09+gjv1a eqW3nki/xwDwjakaCR7vpAU6OhQ67jU2pANXG3AvvS2e8zLyae5jhHeHqQWcWFwu /9wN1cDyW/WfdbQKrHVxHJW2rMuPZlxROPj7MR+8oTnMvzq9GdvuEX9MAac+/0Bs A1wK91ew4LErT4plD/nTq3KRobWR/iqV2h2raBRD9C2B6dWFeCN7dp/IkUw4dnS3 zNvKW2GW3ouE6gQRL3Ys522pQyqYLSwOguzW4wu8UJTElK0rmCo/eBAi3RjKjSTL HGGpUh6Zqw/HlT9K2SY+yan3JNCO4MNFMNO27rg5sjCLBSc0hzFCYODh2ulX0BL9 UduS+xGA87iKE0SjvD9UoZsJ0Kb46DCYLM6W/DQ/MASNFmxRpVj8h2pz9N0ijVQ3 aYuVRhiykZ/KTblZfdh95u+vZwsC83XGv3rsr4k6UjBgKMvLzAUCr2u8aXqilv/t RG0vcuzlZ6HZqDCH1gxt7Zxc1zeQ1zCI6xvkUU27AoBX8pFQbBucjfpi05QfuvW7 XBqufeyPnTG4k7mobsBf =HKpt -----END PGP SIGNATURE-----