From c6c77589a5860f20b5fb335033389de50e1a9031 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 28 Sep 2014 09:48:13 -0400 Subject: [PATCH] [security] XSS with malicious ENUM values Signed-off-by: Marc Delisle --- libraries/TableSearch.class.php | 11 ++++++++--- libraries/Util.class.php | 7 +++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/libraries/TableSearch.class.php b/libraries/TableSearch.class.php index 65f45ada66..af6c6f5fa0 100644 --- a/libraries/TableSearch.class.php +++ b/libraries/TableSearch.class.php @@ -307,6 +307,7 @@ EOT; private function _getEnumSetInputBox($column_index, $criteriaValues, $column_type, $column_id, $in_zoom_search_edit = false ) { + $column_type = htmlspecialchars($column_type); $html_output = ''; $value = explode( ', ', @@ -932,7 +933,9 @@ EOT; $html_output .= '' . htmlspecialchars($this->_columnNames[$column_index]) . ''; $properties = $this->getColumnProperties($column_index, $column_index); - $html_output .= '' . $properties['type'] . ''; + $html_output .= '' + . htmlspecialchars($properties['type']) + . ''; $html_output .= '' . $properties['collation'] . ''; $html_output .= '' . $properties['func'] . ''; $html_output .= '' . $properties['value'] . ''; @@ -941,11 +944,13 @@ EOT; $html_output .= ''; $html_output .= '_columnNames[$column_index]) . '" />'; $html_output .= ''; + . ' value="' + . htmlspecialchars($this->_columnTypes[$column_index]) . '" />'; $html_output .= ''; diff --git a/libraries/Util.class.php b/libraries/Util.class.php index 36ce7a1d5c..ecaec3e319 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -3150,8 +3150,11 @@ class PMA_Util // for the case ENUM('–','“') $displayed_type = htmlspecialchars($printtype); if (strlen($printtype) > $GLOBALS['cfg']['LimitChars']) { - $displayed_type = ''; - $displayed_type .= substr($printtype, 0, $GLOBALS['cfg']['LimitChars']); + $displayed_type = ''; + $displayed_type .= htmlspecialchars( + substr($printtype, 0, $GLOBALS['cfg']['LimitChars']) + ); $displayed_type .= ''; }