CVE-2016-5733 (published 2016-07-03T01:59Z)

Multiple cross-site scripting (XSS) vulnerabilities in phpMyAdmin 4.0.x before 4.0.10.16, 4.4.x before 4.4.15.7, and 4.6.x before 4.6.3 allow remote attackers to inject arbitrary web script or HTML via vectors involving (1) a crafted table name that is mishandled during privilege checking in table_row.phtml, (2) a crafted mysqld log_bin directive that is mishandled in log_selector.phtml, (3) the Transformation implementation, (4) AJAX error handling in js/ajax.js, (5) the Designer implementation, (6) the charts implementation in js/tbl_chart.js, or (7) the zoom-search implementation in rows_zoom.phtml.

Severity: MEDIUM
CVSS v2 base score: 4.3 (AV:N/AC:M/Au:N/C:N/I:P/A:N)
CVSS v3 base score: 6.1, MEDIUM (CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N)

Weakness information:
cwe_id: CWE-79
cwe_name: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
description: The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
extended_description: 
            Cross-site scripting (XSS) vulnerabilities occur when:
            
               Untrusted data enters a web application, typically from a web request.
               The web application dynamically generates a web page that contains this untrusted data.
               During page generation, the application does not prevent the data from containing content that is executable by a web browser, such as JavaScript, HTML tags, HTML attributes, mouse events, Flash, ActiveX, etc.
               A victim visits the generated web page through a web browser, which contains malicious script that was injected using the untrusted data.
               Since the script comes from a web page that was sent by the web server, the victim's web browser executes the malicious script in the context of the web server's domain.
               This effectively violates the intention of the web browser's same-origin policy, which states that scripts in one domain should not be able to access resources or run code in a different domain.
            
            There are three main kinds of XSS:
            
               
                  Type 1: Reflected XSS (or Non-Persistent) - 
         			The server reads data directly from the HTTP request and reflects it back in the HTTP response. Reflected XSS exploits occur when an attacker causes a victim to supply dangerous content to a vulnerable web application, which is then reflected back to the victim and executed by the web browser. The most common mechanism for delivering malicious content is to include it as a parameter in a URL that is posted publicly or e-mailed directly to the victim. URLs constructed in this manner constitute the core of many phishing schemes, whereby an attacker convinces a victim to visit a URL that refers to a vulnerable site. After the site reflects the attacker's content back to the victim, the content is executed by the victim's browser.
               
                  Type 2: Stored XSS (or Persistent) - 
               The application stores dangerous data in a database, message forum, visitor log, or other trusted data store. At a later time, the dangerous data is subsequently read back into the application and included in dynamic content. From an attacker's perspective, the optimal place to inject malicious content is in an area that is displayed to either many users or particularly interesting users. Interesting users typically have elevated privileges in the application or interact with sensitive data that is valuable to the attacker. If one of these users executes malicious content, the attacker may be able to perform privileged operations on behalf of the user or gain access to sensitive data belonging to the user. For example, the attacker might inject XSS into a log message, which might not be handled properly when an administrator views the logs.
            
               
                  Type 0: DOM-Based XSS - 
               In DOM-based XSS, the client performs the injection of XSS into the page; in the other types, the server performs the injection. DOM-based XSS generally involves server-controlled, trusted script that is sent to the client, such as Javascript that performs sanity checks on a form before the user submits it. If the server-supplied script processes user-supplied data and then injects it back into the web page (such as with dynamic HTML), then DOM-based XSS is possible.
            
            
            Once the malicious script is injected, the attacker can perform a variety of malicious activities. The attacker could transfer private information, such as cookies that may include session information, from the victim's machine to the attacker. The attacker could send malicious requests to a web site on behalf of the victim, which could be especially dangerous to the site if the victim has administrator privileges to manage that site. Phishing attacks could be used to emulate trusted web sites and trick the victim into entering a password, allowing the attacker to compromise the victim's account on that web site. Finally, the script could exploit a vulnerability in the web browser itself possibly taking over the victim's machine, sometimes referred to as "drive-by hacking."
            In many cases, the attack can be launched without the victim even being aware of it. Even with careful users, attackers frequently use a variety of methods to encode the malicious portion of the attack, such as URL encoding or Unicode, so the request looks less suspicious.
         
         

