During the release of the latest wordpress 2.8.2, it was announced that a cross-site scripting vulnerability affecting the comment author url in the administration panel was fixed. For those interested in the complete source code changes, see changeset 11721.
Three notable changes have been made:
1. _wp_comment_row() in wp-admin/includes/template.php
285
286
287
288
| - $author_url_display = $author_url;
- $author_url_display = str_replace('http://www.', '', $author_url_display);
- $author_url_display = str_replace('http://', '', $author_url_display);
+ $author_url_display = preg_replace('|http://(www\.)?|i', '', $author_url); |
2. get_comment_to_edit() in wp-admin/includes/comment.php
92
93
94
| + $comment->comment_author_url = format_to_edit( $comment->comment_author_url );
$comment->comment_author_url = esc_url($comment->comment_author_url);
- $comment->comment_author_url = format_to_edit( $comment->comment_author_url ); |
esc_url() which escapes the urls is now being called before format_to_edit().
3. Finally, get_comment_author_url() in wp-includes/comment-template.php
196
197
198
| $url = ('http://' == $comment->comment_author_url) ? '' : $comment->comment_author_url;
+ $url = esc_url( $url, array('http', 'https') );
return apply_filters('get_comment_author_url', $url); |
The escape function esc_url() is being applied to the url of the comment.
What’s a bit more interesting about all of that is how different websites on the internet blogged about that security issue; in other words, how they understood it.
Blogging Planet said:
A new version of the popular blogging platform Wordpress was released just a few minutes ago. It is an unexpected upgrade considering that the last Wordpress update was less than two weeks ago. The new update fixes a security vulnerability that affects all but the latest version of Wordpress.
The XSS vulnerability could be used to create comment author urls that would redirect the system administrator away from the blog’s website to another site to exploit the situation.
Well even with all this fury about cross site scripting and other browser bugs exploitation. It seems that the rest of the world still considers a cross site scripting vulnerability as something that is being used to redirect people… What about code execution in the wordpress administration panel? =)
