CVE-2016-5097 (published 2016-07-05T01:59Z)

phpMyAdmin before 4.6.2 places tokens in query strings and does not arrange for them to be stripped before external navigation, which allows remote attackers to obtain sensitive information by reading (1) HTTP requests or (2) server logs.

Severity: MEDIUM
CVSS v2 base score: 5.0 (AV:N/AC:L/Au:N/C:P/I:N/A:N)
CVSS v3 base score: 5.3, MEDIUM (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N)

Weakness information:
cwe_id: CWE-200
cwe_name: Exposure of Sensitive Information to an Unauthorized Actor
description: The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
extended_description: 
	   There are many different kinds of mistakes that introduce information exposures. The severity of the error can range widely, depending on the context in which the product operates, the type of sensitive information that is revealed, and the benefits it may provide to an attacker.  Some kinds of sensitive information include:
       
         private, personal information, such as personal messages, financial data, health records, geographic location, or contact details
         system status and environment, such as the operating system and installed packages
		 business secrets and intellectual property
		 network status and configuration
		 the product's own code or internal state
         metadata, e.g. logging of connections or message headers
		 indirect information, such as a discrepancy between two internal operations that can be observed by an outsider
       
	    Information might be sensitive to different parties, each of which may have their own expectations for whether the information should be protected.  These parties include:
               
                  the product's own users
                  people or organizations whose information is created or used by the product, even if they are not direct product users
		  the product's administrators, including the admins of the system(s) and/or networks on which the product operates
                  the developer
               
	    Information exposures can occur in different ways:
               
                  the code explicitly inserts sensitive information into resources or messages that are intentionally made accessible to unauthorized actors, but should not contain the information - i.e., the information should have been "scrubbed" or "sanitized"
                  a different weakness or mistake indirectly inserts the sensitive information into resources, such as a web script error revealing the full system path of the program.
                  the code manages resources that intentionally contain sensitive information, but the resources are unintentionally made accessible to unauthorized actors. In this case, the information exposure is resultant - i.e., a different weakness enabled the access to the information in the first place.
               
	    It is common practice to describe any loss of confidentiality as an "information exposure," but this can lead to overuse of CWE-200 in CWE mapping. From the CWE perspective, loss of confidentiality is a technical impact that can arise from dozens of different weaknesses, such as insecure file permissions or out-of-bounds read.  CWE-200 and its lower-level descendants are intended to cover the mistakes that occur in behaviors that explicitly manage, store, transfer, or cleanse sensitive information.
         
         

Fix information:
repo_url: https://github.com/phpmyadmin/phpmyadmin
commit_details: repo_url: https://github.com/phpmyadmin/phpmyadmin
author: Michal Čihař
author_date: 2016-04-29 15:35:02+02:00
msg: Pass links to external sites in changelog through url.php