Fix information:
repo_url: https://github.com/phpmyadmin/phpmyadmin
commit_details: repo_url: https://github.com/phpmyadmin/phpmyadmin
author: Michal Čihař
author_date: 2016-06-17 15:38:48+02:00
msg: Simplify and cleanup transformation plugins

Remove PMA_transformation_global_html_replace which makes the code only
more confusing.

Also add escaping to browse transformations.

Signed-off-by: Michal Čihař <michal@cihar.com>
repository: repo_url: https://github.com/phpmyadmin/phpmyadmin
repo_name: phpmyadmin/phpmyadmin
description: A web interface for MySQL and MariaDB
repo_language: PHP
owner: phpmyadmin
file_changes: filename: DateFormatTransformationsPlugin.php
change_type: ModificationType.MODIFY
diff: @@ -11,6 +11,8 @@
 use PMA;
 use PMA\libraries\plugins\TransformationsPlugin;
 
+require_once 'libraries/js_escape.lib.php';
+
 /**
  * Provides common methods for all of the date format transformations plugins.
  *
@@ -145,11 +147,11 @@ public function applyTransformation($buffer, $options = array(), $meta = '')
             } else {
                 $text = 'INVALID DATE TYPE';
             }
-            $buffer = '<dfn onclick="alert(\'' . $source . '\');" title="'
-                . $source . '">' . $text . '</dfn>';
+            return '<dfn onclick="alert(\'' . PMA_jsFormat($source, false) . '\');" title="'
+                . htmlspecialchars($source) . '">' . htmlspecialchars($text) . '</dfn>';
+        } else {
+            return htmlspecialchars($buffer);
         }
-
-        return $buffer;
     }
 
     /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */

programming_language: PHP
filename: DownloadTransformationsPlugin.php
change_type: ModificationType.MODIFY
diff: @@ -69,7 +69,7 @@ public function applyTransformation($buffer, $options = array(), $meta = '')
             '<a href="transformation_wrapper.php%s&amp;ct=application'
             . '/octet-stream&amp;cn=%s" title="%s" class="disableAjax">%s</a>',
             $options['wrapper_link'],
-            urlencode($cn),
+            htmlspecialchars(urlencode($cn)),
             htmlspecialchars($cn),
             htmlspecialchars($cn)
         );

programming_language: PHP
filename: ImageLinkTransformationsPlugin.php
change_type: ModificationType.MODIFY
diff: @@ -49,16 +49,8 @@ public function applyTransformation($buffer, $options = array(), $meta = '')
     {
         // must disable the page loader, see
         // https://wiki.phpmyadmin.net/pma/Page_loader#Bypassing_the_page_loader
-        $transform_options = array(
-            'string' => '<a class="disableAjax"'
-                . ' target="_new" href="transformation_wrapper.php'
-                . $options['wrapper_link'] . '" alt="[__BUFFER__]">[BLOB]</a>',
-        );
-
-        return PMA_Transformation_globalHtmlReplace(
-            $buffer,
-            $transform_options
-        );
+        return '<a class="disableAjax" target="_new" href="transformation_wrapper.php'
+            . $options['wrapper_link'] . '" alt="[' . htmlspecialchars($buffer) . ']">[BLOB]</a>';
     }
 
     /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */

