Home    |    View Topics    |    Search    |    Contact Us    |   



Category:   Application (Forum/Board/Portal)  >   phpMyAdmin Vendors:   phpMyAdmin Development Team
phpMyAdmin 'grab_globals.php' Lets Remote Users Include and Execute Local Files
SecurityTracker Alert ID:  1015091
SecurityTracker URL:
CVE Reference:   CVE-2005-3300   (Links to External Site)
Updated:  Nov 2 2008
Original Entry Date:  Oct 24 2005
Impact:   Execution of arbitrary code via network, User access via network
Fix Available:  Yes  Vendor Confirmed:  Yes  
Version(s): 2.6.4-pl2 and prior versions
Description:   A vulnerability was reported in phpMyAdmin. A remote user can execute files that are located on the target system.

A remote user can submit a specially crafted URL to load certain files directly that do not include an important protection mechanism (namely 'grab_globals.php'). As a result, some global variables may be overwritten with user-supplied variable contents. As a result, a local PHP file can be included and executed on the target system.

The vendor was notified on October 15, 2005.

Stefan Esser of the Hardened-PHP Project reported this vulnerability.

The original advisory is available at:

Impact:   A remote user can cause arbitrary files on the target system to be executed with the privileges of the web service.
Solution:   The vendor has issued a fixed version (2.6.4-pl3), available at:

Vendor URL: (Links to External Site)
Cause:   Access control error, Input validation error, State error
Underlying OS:  Linux (Any), UNIX (Any), Windows (Any)

Message History:   None.

 Source Message Contents

Subject:  [Full-disclosure] Advisory 16/2005: phpMyAdmin Local File Inclusion

Hash: SHA1

                        Hardened-PHP Project

                      -= Security  Advisory =-

     Advisory: phpMyAdmin Local File Inclusion Vulnerability
 Release Date: 2005/10/22
Last Modified: 2005/10/22
       Author: Stefan Esser []

  Application: phpMyAdmin <= 2.6.4-pl2
     Severity: A design flaw within phpMyAdmin allows inclusion
               of arbitrary files, which usually leads to remote
    	       code execution
         Risk: Critical
Vendor Status: Vendor has released an updated version


   Quote from
   "phpMyAdmin is a tool written in PHP intended to handle the 
   administration of MySQL over the Web. Currently it can create 
   and drop databases, create/drop/alter tables, delete/edit/add 
   fields, execute any SQL statement, manage keys on fields, manage 
   privileges,export data into various formats and is available 
   in 50 languages."
   And audit of phpMyAdmin revealed a design flaw in the way 
   phpMyAdmin includes it's register_globals compatibility layer,
   that allows inclusion of arbitrary local files, which usually
   leads to remote code execution.
   *** NOTE: This vulnerability is not exploitable if you are 
             running PHP with our Hardening-Patch applied


   phpMyAdmin comes with a register_globals emulation layer within
   grab_globals.php, to ensure compatibility with hosts where this 
   feature is turned off. This file is usually included at the very
   beginning, so that globalizing the request variables does not
   overwrite already used script variables. When the _GET and _POST
   variables are extracted it is even ensured, that certain names
   cannot be overwritten. This safety checks are not in effect, when 
   the _FILES array, which holds information about uploaded files, 
   is merged into the global namespace. 
   Unfortunately phpMyAdmin comes with a few files that were not meant
   to be called directly and that do not include grab_globals.php but 
   common.lib.php in the beginning. This results f.e. in the following
   include tree:
      - db_details_db_info.php
      \___ libraries/common.lib.php
           \___ libraries/select_lang.lib.php
	   \   \___ libraries/grab_globals.php
	   \   \___ lang/
	   \___ ...       
   From this one can see, that grab_globals.php will be included by
   select_lang.lib.php, if it is not included in the very beginning.
   This has the bad side effect, that the globalisation of the request
   variables is executed *after* common.lib.php has loaded the $cfg
   configuration array. In combination with the fact, that the _FILES
   array is not protected against keys with the name 'cfg', it is
   possible to overwrite the content of the configuration array in
   a way, that empties the content of the $cfg['ThemePath'] variable.
   This variable contains the path to a directory, that contains the
   supported themes. With the same overwrite it is possible to fill
   the variable $cfg['ThemeManager'] with a value, which evaluates to
   The idea behind this overwrite is to exploit an include statement
   which tries to verify the existance of a theme, selected through
   f.e. a supplied cookie variable:
   Due to the fact, that $cgf['ThemePath'] is empty and the global
   variable theme is filled with the content of a user supplied 
   cookie, it is possible to use either a %00 or a realpath() 
   truncation attack on the include filename to include any file,
   that can be accessed by the webserver.
   At this point a few things have to be noted:
      1) When reading the theme name from the cookie directory the 
         value is sanitizied against directory traversal attacks
	 by removing .. from the filename. However the attack
	 described here results in an absolute filepath beeing
	 included, therefore any protection against directory
	 traversal attacks is worthless.
      2) A %00 filename truncation attack will only work if
         magic_quotes_gpc is turned off, which is however the
	 recommended setting. A realpath() truncation attack on
	 the other hand will only work agains malfunctional
	 realpath() implementation, which can be found in f.e.
	 older OpenBSD versions.
      3) This vulnerability *cannot* be exploited, when your server
         uses our PHP Hardening-Patch, because it has a build in
	 protection against such include-filename truncation

Proof of Concept:

   The Hardened-PHP project is not going to release exploits for 
   this vulnerability to the public.

Disclosure Timeline:

   15. October 2005 - Contacted phpMyAdmin developers by email
   21. October 2005 - Vendor notifies me about planned release
   22. October 2005 - Release of new phpMyAdmin version
   22. October 2005 - Public Disclosure


   It is strongly recommended to upgrade to the new version of
   phpMyAdmin which you can download at:


   pub  1024D/0A864AA1 2004-04-17 Hardened-PHP Signature Key
   Key fingerprint = 066F A6D0 E57E 9936 9082  7E52 4439 14CC 0A86 4AA1

Copyright 2005 Stefan Esser. All rights reserved.

Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see


Full-Disclosure - We believe in it.
Hosted and sponsored by Secunia -


Go to the Top of This SecurityTracker Archive Page

Home   |    View Topics   |    Search   |    Contact Us

This web site uses cookies for web analytics. Learn More

Copyright 2021, LLC