note 33627 added to security
| From: | ocrow at simplexity dot net | Date: | Wed, 02 Jul 2003 10:16:19 +0000 |
| Subject: | note 33627 added to security | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51343@lists.php.net to get a copy of this message | ||
If your PHP pages include() or require() files that live within the web server document root, for
example library files in the same directory as the PHP pages, you must account for the possibility
that attackers may call those library files directly.
Any program level code in the library files (ie code not part of function definitions) will be
directly executable by the caller outside of the scope of the intended calling sequence. An
attacker may be able to leverage this ability to cause unintended effects.
The most robust way to guard against this possibility is to prevent your webserver from calling the
library scripts directly, either by moving them out of the document root, or by putting them in a
folder configured to refuse web server access. With Apache for example, create a .htaccess file in
the library script folder with these directives:
Order Allow,Deny
Deny from any
----
Manual Page -- http://www.php.net/manual/en/security.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33627
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33627&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33627&report=yes