public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Michael Orlitzky <mjo@gentoo.org>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] apache2 AddHandler/SetHandler vulnerability
Date: Sun, 26 Apr 2015 13:14:32 -0400	[thread overview]
Message-ID: <553D1CF8.1070007@gentoo.org> (raw)
In-Reply-To: <201504260904.52284.michaelkintzios@gmail.com>

On 04/26/2015 04:04 AM, Mick wrote:
> 
> Hmm ... I am probably affected by this change too.  Running find for '*.php.*' 
> et al, comes up with a tonne of files like this:
> 
> /var/www/My_Website_Name/htdocs/modules/simpletest/tests/upgrade/drupal-7.filled.minimal.database.php.gz
> 
> If I were to manually install protection, as suggested in the news item, where 
> should I be doing this?  In (umpteen) .htaccess files for each vhost, or 
> somewhere in /etc/apache2/*
> 

That's only a problem if those php.gz files can be uploaded by an
untrusted user (and you want to stop them).

That's a Drupal site, right? If you allow anonymous users to create
accounts and upload files, then I could create an "mjo" account on your
site and upload exploit.php.html to sites/default/files/mjo. Then I
could visit,

  http://example.org/sites/default/files/mjo/exploit.php.html

and it would run the script with the permissions of your web server. So,
it could probably read the database password out of
sites/default/settings.php.

The half-assed way to prevent that is to block uploads of *.php files,
but the point of the vulnerability is that not only PHP files will be
executed. A better way is to disable the PHP engine entirely on any user
upload directories. There was actually a Drupal CVE for that:

  https://www.drupal.org/SA-CORE-2013-003

And yeah, you should do that on every user-upload directory for every
website you have. It sucks but you can use mod_macro if you have more
than one e.g. Drupal site. I've got this in our Drupal macro:

  <Directory "/var/www/$domain/$host/public/sites/*/files">
    # Deny access to user-uploaded PHP files.
    <Files "*.php">
      Require all denied
    </Files>
  </Directory>

But maybe it's safer to use,

  <Directory "/var/www/$domain/$host/public/sites/*/files">
    <Files "*">
      php_flag engine off
    </Files>
  </Directory>



  reply	other threads:[~2015-04-26 17:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-25 21:23 [gentoo-user] apache2 AddHandler/SetHandler vulnerability Grant
2015-04-26  0:51 ` Michael Orlitzky
2015-04-26  8:04   ` Mick
2015-04-26 17:14     ` Michael Orlitzky [this message]
2015-04-26 21:48       ` Mick
2015-04-26 22:04         ` Michael Orlitzky
2015-04-26 19:18   ` Grant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=553D1CF8.1070007@gentoo.org \
    --to=mjo@gentoo.org \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox