1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| $content = preg_replace("#(/\*)[\s\S]*(\*/)#i", '', $content);
global $cfg_disable_funs; $cfg_disable_funs = isset($cfg_disable_funs) ? $cfg_disable_funs : 'phpinfo,eval,assert,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source,file_put_contents,fsockopen,fopen,fwrite,preg_replace'; $cfg_disable_funs = $cfg_disable_funs.',[$]_GET,[$]_POST,[$]_REQUEST,[$]_FILES,[$]_COOKIE,[$]_SERVER,include,create_function,array_map,call_user_func,call_user_func_array,array_filert'; foreach (explode(",", $cfg_disable_funs) as $value) { $value = str_replace(" ", "", $value); if(!empty($value) && preg_match("#[^a-z]+['\"]*{$value}['\"]*[\s]*[([{]#i", " {$content}") == TRUE) { $content = dede_htmlspecialchars($content); die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$content}</pre>"); } }
if(preg_match("#^[\s\S]+<\?(php|=)?[\s]+#i", " {$content}") == TRUE) { if(preg_match("#[$][_0-9a-z]+[\s]*[(][\s\S]*[)][\s]*[;]#iU", " {$content}") == TRUE) { $content = dede_htmlspecialchars($content); die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$content}</pre>"); } if(preg_match("#[@][$][_0-9a-z]+[\s]*[(][\s\S]*[)]#iU", " {$content}") == TRUE) { $content = dede_htmlspecialchars($content); die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$content}</pre>"); } if(preg_match("#[`][\s\S]*[`]#i", " {$content}") == TRUE) { $content = dede_htmlspecialchars($content); die("DedeCMS提示:当前页面中存在恶意代码!<pre>{$content}</pre>"); } }
|