Forum Moderators: phranque
I can't CHMOD the affected directories (image directories) because of the nature of our website (images are uploaded on a constant basis), but I started thinking:
What if I upload an .htaccess file that is CHMOD'd 644 and prevents PHP scripts from running in that directory?
Would this work?
What would I need to put in the .htaccess to prevent anything with a .php extension from running?
Any help much appreciated... thanks...
- B
RemoveHandler .php
Whether such a modified .htaccess file will survive depends on how you allow uploads to your server. Obviously, no filtering is currently being done, which is allowing any type of file to be uploaded.
It sounds like your server configuration and scripts need a thorough review by a server security expert. If this is a commercially-hosted site, you might start by asking your hsoting company for some assistance. You current setup is not only a threat to itself, but represents a threat to the Web as a whole; Any kind of script could apparently be uploaded, causing your server to attack other servers on the Web...
Jim
If someone has been able to set up their own custom .htaccess file in your directory, that's a pretty big problem that won't be solved by setting more restrictive permissions on a file within that directory, even if it is .htaccess.
If it's a shared hosting, but with SuExec, you don't need and you shouldn't use unsafe permission like 777/666.
If it's a dedicated/VPS server, it means the server is compromized.
You need full review of the security situation.