认识PHP危险函数
什么是危险函数?
函数设计出来就是让人使用的,之所以危险,是因为其功能过于强大开发人员特别是刚从业的人员很少会完整阅读完整个文档,再或者是没有意识到当给这些函数传递一些非常规的,外部可控的参数会带来什么影响。
执行任意代码的函数
常见执行任意代码的函数
eval函数
assert函数
create_function函数
preg_replace函数
call_user_func/call_user_func_array函数
array_map函数
array_filter函数
usort/uasort函数
$a($b)动态函数
读取网络资源的函数
- Fopen()
- File_get_content()
- curl
操作文件的函数
copy()
File_get_contents()/File_put_contents()
File()
Fopen()
Move_uploaded_file()
rename()
rmdir()
unlink()
<?php
copy('shell.php','shell2.php');
File_get_contents('shell.php','shell2.php');
File_put_contents('shell.php','shell2.php');
move_uploaded_file(filename,destination);
rename("旧文件","新文件名");
rmdir('旧文件夹名','新文件夹名');
unlink('文件名');// 删除文件
?>