]> git.joonet.de Git - adminer.git/commitdiff
Fix XSS (thanks to Jigal van Hemert)
authorJakub Vrana <jakub@vrana.cz>
Tue, 26 Jul 2011 20:25:20 +0000 (22:25 +0200)
committerJakub Vrana <jakub@vrana.cz>
Wed, 27 Jul 2011 06:01:51 +0000 (08:01 +0200)
adminer/include/design.inc.php
adminer/include/functions.inc.php
adminer/trigger.inc.php
changes.txt

index 85c501c0d7aa7682f9874872ca55373f93a5bb23..383f1e5179b1406623afe2542d526ac13c0b0ac9 100644 (file)
@@ -38,7 +38,7 @@ var areYouSure = '<?php echo lang('Resend POST data?'); ?>';
 <?php } ?>
 <?php } ?>
 
-<body class="<?php echo lang('ltr'); ?> nojs"<?php echo ($_POST ? "" : " onclick=\"return bodyClick(event, '" . js_escape(DB) . "', '" . js_escape($_GET["ns"]) . "');\""); // avoid re-post confirmation after refreshing the next page in Google Chrome ?> onkeydown="bodyKeydown(event);" onload="bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info, 0, 3) : ""); ?>');<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion();"); ?>">
+<body class="<?php echo lang('ltr'); ?> nojs"<?php echo ($_POST ? "" : " onclick=\"return bodyClick(event, '" . h(js_escape(DB) . "', '" . js_escape($_GET["ns"])) . "');\""); // avoid re-post confirmation after refreshing the next page in Google Chrome ?> onkeydown="bodyKeydown(event);" onload="bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info, 0, 3) : ""); ?>');<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion();"); ?>">
 <script type="text/javascript">
 document.body.className = document.body.className.replace(/(^|\s)nojs(\s|$)/, '$1js$2');
 </script>
index d6a6ffc9bb7fffb2007b4d0af62f92249aa30274..89b393dd069435eda845fab922c552872335d9a0 100644 (file)
@@ -130,7 +130,7 @@ function optionlist($options, $selected = null, $use_keys = false) {
 */
 function html_select($name, $options, $value = "", $onchange = true) {
        if ($onchange) {
-               return "<select name='" . h($name) . "'" . (is_string($onchange) ? " onchange=\"$onchange\"" : "") . ">" . optionlist($options, $value) . "</select>";
+               return "<select name='" . h($name) . "'" . (is_string($onchange) ? ' onchange="' . h($onchange) . '"' : "") . ">" . optionlist($options, $value) . "</select>";
        }
        $return = "";
        foreach ($options as $key => $val) {
@@ -676,7 +676,7 @@ function input($field, $value, $function) {
                        }
                        $first++;
                }
-               $onchange = ($first ? " onchange=\"var f = this.form['function[" . js_escape($name) . "]']; if ($first > f.selectedIndex) f.selectedIndex = $first;\"" : "");
+               $onchange = ($first ? " onchange=\"var f = this.form['function[" . h(js_escape($name)) . "]']; if ($first > f.selectedIndex) f.selectedIndex = $first;\"" : "");
                $attrs .= $onchange;
                echo (count($functions) > 1 ? html_select("function[$name]", $functions, !isset($function) || in_array($function, $functions) || isset($functions[$function]) ? $function : "", "functionChange(this);") : nbsp(reset($functions))) . '<td>';
                $input = $adminer->editInput($_GET["edit"], $field, $attrs, $value); // usage in call is without a table
index 1ac3930f40c417dd3543373da6c857b84f1cb08c..d072c26361419fa576c09339176368586e875189 100644 (file)
@@ -30,7 +30,7 @@ if ($_POST) {
 
 <form action="" method="post" id="form">
 <table cellspacing="0">
-<tr><th><?php echo lang('Time'); ?><td><?php echo html_select("Timing", $trigger_options["Timing"], $row["Timing"], "if (/^" . h(preg_quote($TABLE, "/")) . "_[ba][iud]$/.test(this.form['Trigger'].value)) this.form['Trigger'].value = '" . h(js_escape($TABLE)) . "_' + selectValue(this).charAt(0).toLowerCase() + selectValue(this.form['Event']).charAt(0).toLowerCase();"); ?>
+<tr><th><?php echo lang('Time'); ?><td><?php echo html_select("Timing", $trigger_options["Timing"], $row["Timing"], "if (/^" . preg_quote($TABLE, "/") . "_[ba][iud]$/.test(this.form['Trigger'].value)) this.form['Trigger'].value = '" . js_escape($TABLE) . "_' + selectValue(this).charAt(0).toLowerCase() + selectValue(this.form['Event']).charAt(0).toLowerCase();"); ?>
 <tr><th><?php echo lang('Event'); ?><td><?php echo html_select("Event", $trigger_event, $row["Event"], "this.form['Timing'].onchange();"); ?>
 <tr><th><?php echo lang('Type'); ?><td><?php echo html_select("Type", $trigger_options["Type"], $row["Type"]); ?>
 </table>
index 32129d1582f6bd324bb4204e7ab9d6211bb9d787..b268553b24e39bc72f6aac1b1da813b9891d647f 100644 (file)
@@ -1,4 +1,5 @@
 Adminer 3.3.1-dev:
+Fix XSS introduced in Adminer 3.2.0
 Fix altering default values (PostgreSQL)
 Process list (PostgreSQL)