Since APC is host based allowing access to the status page is a very bad idea. Why? Because if the drupal site gets compromised, you compromise all other sites running on the same host. Imagine someone playing with the Clean OpCode Cache button. How will the host and other sites react? It can make all sites on the host unresponsive.

I would never use such a thing in any site, or recommend that someone uses it. But at least place some sort of authentication in front of the APC status page. Minimally, request the password again for accessing the APC status page.

Better yet/alternatively, without requiring any code whatsoever, provide instructions for placing basic authentication at the server level when accessing admin/reports/status/apc.

CommentFileSizeAuthor
#10 1344194-permissions.patch821 bytescafuego
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greggles’s picture

I can see the benefit of requiring a re-authentication before visiting the page, but that should be provided by another module which could do that in a more generic manner.

For the "basic authentication" solution - what should the instructions say in terms of who to give that password to? What do you see as the benefit of basic authentication compared to Drupal's authentication system?

Perhaps an alternative is simply a warning in the pre-installation documentation about what kinds of environments are or are not appropriate to install this module?

perusio’s picture

For the "basic authentication" solution - what should the instructions say in terms of who to give that password to? What do you see as the benefit of basic authentication compared to Drupal's authentication system?

  • Benefits
  1. No need to touch code.
  2. It can be filtered who can have access or not independent of any Drupal based authentication.
  3. Just use the usual tools, either htpasswd or thtpasswd.
  • Disadvantages
    1. Splits the access policy across different subsystems: server/drupal.
    2. Requires server re-configuration. In the random vulgar Apache installs that implies downtime. Not so with Nginx.

    Perhaps an alternative is simply a warning in the pre-installation documentation about what kinds of environments are or are not appropriate to install this module?

    As a stopgap I agree. In bold on the project page accompanied by a proper README. But if the author wants do fix this issue I think that any of the above suggested solutions is a better approach IMHO.

    greggles’s picture

    Can you help draft the changes you'd like to see? What aspects of access to the page make it a problem - just the "Clean OpCode Cache" button or other parts?

    bfroehle’s picture

    FYI, I added a basic README with your text in 91e50bd. Is it strongly worded enough?

    In the mean time I've removed the download link on the main page until we can agree on a warning message of your liking.

    bfroehle’s picture

    Because if the drupal site gets compromised, you compromise all other sites running on the same host. Imagine someone playing with the Clean OpCode Cache button. How will the host and other sites react? It can make all sites on the host unresponsive.

    I think this is a pretty contrived possibility. If an attacker has compromised a Drupal site there are already ways to make the host unresponsive (e.g., just flush the Drupal caches repeatedly) and if the attacker has the ability to execute arbitrary PHP code nothing would stop them from calling apc_clear_cache() or even running the apc.php script itself.

    Nonetheless, you are correct that this module should not be run in all circumstances.

    Perhaps an alternative is simply a warning in the pre-installation documentation about what kinds of environments are or are not appropriate to install this module?

    This sounds like a reasonable compromise to me. Can I have some help with the drafting this language?

    perusio’s picture

    Hello,

    This sounds like a reasonable compromise to me. Can I have some help with the drafting this language?

    Sure thing. Later today I'll fork your repo and add:

    1. Proper wording of the issues involved in the README. (Can it be on markdown?)
    2. Example configs for adding Basic Auth when accessing the APC page for both Apache (.htaccess) and Nginx.

    I'll push it to a sandbox of mine and to github also.

    How's that?

    greggles’s picture

    It can be markdown, but d.o doesn't do anything special with markdown so it's not super useful of pointless.

    I mostly agree with @bfroehle regarding using this in an abusive way. If someone has compromised an account on a Drupal site with "administer site configuration" then they can already take it over in a variety of ways. It's true that this would let them take down the whole server whereas "administer site configuration" is just about messing with the current site however on most sites, someone with "administer site configuration" would also have things like "administer users" and/or "use php for block visibility" which would lead to the exploits in the way @bfroehle mentioned. I think the best thing is a solid warning in the README.txt to remind folks that "administer site configuration" should not be given out lightly which, afaict, has mostly been done (though it could be extended).

    bfroehle’s picture

    I'll push it to a sandbox of mine and to github also.

    How's that?

    Sounds great! Thanks all!

    cafuego’s picture

    It might be an idea to add an extra permission specifically for the APC report callback and (in D7 at least) set the restrict access option on that permission. That way an extra warning is shown on the permissions page.

    cafuego’s picture

    FileSize
    821 bytes

    It might be an idea to add an extra permission specifically for the APC report callback and (in D7 at least) set the restrict access option on that permission. That way an extra warning is shown on the permissions page (as per attached patch).

    it doesn't really add extra security, but should make site maintainers think before granting said permission.

    bfroehle’s picture

    Version: 6.x-1.x-dev » 7.x-1.x-dev
    Status: Patch (to be ported) » Fixed

    Thanks for your patience, I just got home from a vacation. I've committed your patch in #10 to the 7.x-1.x branch.

    bfroehle’s picture

    Version: 6.x-1.0 » 6.x-1.x-dev
    Status: Active » Patch (to be ported)

    Should this be backported to 6.x-1.x?

    greggles’s picture

    Version: 7.x-1.x-dev » 6.x-1.x-dev
    Status: Fixed » Patch (to be ported)

    6.x-1.x doesn't have the same feature, so you can only add a note to README.txt and make the name of the permission scary.

    greggles’s picture

    Issue summary: View changes

    Corrected typo.