Security issue with post title field (XSS vulnerability)
-
(sorry for my english, it’s not my native language)
WordPress version: 3.4.2
WordPress SEO version: 1.2.8.7I did this:
i filled the field post_title of a page/post/custom_post with “<script>alert(‘We have a problem’);</script>”I expected the plugin to do this: nothing in particular
Instead it did this:
A popup message “We have a problem”.On my site, everyone can make a post. This post is then validate by an admin user. So everyone can use the security breach to execute javascript in admin !
Temporary patch :
=================================================================== --- class-metabox.php (révision 2) +++ class-metabox.php (révision 3) @@ -816,7 +816,7 @@ echo '<div title="' . $title . '" alt="' . $title . '" class="wpseo_score_img ' . $score . '"></div>'; } if ( $column_name == 'wpseo-title' ) { - echo $this->page_title( $post_id ); + echo esc_html($this->page_title( $post_id )); } if ( $column_name == 'wpseo-metadesc' ) { echo wpseo_get_value( 'metadesc', $post_id ); Index: wp-seo-metabox.js =================================================================== --- wp-seo-metabox.js (révision 2) +++ wp-seo-metabox.js (révision 3) @@ -46,7 +46,7 @@ if ( jQuery("#yoast_wpseo_title").val() ) { var title = jQuery("#yoast_wpseo_title").val(); } else { - var title = wpseo_title_template.replace('%%title%%', jQuery('#title').val() ); + var title = wpseo_title_template.replace('%%title%%', jQuery('<div/>').text(jQuery('#title').val()).html() ); } if ( title == '' ) { jQuery('#wpseosnippet .title').html( '' );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Security issue with post title field (XSS vulnerability)’ is closed to new replies.