programming_language: PHP
filename: InlineTransformationsPlugin.php
change_type: ModificationType.MODIFY
diff: @@ -49,30 +49,22 @@ public static function getInfo()
     public function applyTransformation($buffer, $options = array(), $meta = '')
     {
         if (PMA_IS_GD2) {
-            $transform_options = array(
-                'string' => '<a href="transformation_wrapper.php'
-                    . $options['wrapper_link']
-                    . '" target="_blank"><img src="transformation_wrapper.php'
-                    . $options['wrapper_link'] . '&amp;resize=jpeg&amp;newWidth='
-                    . (isset($options[0]) ? $options[0] : '100') . '&amp;newHeight='
-                    . (isset($options[1]) ? $options[1] : 100)
-                    . '" alt="[__BUFFER__]" border="0" /></a>',
-            );
+            return '<a href="transformation_wrapper.php'
+                . $options['wrapper_link']
+                . '" target="_blank"><img src="transformation_wrapper.php'
+                . $options['wrapper_link'] . '&amp;resize=jpeg&amp;newWidth='
+                . (isset($options[0]) ? $options[0] : '100') . '&amp;newHeight='
+                . (isset($options[1]) ? $options[1] : 100)
+                . '" alt="[' . htmlspecialchars($buffer) . ']" border="0" /></a>';
         } else {
-            $transform_options = array(
-                'string' => '<img src="transformation_wrapper.php'
-                    . $options['wrapper_link']
-                    . '" alt="[__BUFFER__]" width="320" height="240" />',
-            );
+            return '<img src="transformation_wrapper.php'
+                . $options['wrapper_link']
+                . '" alt="[' . htmlspecialchars($buffer) . ']" width="320" height="240" />';
         }
-
-        return PMA_Transformation_globalHtmlReplace(
-            $buffer,
-            $transform_options
-        );
     }
 
 
+
     /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
 
     /**

programming_language: PHP
filename: LongToIPv4TransformationsPlugin.php
change_type: ModificationType.MODIFY
diff: @@ -42,7 +42,7 @@ public static function getInfo()
     public function applyTransformation($buffer, $options = array(), $meta = '')
     {
         if ($buffer < 0 || $buffer > 4294967295) {
-            return $buffer;
+            return htmlspecialchars($buffer);
         }
 
         return long2ip($buffer);

programming_language: PHP
filename: PreApPendTransformationsPlugin.php
change_type: ModificationType.MODIFY
diff: @@ -46,10 +46,8 @@ public function applyTransformation($buffer, $options = array(), $meta = '')
         $options = $this->getOptions($options, array('', ''));
 
         //just prepend and/or append the options to the original text
-        $newtext = htmlspecialchars($options[0]) . $buffer
+        return htmlspecialchars($options[0]) . htmlspecialchars($buffer)
             . htmlspecialchars($options[1]);
-
-        return $newtext;
     }
 
     /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */

programming_language: PHP
filename: SubstringTransformationsPlugin.php
change_type: ModificationType.MODIFY
diff: @@ -71,7 +71,7 @@ public function applyTransformation($buffer, $options = array(), $meta = '')
             }
         }
 
-        return $newtext;
+        return htmlspecialchars($newtext);
     }
 
 

programming_language: PHP
filename: TextImageLinkTransformationsPlugin.php
change_type: ModificationType.MODIFY
diff: @@ -14,9 +14,6 @@
     exit;
 }
 
-/* For PMA_Transformation_globalHtmlReplace */
-require_once 'libraries/transformations.lib.php';
-
 /**
  * Provides common methods for all of the image link transformations plugins.
  *
@@ -49,21 +46,12 @@ public static function getInfo()
      */
     public function applyTransformation($buffer, $options = array(), $meta = '')
     {
-        $transform_options = array(
-            'string' => '<a href="' . (isset($options[0]) ? $options[0] : '')
-                . $buffer . '" target="_blank"><img src="'
-                . (isset($options[0]) ? $options[0] : '') . $buffer
-                . '" border="0" width="' . (isset($options[1]) ? $options[1] : 100)
-                . '" height="' . (isset($options[2]) ? $options[2] : 50) . '" />'
-                . $buffer . '</a>',
-        );
-
-        $buffer = PMA_Transformation_globalHtmlReplace(
-            $buffer,
-            $transform_options
-        );
-
-        return $buffer;
+        return '<a href="' . htmlspecialchars(isset($options[0]) ? $options[0] : '')
+            . htmlspecialchars($buffer) . '" target="_blank"><img src="'
+            . htmlspecialchars(isset($options[0]) ? $options[0] : '') . htmlspecialchars($buffer)
+            . '" border="0" width="' . (isset($options[1]) ? $options[1] : 100)
+            . '" height="' . (isset($options[2]) ? $options[2] : 50) . '" />'
+            . htmlspecialchars($buffer) . '</a>';
     }
 
 

