From cb7c703c03f656debcea2a16468bd53660fc888e Mon Sep 17 00:00:00 2001 From: "Ann + J.M" Date: Fri, 6 Jun 2014 18:40:19 +0200 Subject: [PATCH] Fix XSS in recent/favorite tables list feature Signed-off-by: Ann + J.M --- libraries/RecentFavoriteTable.class.php | 13 ++++++++----- libraries/structure.lib.php | 11 ++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/libraries/RecentFavoriteTable.class.php b/libraries/RecentFavoriteTable.class.php index 54041c51a3..84aed20988 100644 --- a/libraries/RecentFavoriteTable.class.php +++ b/libraries/RecentFavoriteTable.class.php @@ -206,8 +206,9 @@ class PMA_RecentFavoriteTable $html .= '`' . $table['db'] . '`.`' . $table['table'] . '`'; + . '&token=' . $_SESSION[' PMA_token '] . '">`' + . htmlspecialchars($table['db']) . '`.`' + . htmlspecialchars($table['table']) . '`'; $html .= ''; } } else { @@ -223,7 +224,8 @@ class PMA_RecentFavoriteTable . PMA_URL_getCommon($fav_params); $html .= 'href="' . $fav_rm_url . '" title="' . __("Remove from Favorites") - . '" data-favtargetn="' . $table['db'] . "." . $table['table'] + . '" data-favtargetn="' + . md5($table['db'] . "." . $table['table']) . '" >' . PMA_Util::getIcon('b_favorite.png') . ''; @@ -231,8 +233,9 @@ class PMA_RecentFavoriteTable $html .= '`' . $table['db'] . '`.`' . $table['table'] . '`'; + . '&token=' . $_SESSION[' PMA_token '] . '">`' + . htmlspecialchars($table['db']) . '`.`' + . htmlspecialchars($table['table']) . '`'; $html .= ''; } } diff --git a/libraries/structure.lib.php b/libraries/structure.lib.php index 5e32c6935e..db5777184f 100644 --- a/libraries/structure.lib.php +++ b/libraries/structure.lib.php @@ -2736,9 +2736,8 @@ function PMA_checkFavoriteTable($db, $current_table) function PMA_getHtmlForFavoriteAnchor($db, $current_table, $titles) { $html_output = ' $db, 'ajax_request' => true, 'favorite_table' => $current_table['TABLE_NAME'], - (($already_favorite?'remove':'add') . '_favorite') => true); + (($already_favorite?'remove':'add') . '_favorite') => true + ); $fav_url = 'db_structure.php' . PMA_URL_getCommon($fav_params); $html_output .= '" '; $html_output .= 'href="' . $fav_url . '" title="' . ($already_favorite ? __("Remove from Favorites") : __("Add to Favorites")) - . '" data-favtargets="' . $db . "." . $current_table['TABLE_NAME'] + . '" data-favtargets="' + . md5($db . "." . $current_table['TABLE_NAME']) . '" >' . (!$already_favorite ? $titles['NoFavorite'] : $titles['Favorite']) . '';