Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] apache2 AddHandler/SetHandler vulnerability
Date: Sun, 26 Apr 2015 08:05:09
Message-Id: 201504260904.52284.michaelkintzios@gmail.com
In Reply to: Re: [gentoo-user] apache2 AddHandler/SetHandler vulnerability by Michael Orlitzky
1 On Sunday 26 Apr 2015 01:51:37 Michael Orlitzky wrote:
2 > On 04/25/2015 05:23 PM, Grant wrote:
3 > > I read about this vulnerability in the
4 > > 2015-04-06-apache-addhandler-addtype Gentoo news item. I don't think
5 > > I'm using any functionality that could expose me to the problem but
6 > > I'd like to be able to say so for sure. Does the fact that I'm
7 > > up-to-date with GLSAs, I don't have PHP5 in APACHE2_OPTS (I use
8 > > php-fpm), along with the following (which I think is default) indicate
9 > > that I'm not vulnerable?
10 >
11 > (1) Do you allow untrusted people to upload files to your server?
12 >
13 > (2) If so, do you try to prevent them from uploading PHP files
14 > based on a regular expression or shell glob?
15 >
16 > Unless you answer "yes" to both of those questions, you don't need to
17 > check anything.
18 >
19 > The vulnerability is that with,
20 >
21 > AddHandler application/x-httpd-php .php
22 >
23 > Apache will go ahead and try to execute (for example) foo.php.html. If
24 > you're blocking uploads of *.php to prevent people from uploading PHP
25 > scripts, then I could name my file foo.php.html and bypass your
26 > restriction.
27 >
28 > The AddHandler behavior was documented, but incredibly unexpected -- and
29 > we had it in the default configuration. The new config we ship uses,
30 >
31 > <FilesMatch "\.php$">
32 > SetHandler application/x-httpd-php
33 > </FilesMatch>
34 >
35 > instead so only *.php files get executed.
36
37 Hmm ... I am probably affected by this change too. Running find for '*.php.*'
38 et al, comes up with a tonne of files like this:
39
40 /var/www/My_Website_Name/htdocs/modules/simpletest/tests/upgrade/drupal-7.filled.minimal.database.php.gz
41
42 If I were to manually install protection, as suggested in the news item, where
43 should I be doing this? In (umpteen) .htaccess files for each vhost, or
44 somewhere in /etc/apache2/*
45
46 --
47 Regards,
48 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] apache2 AddHandler/SetHandler vulnerability Michael Orlitzky <mjo@g.o>