programming_language: PHP
filename: TextLinkTransformationsPlugin.php
change_type: ModificationType.MODIFY
diff: @@ -14,9 +14,6 @@
     exit;
 }
 
-/* For PMA_Transformation_globalHtmlReplace */
-require_once 'libraries/transformations.lib.php';
-
 /**
  * Provides common methods for all of the link transformations plugins.
  *
@@ -49,25 +46,19 @@ public static function getInfo()
      */
     public function applyTransformation($buffer, $options = array(), $meta = '')
     {
-
         $append_part = (isset($options[2]) && $options[2]) ? '' : $buffer;
 
-        $transform_options = array(
-            'string' => '<a href="'
-                . (isset($options[0]) ? $options[0] : '') . $append_part
-                . '" title="'
-                . htmlspecialchars(isset($options[1]) ? $options[1] : '')
-                . '" target="_new">'
-                . htmlspecialchars(isset($options[1]) ? $options[1] : $buffer)
-                . '</a>',
-        );
-
-        return PMA_Transformation_globalHtmlReplace(
-            $buffer,
-            $transform_options
-        );
+        return '<a href="'
+            . htmlspecialchars(isset($options[0]) ? $options[0] : '')
+            . htmlspecialchars($append_part)
+            . '" title="'
+            . htmlspecialchars(isset($options[1]) ? $options[1] : '')
+            . '" target="_new">'
+            . htmlspecialchars(isset($options[1]) ? $options[1] : $buffer)
+            . '</a>';
     }
 
+
     /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
 
     /**

programming_language: PHP
filename: transformations.lib.php
change_type: ModificationType.MODIFY
diff: @@ -400,44 +400,6 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation,
  * GLOBAL Plugin functions
  */
 