This avoids possible information disclossure in the links (token).

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: changelog.php
change_type: ModificationType.MODIFY
diff: @@ -56,15 +56,15 @@
 
 $replaces = array(
     '@(http://[./a-zA-Z0-9.-_-]*[/a-zA-Z0-9_])@'
-    => '<a href="\\1">\\1</a>',
+    => '<a href="url.php?url=\\1">\\1</a>',
 
     // sourceforge users
     '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*)@users.sourceforge.net&gt;/i'
-    => '\\1 <a href="https://sourceforge.net/users/\\3/">\\2</a>',
+    => '\\1 <a href="url.php?url=https://sourceforge.net/users/\\3/">\\2</a>',
     '/thanks to ([^\(\r\n]+) \(([-\w]+)\)/i'
-    => 'thanks to <a href="https://sourceforge.net/users/\\2/">\\1</a>',
+    => 'thanks to <a href="url.php?url=https://sourceforge.net/users/\\2/">\\1</a>',
     '/thanks to ([^\(\r\n]+) -\s+([-\w]+)/i'
-    => 'thanks to <a href="https://sourceforge.net/users/\\2/">\\1</a>',
+    => 'thanks to <a href="url.php?url=https://sourceforge.net/users/\\2/">\\1</a>',
 
     // mail address
     '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*@.*)&gt;/i'
@@ -72,59 +72,59 @@
 
     // linking patches
     '/patch\s*#?([0-9]{6,})/i'
-    => '<a href="' . $tracker_url . '">patch #\\1</a>',
+    => '<a href="url.php?url=' . $tracker_url . '">patch #\\1</a>',
 
     // linking RFE
     '/(?:rfe|feature)\s*#?([0-9]{6,})/i'
-    => '<a href="https://sourceforge.net/support/tracker.php?aid=\\1">RFE #\\1</a>',
+    => '<a href="url.php?url=https://sourceforge.net/support/tracker.php?aid=\\1">RFE #\\1</a>',
 
     // linking files
     '/(\s+)([\\/a-z_0-9\.]+\.(?:php3?|html|pl|js|sh))/i'
-    => '\\1<a href="' . $github_url . 'commits/HEAD/\\2">\\2</a>',
+    => '\\1<a href="url.php?url=' . $github_url . 'commits/HEAD/\\2">\\2</a>',
 
     // FAQ entries
     '/FAQ ([0-9]+)\.([0-9a-z]+)/i'
-    => '<a href="' . $faq_url . '#faq\\1-\\2">FAQ \\1.\\2</a>',
+    => '<a href="url.php?url=' . $faq_url . '#faq\\1-\\2">FAQ \\1.\\2</a>',
 
     // linking bugs
     '/bug\s*#?([0-9]{6,})/i'
-    => '<a href="https://sourceforge.net/support/tracker.php?aid=\\1">bug #\\1</a>',
+    => '<a href="url.php?url=https://sourceforge.net/support/tracker.php?aid=\\1">bug #\\1</a>',
 
     // all other 6+ digit numbers are treated as bugs
     '/(?<!bug|RFE|patch) #?([0-9]{6,})/i'
-    => '<a href="' . $tracker_url . '">bug #\\1</a>',
+    => '<a href="url.php?url=' . $tracker_url . '">bug #\\1</a>',
 
     // GitHub issues
     '/issue\s*#?([0-9]{4,5}) /i'
-    => '<a href="' . $github_url . 'issues/\\1">issue #\\1</a> ',
+    => '<a href="url.php?url=' . $github_url . 'issues/\\1">issue #\\1</a> ',
 
     // transitioned SF.net project bug/rfe/patch links
     // by the time we reach 6-digit numbers, we can probably retire the above links
     '/patch\s*#?([0-9]{4,5}) /i'
-    => '<a href="' . $tracker_url_patch . '">patch #\\1</a> ',
+    => '<a href="url.php?url=' . $tracker_url_patch . '">patch #\\1</a> ',
     '/(?:rfe|feature)\s*#?([0-9]{4,5}) /i'
-    => '<a href="' . $tracker_url_rfe . '">RFE #\\1</a> ',
+    => '<a href="url.php?url=' . $tracker_url_rfe . '">RFE #\\1</a> ',
     '/bug\s*#?([0-9]{4,5}) /i'
-    => '<a href="' . $tracker_url_bug . '">bug #\\1</a> ',
+    => '<a href="url.php?url=' . $tracker_url_bug . '">bug #\\1</a> ',
     '/(?<!bug|RFE|patch) #?([0-9]{4,5}) /i'
-    => '<a href="' . $tracker_url_bug . '">bug #\\1</a> ',
+    => '<a href="url.php?url=' . $tracker_url_bug . '">bug #\\1</a> ',
 
     // CVE/CAN entries
     '/((CAN|CVE)-[0-9]+-[0-9]+)/'
-    => '<a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=\\1">\\1</a>',
+    => '<a href="url.php?url=http://cve.mitre.org/cgi-bin/cvename.cgi?name=\\1">\\1</a>',
 
     // PMASAentries
     '/(PMASA-[0-9]+-[0-9]+)/'
-    => '<a href="https://www.phpmyadmin.net/security/\\1/">\\1</a>',
+    => '<a href="url.php?url=https://www.phpmyadmin.net/security/\\1/">\\1</a>',
 
     // Highlight releases (with links)
     '/([0-9]+)\.([0-9]+)\.([0-9]+)\.0 (\([0-9-]+\))/'
     => '<a name="\\1_\\2_\\3"></a>'
-        . '<a href="' . $github_url . 'commits/RELEASE_\\1_\\2_\\3">'
+        . '<a href="url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3">'
         . '\\1.\\2.\\3.0 \\4</a>',
     '/([0-9]+)\.([0-9]+)\.([0-9]+)\.([1-9][0-9]*) (\([0-9-]+\))/'
     => '<a name="\\1_\\2_\\3_\\4"></a>'
-        . '<a href="' . $github_url . 'commits/RELEASE_\\1_\\2_\\3_\\4">'
+        . '<a href="url.php?url=' . $github_url . 'commits/RELEASE_\\1_\\2_\\3_\\4">'
         . '\\1.\\2.\\3.\\4 \\5</a>',
 
     // Highlight releases (not linkable)

programming_language: PHP
filename: core.lib.php
change_type: ModificationType.MODIFY
diff: @@ -769,6 +769,8 @@ function PMA_isAllowedDomain($url)
         'mariadb.org',
         /* php.net domains */
         'php.net',
+        /* sourceforge.net domain */
+        'sourceforge.net',
         /* Github domains*/
         'github.com','www.github.com',
         /* Following are doubtful ones. */

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-05-23 13:02:21+02:00
msg: Improve handling of logout

- add separate script for handling logout
- no longer require old_usr for all authentication methods
  (this avoids potential information leak)
- require valid token for logout

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: ChangeLog
change_type: ModificationType.MODIFY
diff: @@ -12,6 +12,7 @@ phpMyAdmin - ChangeLog
 - issue #11705 Fix occassional 200 errors on Windows
 - issue #12219 Fix locking issues when importing SQL
 - issue #12231 Avoid confusing warning when mysql extension is missing
+- issue        Improve handling of logout
 
 4.6.1 (2016-05-02)
 - issue #12120 PMA_Util not found in insert_edit.lib.php

programming_language: SQL
filename: NavigationHeader.php
change_type: ModificationType.MODIFY
diff: @@ -167,8 +167,7 @@ private function _links()
         if ($GLOBALS['server'] != 0) {
             // Logout for advanced authentication
             if ($GLOBALS['cfg']['Server']['auth_type'] != 'config') {
-                $link = 'index.php' . $GLOBALS['url_query'];
-                $link .= '&amp;old_usr=' . urlencode($GLOBALS['PHP_AUTH_USER']);
+                $link = 'logout.php' . $GLOBALS['url_query'];
                 $retval .= PMA\libraries\Util::getNavigationLink(
                     $link,
                     $showText,

programming_language: PHP
filename: AuthenticationPlugin.php
change_type: ModificationType.MODIFY
diff: @@ -52,6 +52,46 @@ public function storeUserCredentials()
      */
     abstract public function authFails();
 
+    /**
+     * Perform logout
+     *
+     * @return void
+     */
+    public function logOut()
+    {
+        global $PHP_AUTH_USER, $PHP_AUTH_PW;
+
+        /* Obtain redirect URL (before doing logout) */
+        if (! empty($GLOBALS['cfg']['Server']['LogoutURL'])) {
+            $redirect_url = $GLOBALS['cfg']['Server']['LogoutURL'];
+        } else {
+            $redirect_url = $this->getLoginFormURL();
+        }
+
+        /* Clear credentials */
+        $PHP_AUTH_USER = '';
+        $PHP_AUTH_PW = '';
+
+        /* delete user's choices that were stored in session */
+        $_SESSION = array();
+        if (!defined('TESTSUITE')) {
+            session_destroy();
+        }
+
+        /* Redirect to login form (or configured URL) */
+        PMA_sendHeaderLocation($redirect_url);
+    }
+
+    /**
+     * Returns URL for login form.
+     *
+     * @return string
+     */
+    public function getLoginFormURL()
+    {
+        return './index.php';
+    }
+
     /**
      * Returns error message for failed authentication.
      *

programming_language: PHP
filename: AuthenticationCookie.php
change_type: ModificationType.MODIFY
diff: @@ -67,18 +67,6 @@ public function auth()
             }
         }
 
-        /* Perform logout to custom URL */
-        if (! empty($_REQUEST['old_usr'])
-            && ! empty($GLOBALS['cfg']['Server']['LogoutURL'])
-        ) {
-            PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
-            if (defined('TESTSUITE')) {
-                return true;
-            } else {
-                exit;
-            }
-        }
-
         // No recall if blowfish secret is not configured as it would produce
         // garbage
         if ($GLOBALS['cfg']['LoginCookieRecall']
@@ -295,34 +283,6 @@ public function authCheck()
         }
         // END Swekey Integration
 
-        if (! empty($_REQUEST['old_usr'])) {
-            // The user wants to be logged out
-            // -> delete his choices that were stored in session
-
-            // according to the PHP manual we should do this before the destroy:
-            //$_SESSION = array();
-
-            if (! defined('TESTSUITE')) {
-                session_destroy();
-            }
-            // -> delete password cookie(s)
-            if ($GLOBALS['cfg']['LoginCookieDeleteAll']) {
-                foreach ($GLOBALS['cfg']['Servers'] as $key => $val) {
-                    $GLOBALS['PMA_Config']->removeCookie('pmaPass-' . $key);
-                    if (isset($_COOKIE['pmaPass-' . $key])) {
-                        unset($_COOKIE['pmaPass-' . $key]);
-                    }
-                }
-            } else {
-                $GLOBALS['PMA_Config']->removeCookie(
-                    'pmaPass-' . $GLOBALS['server']
-                );
-                if (isset($_COOKIE['pmaPass-' . $GLOBALS['server']])) {
-                    unset($_COOKIE['pmaPass-' . $GLOBALS['server']]);
-                }
-            }
-        }
-
         if (! empty($_REQUEST['pma_username'])) {
 
             // Verify Captcha if it is required.
@@ -831,4 +791,30 @@ public function handlePasswordChange($password)
     {
         $this->storePasswordCookie($password);
     }
+
+    /**
+     * Perform logout
+     *
+     * @return void
+     */
+    public function logOut()
+    {
+        // -> delete password cookie(s)
+        if ($GLOBALS['cfg']['LoginCookieDeleteAll']) {
+            foreach ($GLOBALS['cfg']['Servers'] as $key => $val) {
+                $GLOBALS['PMA_Config']->removeCookie('pmaPass-' . $key);
+                if (isset($_COOKIE['pmaPass-' . $key])) {
+                    unset($_COOKIE['pmaPass-' . $key]);
+                }
+            }
+        } else {
+            $GLOBALS['PMA_Config']->removeCookie(
+                'pmaPass-' . $GLOBALS['server']
+            );
+            if (isset($_COOKIE['pmaPass-' . $GLOBALS['server']])) {
+                unset($_COOKIE['pmaPass-' . $GLOBALS['server']]);
+            }
+        }
+        parent::logOut();
+    }
 }

programming_language: PHP
filename: AuthenticationHttp.php
change_type: ModificationType.MODIFY
diff: @@ -49,18 +49,6 @@ public function auth()
      */
     public function authForm()
     {
-        /* Perform logout to custom URL */
-        if (!empty($_REQUEST['old_usr'])
-            && !empty($GLOBALS['cfg']['Server']['LogoutURL'])
-        ) {
-            PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
-            if (!defined('TESTSUITE')) {
-                exit;
-            } else {
-                return false;
-            }
-        }
-
         if (empty($GLOBALS['cfg']['Server']['auth_http_realm'])) {
             if (empty($GLOBALS['cfg']['Server']['verbose'])) {
                 $server_message = $GLOBALS['cfg']['Server']['host'];
@@ -262,4 +250,14 @@ public function authFails()
 
         return true;
     }
+
+    /**
+     * Returns URL for login form.
+     *
+     * @return string
+     */
+    public function getLoginFormURL()
+    {
+        return './index.php?old_usr=' . $GLOBALS['PHP_AUTH_USER'];
+    }
 }

programming_language: PHP
filename: AuthenticationSignon.php
change_type: ModificationType.MODIFY
diff: @@ -28,11 +28,6 @@ public function auth()
         unset($_SESSION['LAST_SIGNON_URL']);
         if (empty($GLOBALS['cfg']['Server']['SignonURL'])) {
             PMA_fatalError('You must set SignonURL!');
-        } elseif (!empty($_REQUEST['old_usr'])
-            && !empty($GLOBALS['cfg']['Server']['LogoutURL'])
-        ) {
-            /* Perform logout to custom URL */
-            PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
         } else {
             PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['SignonURL']);
         }
@@ -82,9 +77,6 @@ public function authCheck()
         /* No configuration updates */
         $single_signon_cfgupdate = array();
 
-        /* Are we requested to do logout? */
-        $do_logout = !empty($_REQUEST['old_usr']);
-
         /* Handle script based auth */
         if (!empty($script_name)) {
             if (!file_exists($script_name)) {
@@ -117,18 +109,10 @@ public function authCheck()
 
             /* Grab credentials if they exist */
             if (isset($_SESSION['PMA_single_signon_user'])) {
-                if ($do_logout) {
-                    $PHP_AUTH_USER = '';
-                } else {
-                    $PHP_AUTH_USER = $_SESSION['PMA_single_signon_user'];
-                }
+                $PHP_AUTH_USER = $_SESSION['PMA_single_signon_user'];
             }
             if (isset($_SESSION['PMA_single_signon_password'])) {
-                if ($do_logout) {
-                    $PHP_AUTH_PW = '';
-                } else {
-                    $PHP_AUTH_PW = $_SESSION['PMA_single_signon_password'];
-                }
+                $PHP_AUTH_PW = $_SESSION['PMA_single_signon_password'];
             }
             if (isset($_SESSION['PMA_single_signon_host'])) {
                 $single_signon_host = $_SESSION['PMA_single_signon_host'];

programming_language: PHP
filename: logout.php
change_type: ModificationType.ADD
diff: @@ -0,0 +1,15 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Logout script
+ *
+ * @package PhpMyAdmin
+ */
+require_once 'libraries/common.inc.php';
+
+if ($token_mismatch) {
+    PMA_sendHeaderLocation('./index.php');
+} else {
+    $auth_plugin->logOut();
+}
+

programming_language: PHP
filename: AuthenticationCookieTest.php
change_type: ModificationType.MODIFY
diff: @@ -373,6 +373,9 @@ public function testAuthCaptcha()
      */
     public function testAuthHeader()
     {
+        $GLOBALS['cfg']['LoginCookieDeleteAll'] = false;
+        $GLOBALS['cfg']['Servers'] = array(1);
+
         $restoreInstance = PMA\libraries\Response::getInstance();
 
         $mockResponse = $this->getMockBuilder('PMA\libraries\Response')
@@ -380,11 +383,6 @@ public function testAuthHeader()
             ->setMethods(array('isAjax', 'headersSent', 'header'))
             ->getMock();
 
-        $mockResponse->expects($this->once())
-            ->method('isAjax')
-            ->with()
-            ->will($this->returnValue(false));
-
         $mockResponse->expects($this->any())
             ->method('headersSent')
             ->with()
@@ -398,12 +396,9 @@ public function testAuthHeader()
         $attrInstance->setAccessible(true);
         $attrInstance->setValue($mockResponse);
 
-        $_REQUEST['old_usr'] = 'user1';
         $GLOBALS['cfg']['Server']['LogoutURL'] = 'http://www.phpmyadmin.net/logout';
 
-        $this->assertTrue(
-            $this->object->auth()
-        );
+        $this->object->logOut();
 
         $attrInstance->setValue($restoreInstance);
     }
@@ -454,20 +449,40 @@ public function testAuthCheckCaptcha()
      */
     public function testLogoutDelete()
     {
+        $restoreInstance = PMA\libraries\Response::getInstance();
+
+        $mockResponse = $this->getMockBuilder('PMA\libraries\Response')
+            ->disableOriginalConstructor()
+            ->setMethods(array('isAjax', 'headersSent', 'header'))
+            ->getMock();
+
+        $mockResponse->expects($this->any())
+            ->method('headersSent')
+            ->with()
+            ->will($this->returnValue(false));
+
+        $mockResponse->expects($this->once())
+            ->method('header')
+            ->with('Location: ./index.php' . ((SID) ? '?' . SID : ''));
+
+        $attrInstance = new ReflectionProperty('PMA\libraries\Response', '_instance');
+        $attrInstance->setAccessible(true);
+        $attrInstance->setValue($mockResponse);
+
         $GLOBALS['cfg']['Server']['auth_swekey_config'] = '';
         $GLOBALS['cfg']['CaptchaLoginPrivateKey'] = '';
         $GLOBALS['cfg']['CaptchaLoginPublicKey'] = '';
-        $_REQUEST['old_usr'] = 'pmaolduser';
         $GLOBALS['cfg']['LoginCookieDeleteAll'] = true;
         $GLOBALS['cfg']['Servers'] = array(1);
 
         $_COOKIE['pmaPass-0'] = 'test';
 
-        $this->object->authCheck();
+        $this->object->logOut();
 
         $this->assertFalse(
             isset($_COOKIE['pmaPass-0'])
         );
+        $attrInstance->setValue($restoreInstance);
     }
 
     /**
@@ -477,21 +492,40 @@ public function testLogoutDelete()
      */
     public function testLogout()
     {
+        $restoreInstance = PMA\libraries\Response::getInstance();
+
+        $mockResponse = $this->getMockBuilder('PMA\libraries\Response')
+            ->disableOriginalConstructor()
+            ->setMethods(array('isAjax', 'headersSent', 'header'))
+            ->getMock();
+
+        $mockResponse->expects($this->any())
+            ->method('headersSent')
+            ->with()
+            ->will($this->returnValue(false));
+
+        $mockResponse->expects($this->once())
+            ->method('header')
+            ->with('Location: ./index.php' . ((SID) ? '?' . SID : ''));
+
+        $attrInstance = new ReflectionProperty('PMA\libraries\Response', '_instance');
+        $attrInstance->setAccessible(true);
+        $attrInstance->setValue($mockResponse);
         $GLOBALS['cfg']['Server']['auth_swekey_config'] = '';
         $GLOBALS['cfg']['CaptchaLoginPrivateKey'] = '';
         $GLOBALS['cfg']['CaptchaLoginPublicKey'] = '';
-        $_REQUEST['old_usr'] = 'pmaolduser';
         $GLOBALS['cfg']['LoginCookieDeleteAll'] = false;
         $GLOBALS['cfg']['Servers'] = array(1);
         $GLOBALS['server'] = 1;
 
         $_COOKIE['pmaPass-1'] = 'test';
 
-        $this->object->authCheck();
+        $this->object->logOut();
 
         $this->assertFalse(
             isset($_COOKIE['pmaPass-1'])
         );
+        $attrInstance->setValue($restoreInstance);
     }
 
     /**

programming_language: PHP
filename: AuthenticationHttpTest.php
change_type: ModificationType.MODIFY
diff: @@ -123,9 +123,13 @@ public function doMockResponse($set_minimal, $body_id, $set_title)
         call_user_func_array(array($header_method, 'withConsecutive'), $headers);
 
         try {
-            $this->assertFalse(
-                $this->object->auth()
-            );
+            if (!empty($_REQUEST['old_usr'])) {
+                $this->object->logOut();
+            } else {
+                $this->assertFalse(
+                    $this->object->auth()
+                );
+            }
         } finally {
             $attrInstance->setValue($restoreInstance);
         }

programming_language: PHP
filename: AuthenticationSignonTest.php
change_type: ModificationType.MODIFY
diff: @@ -73,10 +73,9 @@ public function testAuth()
         // case 2
 
         $GLOBALS['cfg']['Server']['SignonURL'] = 'http://phpmyadmin.net/SignonURL';
-        $_REQUEST['old_usr'] = 'oldUser';
         $GLOBALS['cfg']['Server']['LogoutURL'] = 'http://phpmyadmin.net/logoutURL';
 
-        $this->object->auth();
+        $this->object->logOut();
 
         $this->assertContains(
             'Location: http://phpmyadmin.net/logoutURL?PHPSESSID=',
@@ -87,10 +86,9 @@ public function testAuth()
 
         $GLOBALS['header'] = array();
         $GLOBALS['cfg']['Server']['SignonURL'] = 'http://phpmyadmin.net/SignonURL';
-        $_REQUEST['old_usr'] = '';
         $GLOBALS['cfg']['Server']['LogoutURL'] = '';
 
-        $this->object->auth();
+        $this->object->logOut();
 
         $this->assertContains(
             'Location: http://phpmyadmin.net/SignonURL?PHPSESSID=',
@@ -155,6 +153,26 @@ public function testAuthCheckSession()
      */
     public function testAuthCheckToken()
     {
+        $restoreInstance = PMA\libraries\Response::getInstance();
+
+        $mockResponse = $this->getMockBuilder('PMA\libraries\Response')
+            ->disableOriginalConstructor()
+            ->setMethods(array('isAjax', 'headersSent', 'header'))
+            ->getMock();
+
+        $mockResponse->expects($this->any())
+            ->method('headersSent')
+            ->with()
+            ->will($this->returnValue(false));
+
+        $mockResponse->expects($this->once())
+            ->method('header')
+            ->with('Location: ./index.php' . ((SID) ? '?' . SID : ''));
+
+        $attrInstance = new ReflectionProperty('PMA\libraries\Response', '_instance');
+        $attrInstance->setAccessible(true);
+        $attrInstance->setValue($mockResponse);
+
         $GLOBALS['cfg']['Server']['SignonURL'] = 'http://phpmyadmin.net/SignonURL';
         $GLOBALS['cfg']['Server']['SignonSession'] = 'session123';
         $GLOBALS['cfg']['Server']['host'] = 'localhost';
@@ -162,7 +180,6 @@ public function testAuthCheckToken()
         $GLOBALS['cfg']['Server']['user'] = 'user';
         $GLOBALS['cfg']['Server']['SignonScript'] = '';
         $_COOKIE['session123'] = true;
-        $_REQUEST['old_usr'] = 'oldUser';
         $_SESSION['PMA_single_signon_user'] = 'user123';
         $_SESSION['PMA_single_signon_password'] = 'pass123';
         $_SESSION['PMA_single_signon_host'] = 'local';
@@ -172,28 +189,20 @@ public function testAuthCheckToken()
         $sessionName = session_name();
         $sessionID = session_id();
 
-        $this->assertFalse(
-            $this->object->authCheck()
-        );
+        $this->object->logOut();
 
         $this->assertEquals(
             array(
                 'SignonURL' => 'http://phpmyadmin.net/SignonURL',
                 'SignonScript' => '',
                 'SignonSession' => 'session123',
-                'host' => 'local',
-                'port' => '12',
+                'host' => 'localhost',
+                'port' => '80',
                 'user' => 'user',
-                'foo' => 'bar'
             ),
             $GLOBALS['cfg']['Server']
         );
 
-        $this->assertEquals(
-            'pmaToken',
-            $_SESSION[' PMA_token ']
-        );
-
         $this->assertEquals(
             $sessionName,
             session_name()
@@ -207,6 +216,7 @@ public function testAuthCheckToken()
         $this->assertFalse(
             isset($_SESSION['LAST_SIGNON_URL'])
         );
+        $attrInstance->setValue($restoreInstance);
     }
 
     /**

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-04-29 15:36:54+02:00
msg: Pass link to demo server through url.php

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: index.php
change_type: ModificationType.MODIFY
diff: @@ -152,7 +152,7 @@
                 . 'please do not change root, debian-sys-maint and pma users. '
                 . 'More information is available at %s.'
             ),
-            '<a href="http://demo.phpmyadmin.net/">demo.phpmyadmin.net</a>'
+            '<a href="url.php?url=http://demo.phpmyadmin.net/">demo.phpmyadmin.net</a>'
         );
         echo '</p>';
         echo '</div>';

programming_language: PHP
filename: core.lib.php
change_type: ModificationType.MODIFY
diff: @@ -762,6 +762,7 @@ function PMA_isAllowedDomain($url)
         $_SERVER['SERVER_NAME'],
         /* phpMyAdmin domains */
         'wiki.phpmyadmin.net', 'www.phpmyadmin.net', 'phpmyadmin.net',
+        'demo.phpmyadmin.net',
         'docs.phpmyadmin.net',
         /* mysql.com domains */
         'dev.mysql.com','bugs.mysql.com',

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-05-23 09:40:17+02:00
msg: Ensure links from setup go through url.php

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: core.lib.php
change_type: ModificationType.MODIFY
diff: @@ -724,7 +724,7 @@ function PMA_arrayRemove($path, &$array)
  */
 function PMA_linkURL($url)
 {
-    if (!preg_match('#^https?://#', $url) || defined('PMA_SETUP')) {
+    if (!preg_match('#^https?://#', $url)) {
         return $url;
     }
 
@@ -739,7 +739,12 @@ function PMA_linkURL($url)
     $arr = parse_url($url);
     parse_str($arr["query"], $vars);
     $query = http_build_query(array("url" => $vars["url"]));
-    $url = './url.php?' . $query;
+
+    if (defined('PMA_SETUP')) {
+        $url = '../url.php?' . $query;
+    } else {
+        $url = './url.php?' . $query;
+    }
 
     return $url;
 }

programming_language: PHP
filename: index.inc.php
change_type: ModificationType.MODIFY
diff: @@ -307,8 +307,8 @@
 
 echo '</fieldset>';
 echo '<div id="footer">';
-echo '<a href="https://www.phpmyadmin.net/">' , __('phpMyAdmin homepage') , '</a>';
-echo '<a href="https://www.phpmyadmin.net/donate/">'
+echo '<a href="../url.php?url=https://www.phpmyadmin.net/">' , __('phpMyAdmin homepage') , '</a>';
+echo '<a href="../url.php?url=https://www.phpmyadmin.net/donate/">'
     ,  __('Donate') , '</a>';
 echo '<a href="' ,  PMA_URL_getCommon() , $separator , 'version_check=1">'
     , __('Check for latest version') , '</a>';

programming_language: PHP