2011-04-19 19 views
2

下面是我已經開始的列表,並且希望完成。我正在創建一個從文件系統讀取或寫入的完整函數列表。見下文。我錯過了哪些?由於什麼是可以訪問PHP5中的文件系統的完整功能列表?

readfile, fpassthru, file, file_get_contents, system, fopen, symlink, rename, copy, exec, passthru, pcntl_exec, backtick_operator, shell_exec, popen, proc_open, chmod, chown, chgrp, touch, dl, highlight_file, show_source, mkdir, rmdir, posix_mkfifo, dbase_open, dbmopen, filepro, pg_lo_import, move_uploaded_file, link

列表可以用於掃描潛在的性能問題(許多天真的開發者並沒有意識到,訪問文件系統太慢),定位潛在mallicious代碼,後門等

+0

針對版本2的建議:很多天真的開發人員不知道文件系統和網絡之間的區別,並執行諸如require('http://example.com/footer.php')之類的內容。 – 2011-04-19 14:32:50

+0

這只是冰山一角......例如,加載XML(例如,在simplexml,dom等)中的大多數函數,甚至是XSLT模板都可以訪問文件系統。 – Artefacto 2011-04-19 14:55:34

+0

還有許多其他的擴展:zip,openssl,intl(標準的),加上PECL中的一半。你永遠不會放在一個可靠的名單。 – Artefacto 2011-04-19 14:58:30

回答

2

這在Exploitable PHP Functions上市

參見Apache文檔。另外請記住,「命令執行」功能也可用於訪問文件系統,這是最可能發生的更大問題。

> // open filesystem handler fopen 
> tmpfile bzopen gzopen // write to 
> filesystem (partially in combination 
> with reading) chgrp chmod chown copy 
> file_put_contents lchgrp lchown link 
> mkdir move_uploaded_file rename rmdir 
> symlink tempnam touch unlink imagepng - 2nd parameter is a path. 
> imagewbmp - 2nd parameter is a path. 
> image2wbmp - 2nd parameter is a path. 
> imagejpeg - 2nd parameter is a path. 
> imagexbm - 2nd parameter is a path. 
> imagegif - 2nd parameter is a path. 
> imagegd - 2nd parameter is a path. 
> imagegd2 - 2nd parameter is a path. 
> iptcembed ftp_get ftp_nb_get // read from 
> filesystem file_exists 
> file_get_contents file fileatime 
> filectime filegroup fileinode 
> filemtime fileowner fileperms filesize 
> filetype glob is_dir is_executable 
> is_file is_link is_readable 
> is_uploaded_file is_writable 
> is_writeable linkinfo lstat 
> parse_ini_file pathinfo readfile 
> readlink realpath stat gzfile 
> readgzfile getimagesize 
> imagecreatefromgif imagecreatefromjpeg 
> imagecreatefrompng imagecreatefromwbmp 
> imagecreatefromxbm imagecreatefromxpm 
> ftp_put ftp_nb_put exif_read_data 
> read_exif_data exif_thumbnail 
> exif_imagetype hash_file 
> hash_hmac_file hash_update_file 
> md5_file sha1_file highlight_file 
> show_source php_strip_whitespace 
> get_meta_tags 
0

而是限制PHP功能的使用,考慮chroot環境中運行PHP來保護你的文件系統。對於chrootdir指令

相關問題