CVE-2015-3902 (PHP, published 2015-05-26T15:59Z)
Description: value: Multiple cross-site request forgery (CSRF) vulnerabilities in the setup process in phpMyAdmin 4.0.x before 4.0.10.10, 4.2.x before 4.2.13.3, 4.3.x before 4.3.13.1, and 4.4.x before 4.4.6.1 allow remote attackers to hijack the authentication of administrators for requests that modify the configuration file.
Severity: MEDIUM (CVSS v3 base score: )
Weakness: CWE-352 \u2014 Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
Repository: https://github.com/phpmyadmin/phpmyadmin
Files changed:
ChangeLog
libraries/url_generating.lib.php
setup/frames/form.inc.php
setup/frames/index.inc.php
setup/frames/menu.inc.php
setup/frames/servers.inc.php
setup/index.php
setup/lib/form_processing.lib.php
setup/validate.php
Commit message: bug #4899 [security] CSRF vulnerability in setup

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>


Vulnerable code:
$formset_id = filter_input(INPUT_GET, 'formset');
$mode = filter_input(INPUT_GET, 'mode');
        echo '<a href="?page=servers' . $separator
            . 'mode=edit' . $separator . 'id=' . $id . '">'
        echo '<a href="?page=servers' . $separator
            . 'mode=remove' . $separator . 'id=' . $id . '">'
echo '<a href="?version_check=1' . $separator
    . 'token=' . $_SESSION[' PMA_token '] . '">'
$formset_id = filter_input(INPUT_GET, 'formset');
echo '<li><a href="index.php"'
    echo '<li><a href="?page=form' . $separator . 'formset=' . $formset . '" '
$mode = filter_input(INPUT_GET, 'mode');
$id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT);
$page = filter_input(INPUT_GET, 'page');
$action_done = filter_input(INPUT_GET, 'action_done');
    if (filter_input(INPUT_GET, 'mode') == 'revert') {
    $page = filter_input(INPUT_GET, 'page');
    $formset = filter_input(INPUT_GET, 'formset');
    $formId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT);
        <a href="?page=<?php echo $page . $formset . $formId . $separator ?>mode=revert">
    <a class="btn" href="index.php"><?php echo __('Ignore errors') ?></a>
    <a class="btn" href="?page=<?php echo $page . $formset . $formId
$vids = explode(',', filter_input(INPUT_POST, 'id'));
$values = json_decode(filter_input(INPUT_POST, 'values'));

Fixed code:
4.4.6.1 (Not yet released)
- bug #4899 [security] CSRF vulnerability in setup

        && ! defined('PMA_SETUP')
$formset_id = isset($_GET['formset']) ? $_GET['formset'] : null;
$mode = isset($_GET['mode']) ? $_GET['mode'] : null;
        echo '<a href="' . PMA_URL_getCommon() . $separator . 'page=servers'
            . $separator . 'mode=edit' . $separator . 'id=' . $id . '">'
        echo '<a href="' . PMA_URL_getCommon() . $separator . 'page=servers'
            . $separator . 'mode=remove' . $separator . 'id=' . $id . '">'
echo '<a href="' .  PMA_URL_getCommon() . $separator . 'version_check=1">'
$formset_id = isset($_GET['formset']) ? $_GET['formset'] : null;
echo '<li><a href="index.php' . PMA_URL_getCommon() . '"'
    echo '<li><a href="' . PMA_URL_getCommon() . $separator . 'page=form'
        . $separator . 'formset=' . $formset . '" '
$mode = isset($_GET['mode']) ? $_GET['mode'] : null;
$id = PMA_isValid($_GET['id'], 'numeric') ? $_GET['id'] : null;
$page = isset($_GET['page']) ? $_GET['page'] : null;
$action_done = isset($_GET['action_done']) ? $_GET['action_done'] : null;
    if (isset($_GET['mode']) && $_GET['mode'] == 'revert') {
    $page = isset($_GET['page']) ? $_GET['page'] : null;
    $formset = isset($_GET['formset']) ? $_GET['formset'] : null;
    $formId = PMA_isValid($_GET['id'], 'numeric') ? $_GET['id'] : null;
        <a href="<?php echo PMA_URL_getCommon() . $separator ?>
            page=<?php echo $page . $formset . $formId . $separator ?>mode=revert">
    <a class="btn" href="index.php<?php echo PMA_URL_getCommon() ?>">
        <?php echo __('Ignore errors') ?></a>
    <a class="btn" href="<?php echo PMA_URL_getCommon() . $separator ?>
        page=<?php echo $page . $formset . $formId
$ids = isset($_POST['id']) ? $_POST['id'] : null;
$vids = explode(',', $ids);
$vals = isset($_POST['values']) ? $_POST['values'] : null;
$values = json_decode($vals);