From 1e7e134c7df5a84486289ab05e701e3da2aa27e9 Mon Sep 17 00:00:00 2001 From: Gabor Hojtsy Date: Sat, 20 Jan 2001 19:13:22 +0000 Subject: [PATCH] .php3 -> .php git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@39892 c90b9560-bf6c-de11-be94-00142212c4b1 --- chapters/security.xml | 60 +++++++++++++++++++++---------------------- security/index.xml | 60 +++++++++++++++++++++---------------------- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/chapters/security.xml b/chapters/security.xml index 50a5b90316..9a2bd9933b 100644 --- a/chapters/security.xml +++ b/chapters/security.xml @@ -83,15 +83,15 @@ Usually some web server configuration directives (Apache: Action) are used to redirect requests to documents like http://my.host/secret/script.php3 to the + role="url">http://my.host/secret/script.php to the PHP interpreter. With this setup, the web server first checks the access permissions to the directory /secret, and after that creates the redirected request http://my.host/cgi-bin/php/secret/script.php3. + role="url">http://my.host/cgi-bin/php/secret/script.php. Unfortunately, if the request is originally given in this form, no access checks are made by web server for file /secret/script.php3, but only for the + role="uri">/secret/script.php, but only for the /cgi-bin/php file. This way any user able to access /cgi-bin/php is able to access any @@ -125,9 +125,9 @@ to the configure script. You still have to make sure your PHP scripts do not rely on one or another way of calling the script, neither by directly http://my.host/cgi-bin/php/dir/script.php3 + role="php">http://my.host/cgi-bin/php/dir/script.php nor by redirection http://my.host/dir/script.php3. + role="php">http://my.host/dir/script.php. Redirection can be configured in Apache by using AddHandler and @@ -140,7 +140,7 @@ This compile-time option prevents anyone from calling PHP directly with a url like http://my.host/cgi-bin/php/secretdir/script.php3. + role="php">http://my.host/cgi-bin/php/secretdir/script.php. Instead, PHP will only parse in this mode if it has gone through a web server redirect rule. @@ -149,8 +149,8 @@ the following directives: -Action php3-script /cgi-bin/php -AddHandler php3-script .php3 +Action php-script /cgi-bin/php +AddHandler php-script .php This option has only been tested with the Apache web server, and @@ -199,21 +199,21 @@ AddHandler php3-script .php3 linkend="ini.user-dir">user_dir. When user_dir is unset, only thing controlling the opened file name is doc_root. Opening an url like http://my.host/~user/doc.php3 does not + role="url">http://my.host/~user/doc.php does not result in opening a file under users home directory, but a file - called ~user/doc.php3 under + called ~user/doc.php under doc_root (yes, a directory name starting with a tilde [~]). If user_dir is set to for example public_php, a request like http://my.host/~user/doc.php3 will open a - file called doc.php3 under the directory + role="url">http://my.host/~user/doc.php will open a + file called doc.php under the directory named public_php under the home directory of the user. If the home of the user is /home/user, the file executed is - /home/user/public_php/doc.php3. + /home/user/public_php/doc.php. user_dir expansion happens regardless of @@ -254,22 +254,6 @@ AddHandler php3-script .php3 - - Keeping Current - - PHP, like any other large system, is under constant scrutiny and - improvement. Each new version will often include both major and - minor changes to enhance and repair security flaws, configuration - mishaps, and other issues that will affect the overall security - and stability of your system. - - - Like other system-level scripting languages and programs, the best - approach is to update often, and maintain awareness of the latest - versions and their changes. - - - Installed as an Apache module @@ -406,7 +390,7 @@ echo "$file_to_delete has been deleted!"; More secure file name checking <?php -$username = get_env("REMOTE_USER"); +$username = getenv("REMOTE_USER"); $homedir = "/home/$username"; if (!ereg('^[^./][^/]*$', $userfile)) @@ -601,6 +585,22 @@ exec ($evil_var); become one. + + + Keeping Current + + PHP, like any other large system, is under constant scrutiny and + improvement. Each new version will often include both major and + minor changes to enhance and repair security flaws, configuration + mishaps, and other issues that will affect the overall security + and stability of your system. + + + Like other system-level scripting languages and programs, the best + approach is to update often, and maintain awareness of the latest + versions and their changes. + +