Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6193003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:02:35+00:00 2026-05-24T03:02:35+00:00

Recently I’ve ran into some security issues where a cracker has found an exploit

  • 0

Recently I’ve ran into some security issues where a cracker has found an exploit in website code to upload arbitrary files, one of which was a “PHP Shell” that gave them all kinds of cracking tools and apache level access to the server.

While the exploit has been fixed and files removed, for the sake of locking down the Linux server I’d like to make it so that any files owned by apache (the user that apache runs as) can’t be executed as PHP. All PHP files that are legit are owned by different users.

We do need to keep directories writable by apache because we do have various CMSes installed that allow for users to upload images and documents. Another option I know we can do is turn off php for those directories writable by apache, but since it would need to happen to hundreds of domains on multiple servers, I was hoping to do a more “global” fix so that I wouldn’t have to make sure the list of directories exempted from PHP is always up to date, etc.

Thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:02:36+00:00Added an answer on May 24, 2026 at 3:02 am

    Really, it seems to me that the most secure option is probably to disable PHP in any directory where files will be written, as any other approach seems likely to be brittle. You could modify mod_php (or, if you’re using FastCGI, the way FastCGI processes are spawned), though these approaches seem fairly involved.

    If you’re intent on using this using owner (and, I would recommend, also permissions to ensure that it isn’t just a world-writable PHP file someone found), then one kludge you could do is using auto_prepend_file in php.ini.

    This lets you put some PHP code in a file which will be required at the beginning of all PHP scripts. You could write, in PHP, any logic you needed to validate that the file should run (and forcefully exit otherwise). You could even send an email to the administrator or take some other appropriate action in the case where the script should not run.

    http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file

    But as I said, this approach is very much a hack. It’s much better to disable PHP support in any directory writable by the web server, rather than relying on ownership.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently I ran into this error in my web application: java.lang.OutOfMemoryError: PermGen space It's
Recently Jeff has posted regarding his trouble with database deadlocks related to reading. Multiversion
Recently, I started changing some of our applications to support MS SQL Server as
Recently our site has been deluged with the resurgence of the Asprox botnet SQL
Recently I had to develop a SharePoint workflow, and I found the experience quite
Recently a friend and I were talking about securing stored procedure code in a
Recently I had to type up some documentation on .net data providers and ado.net.
Recently I've started to develop Android Soft Keyboard and got some problem with preferences.
Recently, I've been running some tests with C++ and VB.NET to compare execution speeds.
Recently I have been investigating the possibilities of caching in ASP.NET. I rolled my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.