十一
08

wordpress的模板文件,缺少访问验证,直接访问模板里的文件,就会泄露物理路径。这个不是PHP漏洞,是WordPress的漏洞。

比如访问:http://hostname/wordpress/wp-content/themes/default

就会显示:

Fatal error: Unknown function: get_header() in /home/public_html/blog/wp-content/themes/default/index.php on line 1

解决办法

在模板里的文件头部加上以下代码,可以防止泄露路径。

<?php
if(!defined(‘WP_USE_THEMES’)) {
exit(
‘Access Denied’);
}
?>

相关日志



Tags: ,

View:318 views

No Responses

Leave a Response

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>