各种安全介绍都说明为了避免暴露WordPress版本信息而导致公开漏洞被利用,需要隐藏网站的WordPress版本信息。一般建议都是修改主题和functions.php代码实现。但是,这些方法只是隐藏了WordPress本身程序的版本信息,还有不少WordPress的插件也在“主动”暴露这些信息。
两个sitemap插件暴露WordPress版本信息
一般采用清除主题head相关代码和在functions.php中加入:
<!–?php function wpbeginner_remove_version() {return ”;} add_filter(‘the_generator’, ‘wpbeginner_remove_version’);?–>
这样的过滤隐藏的是WordPress自身版本信息,对插件是无效的。
Google Sitemap Generator Plugin for WordPress
sitemap.xml中没有直接显示版本信息,但是这个xml的源代码中有版本信息的说明:
<!–?xml version=”1.0″ encoding=”UTF-8″?–>
<!–?xml-stylesheet type=”text/xsl” href=”https://www.enkoo.net/……/google-sitemap-generator/sitemap.xsl”?–>
<!– generator=”wordpress/3.2.1″ –>
<!– sitemap-generator-url=”http://www.arnebrachhold.de” sitemap-generator-version=”3.2.6″ –>
在Google Sitemap Generator Plugin插件的$sitemap-core.php中清除this->AddElement()
相关说明项。
Baidu Sitemap Generator
Baidu Sitemap Generator是直接在sitemap.xml中显示了相关版本信息:
该 XML 文件并未包含任何关联的样式信息。文档树显示如下。
<document><!– generator=”wordpress/3.2.1” –><
!– baidu-sitemap-generator-url=”http://liucheng.name/” baidu-sitemap-generator-version=”1.31″ –>
在Baidu Sitemap Generator插件的baidu_sitemap.php中清除$xml_author_annotate
说明代码。
这类插件不在少数,而且是提供了公开可访问页面,也就是直接将Wordpress版本信息直接自动暴露。
话说回来,WordPress的漏洞一般也是被黑客利用。对于黑客而言,隐藏不隐藏WordPress版本信息没有任何作用吧?