Gentoo Archives: gentoo-user

From: Grant <emailgrant@×××××.com>
To: Gentoo mailing list <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] apache2 AddHandler/SetHandler vulnerability
Date: Sun, 26 Apr 2015 19:18:47
Message-Id: CAN0CFw3fSgAhn25Gy_rdNj5hJ7NRKL4GApx=MAqA0nYYpxduDA@mail.gmail.com
In Reply to: Re: [gentoo-user] apache2 AddHandler/SetHandler vulnerability by Michael Orlitzky
1 >> I read about this vulnerability in the
2 >> 2015-04-06-apache-addhandler-addtype Gentoo news item. I don't think
3 >> I'm using any functionality that could expose me to the problem but
4 >> I'd like to be able to say so for sure. Does the fact that I'm
5 >> up-to-date with GLSAs, I don't have PHP5 in APACHE2_OPTS (I use
6 >> php-fpm), along with the following (which I think is default) indicate
7 >> that I'm not vulnerable?
8 >
9 > (1) Do you allow untrusted people to upload files to your server?
10 >
11 > (2) If so, do you try to prevent them from uploading PHP files
12 > based on a regular expression or shell glob?
13 >
14 > Unless you answer "yes" to both of those questions, you don't need to
15 > check anything.
16 >
17 > The vulnerability is that with,
18 >
19 > AddHandler application/x-httpd-php .php
20 >
21 > Apache will go ahead and try to execute (for example) foo.php.html. If
22 > you're blocking uploads of *.php to prevent people from uploading PHP
23 > scripts, then I could name my file foo.php.html and bypass your restriction.
24 >
25 > The AddHandler behavior was documented, but incredibly unexpected -- and
26 > we had it in the default configuration. The new config we ship uses,
27 >
28 > <FilesMatch "\.php$">
29 > SetHandler application/x-httpd-php
30 > </FilesMatch>
31 >
32 > instead so only *.php files get executed.
33
34
35 Thank you Michael.
36
37 - Grant