Jump to content

[SOLVED] PHP permissions


SirChick

Recommended Posts

Well i asked a while back to a friend about security and he said to put the php files into directories so attacks couldn't guess where the php files were, I then later asked on a number of forums to see what the general opinion was about this idea and in short most said it made no difference so it wasn't worth my effort to put my php files into folders etc.

 

But some people mentioned that php permissions will help with my security.. I had never really heard about it and that was the only info I had... so I don't know what php permissions are exactly but if it helps security I am needing to learn it.

 

Becuase im at the security stage development of my site you see.

Link to comment
Share on other sites

well possibly... all my files are in one place which is "htdocs" folder.. so i guess i would only need to set one permission on that folder or something ? =/

 

I'm not 100 % sure on what he meant anyway but im going to assume directory permissions is what he meant.

Link to comment
Share on other sites

What exactly are you trying to achieve? If you change the permissions on the directory your php files are in so they become un-executable, then, they will be un-executable. Meaning they will not work.

 

They way I have my framework setup, the only php script within the web doc root is the front controller. Every other file is outside. This stops people from being able to access the files directly but even so...

 

The best way to secure your php files is to make sure you check any data that is sent to them properly. eg; If you have a php script that expects values passed to it via a form, make sure you check the form sent the variables and that they are valid prior to th script executing.

 

You don't want (for instance) a script attempting to insert data to a database unless it has that data available to it.

Link to comment
Share on other sites

They way I have my framework setup, the only php script within the web doc root is the front controller. Every other file is outside. This stops people from being able to access the files directly but even so...

 

not sure what you mean by "outside" is the front controller like the front login page?

Link to comment
Share on other sites

More like this is your host's Webroot structure:

 

/users/b1234/domain/htdocs  and htdocs is your folder that holds pages that load if you went to www.domain.com.

 

But from his access, he can put folders and files back one hive and set them in /users/b1234/domain and use absolute paths to get to them, but from a webuser's standpoint, there is no way to navigate before the htdocs folder.

Link to comment
Share on other sites

You can't move your web document root unless your using a vps or dedicated server. This is usually controlled via your host.

 

I'll ask again in a different way. What benifits do you hope to achieve by having your php files out of reach?

Link to comment
Share on other sites

ps: Most websites will not work with there files outside the web root dir, because clients can no longer reach them.

 

I use a framework which has one access point to the entire process. Thus I have the ability to call scripts from outside of the doc root.

Link to comment
Share on other sites

well security increased basically... and to stop people guessing php file names to avoid them running a script which could cause problems to the game.

 

I was told if they are easy to guess the where abouts of the php file and its name then attacks can get at them ?

Link to comment
Share on other sites

I was told if they are easy to guess the where abouts of the php file and its name then attacks can get at them ?

 

This really depends on what the scripts do, but like I said, If you check your scripts are recieveing the data they expect from where they expect to recieve it you shouldn't have any issues.

 

Moving files outside your docroot is not the solution, but part of a bigger one. Always check your request data.

Link to comment
Share on other sites

how can u test to see where they receive it from ?

 

I can do the the receiving data checks there pretty straight forward.. if == '' header the page etc.. but how can you check where it comes from ?  Would that require sessions again ? Or do $_POST carry some unique ID tag to them so you know what forms they come from ?

Link to comment
Share on other sites

$_SERVER['HTTP_REFERRER'];

 

The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.