-
-/**
- * Replaces "[__BUFFER__]" occurrences found in $options['string'] with the text
- * in $buffer, after performing a regular expression search and replace on
- * $buffer using $options['regex'] and $options['regex_replace'].
- *
- * @param string $buffer  text that will be replaced in $options['string'],
- *                        after being formatted
- * @param array  $options the options required to format $buffer
- *     = array (
- *         'string'        => 'string', // text containing "[__BUFFER__]"
- *         'regex'         => 'mixed',  // the pattern to search for
- *         'regex_replace' => 'mixed',  // string or array of strings to replace
- *                                      // with
- *     );
- *
- * @return string containing the text with all the replacements
- */
-function PMA_Transformation_globalHtmlReplace($buffer, $options = array())
-{
-    if (! isset($options['string'])) {
-        $options['string'] = '';
-    }
-
-    if (isset($options['regex']) && isset($options['regex_replace'])) {
-        $buffer = preg_replace(
-            '@' . str_replace('@', '\@', $options['regex']) . '@si',
-            $options['regex_replace'],
-            $buffer
-        );
-    }
-
-    // Replace occurrences of [__BUFFER__] with actual text
-    $return = str_replace("[__BUFFER__]", $buffer, $options['string']);
-    return $return;
-}
-
-
 /**
  * Delete related transformation details
  * after deleting database. table or column

programming_language: PHP
filename: TransformationPluginsTest.php
change_type: ModificationType.MODIFY
diff: @@ -780,7 +780,7 @@ public function transformationDataProvider()
                 '<a href="transformation_wrapper.phpPMA_wrapper_link" '
                 . 'target="_blank"><img src="transformation_wrapper.php'
                 . 'PMA_wrapper_link&amp;resize=jpeg&amp;newWidth=./image/&amp;'
-                . 'newHeight=200" alt="PMA_JPEG_Inline" border="0" /></a>'
+                . 'newHeight=200" alt="[PMA_JPEG_Inline]" border="0" /></a>'
             ),
             array(
                 new Image_JPEG_Link(),
@@ -790,7 +790,7 @@ public function transformationDataProvider()
                 ),
                 '<a class="disableAjax" target="_new"'
                 . ' href="transformation_wrapper.phpPMA_wrapper_link"'
-                . ' alt="PMA_IMAGE_LINK">[BLOB]</a>'
+                . ' alt="[PMA_IMAGE_LINK]">[BLOB]</a>'
             ),
             array(
                 new Image_PNG_Inline(),
@@ -802,7 +802,7 @@ public function transformationDataProvider()
                 . ' target="_blank"><img src="transformation_wrapper.php'
                 . 'PMA_wrapper_link&amp;'
                 . 'resize=jpeg&amp;newWidth=./image/&amp;newHeight=200" '
-                . 'alt="PMA_PNG_Inline" border="0" /></a>'
+                . 'alt="[PMA_PNG_Inline]" border="0" /></a>'
             ),
             array(
                 new Text_Plain_Dateformat(),

programming_language: PHP
filename: PMA_transformation_test.php
change_type: ModificationType.MODIFY
diff: @@ -208,34 +208,6 @@ public function testGetMime()
         );
     }
 
-    /**
-     * Test for PMA_Transformation_globalHtmlReplace
-     *
-     * @return void
-     */
-    public function testTransformationGlobalHtmlReplace()
-    {
-        // Case 1
-        $actual = PMA_Transformation_globalHtmlReplace('', array());
-        $this->assertEquals(
-            '',
-            $actual
-        );
-
-        // Case 2
-        $buffer = 'foobar';
-        $options = array(
-            'regex' => 'foo',
-            'regex_replace' => 'bar',
-            'string' => 'x[__BUFFER__]x'
-        );
-        $actual = PMA_Transformation_globalHtmlReplace($buffer, $options);
-        $this->assertEquals(
-            'xbarbarx',
-            $actual
-        );
-    }
-
     /**
      * Test for PMA_clearTransformations
      *

programming_language: PHP
repo_url: https://github.com/phpmyadmin/phpmyadmin
commit_details: repo_url: https://github.com/phpmyadmin/phpmyadmin
author: Michal Čihař
author_date: 2016-06-17 14:51:15+02:00
msg: Escape binary log name

Signed-off-by: Michal Čihař <michal@cihar.com>
repository: repo_url: https://github.com/phpmyadmin/phpmyadmin
repo_name: phpmyadmin/phpmyadmin
description: A web interface for MySQL and MariaDB
repo_language: PHP
owner: phpmyadmin
file_changes: filename: log_selector.phtml
change_type: ModificationType.MODIFY
diff: @@ -7,8 +7,8 @@
         <?php $full_size = 0; ?>
         <select name="log">
             <?php foreach ($binary_logs as $each_log): ?>
-                <option value="<?= $each_log['Log_name']; ?>"<?= ($each_log['Log_name'] == $_REQUEST['log'] ? ' selected="selected"' : ''); ?>>
-                    <?= $each_log['Log_name']; ?>
+                <option value="<?= htmlspecialchars($each_log['Log_name']); ?>"<?= ($each_log['Log_name'] == $_REQUEST['log'] ? ' selected="selected"' : ''); ?>>
+                    <?= htmlspecialchars($each_log['Log_name']); ?>
                     <?php if (isset($each_log['File_size'])): ?>
                         (<?= implode(' ', \PMA\libraries\Util::formatByteDown($each_log['File_size'], 3, 2)); ?>)
                         <?php $full_size += $each_log['File_size']; ?>
@@ -24,4 +24,4 @@
     <fieldset class="tblFooters">
         <input type="submit" value="<?= __('Go'); ?>" />
     </fieldset>
-</form>
\ No newline at end of file
+</form>

programming_language: PHP
repo_url: https://github.com/phpmyadmin/phpmyadmin
commit_details: repo_url: https://github.com/phpmyadmin/phpmyadmin
author: Michal Čihař
author_date: 2016-06-22 13:07:32+02:00
msg: Fixed rendering of chart of columns with HTML inside

Signed-off-by: Michal Čihař <michal@cihar.com>
repository: repo_url: https://github.com/phpmyadmin/phpmyadmin
repo_name: phpmyadmin/phpmyadmin
description: A web interface for MySQL and MariaDB
repo_language: PHP
owner: phpmyadmin
file_changes: filename: tbl_chart.js
change_type: ModificationType.MODIFY
diff: @@ -156,7 +156,7 @@ function drawChart() {
 
     var columnNames = [];
     $('select[name="chartXAxis"] option').each(function () {
-        columnNames.push($(this).text());
+        columnNames.push(escapeHtml($(this).text()));
     });
     try {
         currentChart = PMA_queryChart(chart_data, columnNames, currentSettings);

programming_language: JavaScript
repo_url: https://github.com/phpmyadmin/phpmyadmin
commit_details: repo_url: https://github.com/phpmyadmin/phpmyadmin
author: Michal Čihař
author_date: 2016-06-22 13:26:03+02:00
msg: Do not allow javascript: links in transformation

Signed-off-by: Michal Čihař <michal@cihar.com>
repository: repo_url: https://github.com/phpmyadmin/phpmyadmin
repo_name: phpmyadmin/phpmyadmin
description: A web interface for MySQL and MariaDB
repo_language: PHP
owner: phpmyadmin
file_changes: filename: TextImageLinkTransformationsPlugin.php
change_type: ModificationType.MODIFY
diff: @@ -46,9 +46,14 @@ public static function getInfo()
      */
     public function applyTransformation($buffer, $options = array(), $meta = '')
     {
-        return '<a href="' . htmlspecialchars(isset($options[0]) ? $options[0] : '')
-            . htmlspecialchars($buffer) . '" target="_blank"><img src="'
-            . htmlspecialchars(isset($options[0]) ? $options[0] : '') . htmlspecialchars($buffer)
+        $url = (isset($options[0]) ? $options[0] : '') . $buffer;
+        $parsed = parse_url($url);
+        /* Do not allow javascript links */
+        if (isset($parsed['scheme']) && $parsed['scheme'] == 'javascript') {
+            return htmlspecialchars($url);
+        }
+        return '<a href="' . htmlspecialchars($url)
+            . '" target="_blank"><img src="' . htmlspecialchars($url)
             . '" border="0" width="' . (isset($options[1]) ? $options[1] : 100)
             . '" height="' . (isset($options[2]) ? $options[2] : 50) . '" />'
             . htmlspecialchars($buffer) . '</a>';

programming_language: PHP
filename: TextLinkTransformationsPlugin.php
change_type: ModificationType.MODIFY
diff: @@ -46,11 +46,14 @@ public static function getInfo()
      */
     public function applyTransformation($buffer, $options = array(), $meta = '')
     {
-        $append_part = (isset($options[2]) && $options[2]) ? '' : $buffer;
-
+        $url = (isset($options[0]) ? $options[0] : '') . ((isset($options[2]) && $options[2]) ? '' : $buffer);
+        $parsed = parse_url($url);
+        /* Do not allow javascript links */
+        if (isset($parsed['scheme']) && $parsed['scheme'] == 'javascript') {
+            return htmlspecialchars($url);
+        }
         return '<a href="'
-            . htmlspecialchars(isset($options[0]) ? $options[0] : '')
-            . htmlspecialchars($append_part)
+            . htmlspecialchars($url)
             . '" title="'
             . htmlspecialchars(isset($options[1]) ? $options[1] : '')
             . '" target="_new">'

programming_language: PHP
repo_url: https://github.com/phpmyadmin/phpmyadmin
commit_details: repo_url: https://github.com/phpmyadmin/phpmyadmin
author: Michal Čihař
author_date: 2016-06-22 11:10:14+02:00
msg: Properly escape zoom search column type

Signed-off-by: Michal Čihař <michal@cihar.com>
repository: repo_url: https://github.com/phpmyadmin/phpmyadmin
repo_name: phpmyadmin/phpmyadmin
description: A web interface for MySQL and MariaDB
repo_language: PHP
owner: phpmyadmin
file_changes: filename: rows_zoom.phtml
change_type: ModificationType.MODIFY
diff: @@ -78,7 +78,7 @@ for ($i = 0; $i < 4; $i++): ?>
                    name="criteriaColumnTypes[<?= $i; ?>]"
                    id="types_<?= $i; ?>"
                 <?php if (isset($_POST['criteriaColumnTypes'][$i])): ?>
-                    value="<?= $_POST['criteriaColumnTypes'][$i]; ?>"
+                    value="<?= htmlspecialchars($_POST['criteriaColumnTypes'][$i]); ?>"
                 <?php endif; ?> />
             <input type="hidden"
                    name="criteriaColumnCollations[<?= $i; ?>]"

programming_language: PHP
repo_url: https://github.com/phpmyadmin/phpmyadmin
commit_details: repo_url: https://github.com/phpmyadmin/phpmyadmin
author: Michal Čihař
author_date: 2016-06-17 14:45:29+02:00
msg: Properly escape translated string

Signed-off-by: Michal Čihař <michal@cihar.com>
repository: repo_url: https://github.com/phpmyadmin/phpmyadmin
repo_name: phpmyadmin/phpmyadmin
description: A web interface for MySQL and MariaDB
repo_language: PHP
owner: phpmyadmin
file_changes: filename: table_row.phtml
change_type: ModificationType.MODIFY
diff: @@ -58,8 +58,8 @@
     <td class="tool">
         <a onclick="PMA_commonActions.setDb('<?= PMA_jsFormat($current['SCHEMA_NAME']) ?>');"
            href="server_privileges.php<?= $url_query; ?>&amp;db=<?= urlencode($current['SCHEMA_NAME']); ?>&amp;checkprivsdb=<?= urlencode($current['SCHEMA_NAME']); ?>"
-           title="<?= sprintf(__('Check privileges for database "%s".'), htmlspecialchars($current['SCHEMA_NAME'])); ?>">
+           title="<?= htmlspecialchars(sprintf(__('Check privileges for database "%s".'), $current['SCHEMA_NAME'])); ?>">
            <?= \PMA\libraries\Util::getIcon('s_rights.png', __('Check privileges')); ?>
         </a>
     </td>
-</tr>
\ No newline at end of file
+</tr>

programming_language: PHP
repo_url: https://github.com/phpmyadmin/phpmyadmin
commit_details: repo_url: https://github.com/phpmyadmin/phpmyadmin
author: Michal Čihař
author_date: 2016-06-20 10:06:42+02:00
msg: Escape HTML when rendering AJAX error

Signed-off-by: Michal Čihař <michal@cihar.com>
repository: repo_url: https://github.com/phpmyadmin/phpmyadmin
repo_name: phpmyadmin/phpmyadmin
description: A web interface for MySQL and MariaDB
repo_language: PHP
owner: phpmyadmin
file_changes: filename: ajax.js
change_type: ModificationType.MODIFY
diff: @@ -787,8 +787,8 @@ $(document).ajaxError(function (event, request, settings) {
         PMA_ajaxShowMessage(
             '<div class="error">' +
             PMA_messages.strErrorProcessingRequest +
-            '<div>' + errorCode + '</div>' +
-            '<div>' + errorText + '</div>' +
+            '<div>' + escapeHtml(errorCode) + '</div>' +
+            '<div>' + escapeHtml(errorText) + '</div>' +
             '</div>',
             false
         );

programming_language: JavaScript
repo_url: https://github.com/phpmyadmin/phpmyadmin
commit_details: repo_url: https://github.com/phpmyadmin/phpmyadmin
author: Michal Čihař
author_date: 2016-06-20 10:03:40+02:00
msg: Escape attributes when showing images in javascript

Signed-off-by: Michal Čihař <michal@cihar.com>
repository: repo_url: https://github.com/phpmyadmin/phpmyadmin
repo_name: phpmyadmin/phpmyadmin
description: A web interface for MySQL and MariaDB
repo_language: PHP
owner: phpmyadmin
file_changes: filename: get_image.js.php
change_type: ModificationType.MODIFY
diff: @@ -109,15 +109,15 @@ function PMA_getImage(image, alternate, attributes) {
     }
     // set alt
     if (attributes.alt != undefined) {
-        retval.attr('alt', attributes.alt);
+        retval.attr('alt', escapeHtml(attributes.alt));
     } else {
-        retval.attr('alt', alternate);
+        retval.attr('alt', escapeHtml(alternate));
     }
     // set title
     if (attributes.title != undefined) {
-        retval.attr('title', attributes.title);
+        retval.attr('title', escapeHtml(attributes.title));
     } else {
-        retval.attr('title', alternate);
+        retval.attr('title', escapeHtml(alternate));
     }
     // set src
     var klass = image.replace('.gif', '').replace('.png', '');

programming_language: JavaScript