downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

명령줄에서 PHP 사용하기> <보안과 안전 모드
Last updated: Fri, 24 Jul 2009

view this page in

안전 모드에 의해 제한되는/비활성화되는 함수들

다음은 아직 완전하지 않고 부정확할 수도 있는 안전 모드에 의해 제한되는 함수 목록이다.

안전 모드 제한 함수들
함수 제한점
dbmopen() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
dbase_open() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
filepro() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
filepro_rowcount() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
filepro_retrieve() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
ifx_* sql_safe_mode 제한, (!= safe mode)
ingres_* sql_safe_mode 제한, (!= safe mode)
mysql_* sql_safe_mode 제한, (!= safe mode)
pg_lo_import() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
posix_mkfifo() 작업하려는 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
putenv() safe_mode_protected_env_vars 와 safe_mode_allowed_env_vars ini-지시어에 따름. putenv() 문서 참고.
move_uploaded_file() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
chdir() 작업하려는 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
dl() 이 함수는 PHP가 안전 모드일 때는 사용할 수 없습니다.
backtick operator 이 함수는 PHP가 안전 모드일 때는 사용할 수 없습니다.
shell_exec() (functional equivalent of backticks) 이 함수는 PHP가 안전 모드일 때는 사용할 수 없습니다.
exec() safe_mode_exec_dir안의 실행파일만 실행할수 있다. 실무적인 이유로 현재는 실행파일에 대한 경로에 ..을 허용하지 않는다. 이 함수의 인수에는 escapeshellcmd()를 실행합니다.
system() safe_mode_exec_dir안의 실행파일만 실행할수 있다. 실무적인 이유로 현재는 실행파일에 대한 경로에 ..을 허용하지 않는다. 이 함수의 인수에는 escapeshellcmd()를 실행합니다.
passthru() safe_mode_exec_dir안의 실행파일만 실행할수 있다. 실무적인 이유로 현재는 실행파일에 대한 경로에 ..을 허용하지 않는다. 이 함수의 인수에는 escapeshellcmd()를 실행합니다.
popen() safe_mode_exec_dir안의 실행파일만 실행할수 있다. 실무적인 이유로 현재는 실행파일에 대한 경로에 ..을 허용하지 않는다. 이 함수의 인수에는 escapeshellcmd()를 실행합니다.
fopen() 작업하려는 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
mkdir() 작업하려는 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
rmdir() 작업하려는 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
rename() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다. 작업하려는 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
unlink() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다. 작업하려는 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
copy() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다. 작업하려는 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다. (sourcetarget 에서)
chgrp() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
chown() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
chmod() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다. 추가적으로, SUID, SGID와 sticky 비트를 설정할수 없다
touch() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다. 작업하려는 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다.
symlink() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다. 작업하려는 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다. (주의: 타겟만 검사됨)
link() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다. 작업하려는 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다. (주의: 타겟만 검사됨)
apache_request_headers() 안전 모드에서, 'authorization' (대소문자 구별안함)로 시작하는 헤더를 반환하지 않습니다.
header() 안전 모드에서, WWW-Authenticate(HTTP 인증에서 사용됨)를 설정하면, 이 헤더의 realm부분에 스크립트의 uid가 추가된다.
PHP_AUTH variables 안전 모드에서는, 변수 PHP_AUTH_USER와, PHP_AUTH_PW, AUTH_TYPE$_SERVER 안에서 사용될수 없다. 그와 상관 없이, USER에 대해서 REMOTE_USER을 사용할수 있다 (주의: PHP 4.3.0 이후에서만 적용됨)
highlight_file(), show_source() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다. 작업하려는 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다. (주의: PHP 4.2.1 이후에서만 적용됨)
parse_ini_file() 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다. 작업하려는 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다. (note: PHP 4.2.1 이후에서만 적용됨)
set_time_limit() PHP가 안전 모드에서 실행되면 아무 효과가 없음.
max_execution_time PHP가 안전 모드에서 실행되면 아무 효과가 없음.
mail() 안전 모드에서, 다섯번째 인수는 사용할 수 없습니다. (주의: PHP 4.2.3부터 적용)
session_start() 기본값인 files session.save_handler를 사용할 때 스트립트 소유자는 session.save_path 디렉토리 소유자와 같아야 합니다.
모든 파일시스템과 스트림 함수. 작업하려는 파일이나 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다. 작업하려는 디렉토리가 실행 중인 스크립트와 같은 UID (owner)를 가지고 있는지 확인합니다. (safe_mode_include_dir php.ini 옵션 참고)



명령줄에서 PHP 사용하기> <보안과 안전 모드
Last updated: Fri, 24 Jul 2009
 
add a note add a note User Contributed Notes
안전 모드에 의해 제한되는/비활성화되는 함수들
Stephen Dewey
13-Jul-2009 07:39
curl_setopt() will not allow you to activate CURLOPT_FOLLOWLOCATION when in safe mode.
tschmieder at bitworks dot de
22-Sep-2007 01:04
refers to the previuos posting of

bananarama
15-May-2006 10:11

"all file-handling and -management functions are restricted, just in case someones wondering why they're not listed here.
a script can run these functions on files without errors, if the files were created (are owned) by the same UID, the script was created (is owned) by."

.... or if the directory, in which the file is located, has the same UID as the script, which tries to use a file in that directory...
bananarama
15-May-2006 08:11
all file-handling and -management functions are restricted, just in case someones wondering why they're not listed here.
a script can run these functions on files without errors, if the files were created (are owned) by the same UID, the script was created (is owned) by.

example:
you upload a script, it is owned by UID 720. you upload a picture, it is owned by UID 720. the script creates a thumbnail of the picture. the thumb is owned by UID 30 (the server/apache). this makes it impossible (?) to run a gallery script, which checks for newly uploaded pictures in order to create and display thumbs of them if you want to check, if a thumbnail already exists. the script would be owned by UID 720, the thumb by UID 30.
you could upload a script which creates a file (e.g. from a text file) with .php ending. this script would be owned by UID 30 and could access the thumbs, but it couldnt read the upload pictures.

<?
  $data = fread(fopen("test.txt", "r"), filesize("test.txt"));
  
  $file = "test.php";  
  if (!$file_handle = fopen($file,"a")) { echo "Cannot open file"; } 
  if (!fwrite($file_handle, $data)) { echo "Cannot write to file"; }   
  fclose($file_handle);
 
  chmod("test.php", 0777);
?>
zauker
21-Mar-2006 10:57
The SAFE_MODE handling of glob() needs a checkup for security reasons.

In short - always with SAFE_MODE on:

1) glob() can still fetch all filenames in a directory not owned by the
same UID as the user, if just the first file in the directory (or more
specific, the glob-pattern) happens to be owned by the same user as the
PHP-script.

2a) No warning is raised if glob is used on another owner's directory
and there is no match.

2b) In those cases where SAFE_MODE correctly prohibits glob() from
fetching a list of files, the warning still discloses the first
filename.

Solution: glob() in SAFE_MODE should be restricted in the same way as
opendir() is

see the link http://bugs.php.net/bug.php?id=28932
Jan
23-Oct-2005 09:46
It seems that glob and file_exists functions are also restricted in safe-mode.

명령줄에서 PHP 사용하기> <보안과 안전 모드
Last updated: Fri, 24 Jul 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites