修补wordpress的受攻击弱点

多个版本的wordpress都有这个受攻击弱点。

WordPress WordPress (B2) 0.6.2 .1
WordPress WordPress (B2) 0.6.2
WordPress WordPress 2.0.5
WordPress WordPress 2.0.4
WordPress WordPress 2.0.3
WordPress WordPress 2.0.2
WordPress WordPress 2.0.1
WordPress WordPress 2.0
WordPress WordPress 1.5.2
WordPress WordPress 1.5.1 .3
WordPress WordPress 1.5.1 .2
WordPress WordPress 1.5.1
WordPress WordPress 1.5
WordPress WordPress 1.2.2
WordPress WordPress 1.2.1
+ Gentoo Linux
WordPress WordPress 1.2
+ Gentoo Linux 1.4
+ Gentoo Linux
WordPress WordPress 0.71
WordPress WordPress 0.7

但这个弱点已经在2.0.6中修补,但当前流行使用的版本为2.0.5,所以大家还是自己补上吧:
我翻了一下我保存的各个版本的wordpress,不知道为什么也找不到原文中提到的代码。(wordpress应该是没有attribute_escape()函数的)
2.0.5中应该是这样修补的:
打开 your-wordpress/wp-admin/templates.php (应该在114行),找到

echo "<li><a href='templates.php?file=" . wp_specialchars($recent, true) . "'>" . get_file_description(basename($recent)) . "</a></li>";

修改为

echo "<li><a href='templates.php?file=" . wp_specialchars($recent, true) . "'>" . wp_specialchars(get_file_description(basename($recent))) . "</a></li>";

wordpress-1[1][1].5.2、2.0 RC2、2.0.2 – 2.0.4的templates.php原代码是这样的,

echo "<li><a href='templates.php?file=$recent'>" . get_file_description(basename($recent)) . "</a></li>";

修改为

echo "<li><a href='templates.php?file=" . wp_specialchars($recent, true) . "'>" . wp_specialchars(get_file_description(basename($recent))) . "</a></li>";

打开 your-wordpress/wp-admin/templates.php ,找到

echo "<li><a href='templates.php?file=" . attribute_escape($recent) . "'>" . get_file_description(basename($recent)) . "</a></li>";

修改为

echo "<li><a href='templates.php?file=" . attribute_escape($recent) . "'>" . wp_specialchars(get_file_description(basename($recent))) . "</a></li>";

查看更多:WordPress Template.PHP HTML Injection Vulnerability
跨站脚本攻击(XSS)FAQ