Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 83792 - dev-db/phpmyadmin-2.6.1-pl2 incorrectly grants wildcard privileges on databases with underscore in their name
Summary: dev-db/phpmyadmin-2.6.1-pl2 incorrectly grants wildcard privileges on databas...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo Security
URL: http://bugs.gentoo.org/show_bug.cgi?i...
Whiteboard: B3 [glsa]
Keywords:
: 85556 (view as bug list)
Depends on:
Blocks: 83190
  Show dependency tree
 
Reported: 2005-03-02 02:53 UTC by Jakub Moc (RETIRED)
Modified: 2005-06-26 06:13 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
failed patch (2.6.1_p2-no-wildcard-privs-for-you.patch-32018.out,3.67 KB, text/plain)
2005-03-02 08:24 UTC, Jakub Moc (RETIRED)
no flags Details
working patch (phpmyadmin.diff,3.87 KB, patch)
2005-03-02 08:30 UTC, Jakub Moc (RETIRED)
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Moc (RETIRED) gentoo-dev 2005-03-02 02:53:38 UTC
When you grant privileges to databases with underscore character in their name via  phpMyAdmin, you end up with user having wildcard privileges like in Bug 83163. 

Reproducible: Always
Steps to Reproduce:
1. Create test_db
2. Create user test
3. Click on "Privileges" - Select user test
4. On next screen select test_db in "Add privileges on the following database" drop-down menu
5. On "Edit Privileges" screen check all fields except GRANT and click on "Go"

Actual Results:  
You have updated the privileges for 'test'@'localhost'.
SQL-query: 
GRANT ALL PRIVILEGES ON `test_db` . * TO 'test'@'localhost';

Now the user has wildcard privileges and can create databases as described in
Bug 83163 when he logs into MySQL.

Expected Results:  
GRANT ALL PRIVILEGES ON `test\_db` . * TO 'test'@'localhost';

This is inconsistent and insecure behaviour because phpMyAdmin grants wildcard
privileges while it is expected not to do so. You therefore cannot grant
privileges to databases with underscored names via phpMyAdmin GUI. The only
viable option it to use SQL statement on mysql database instead. This defeats
one of the main purposes of using GUI for MySQL administration. 

phpMyAdmin should escape underscore character in database name when granting
rights on database level but this behaviour was probably broken when fixing the
bug 6b mentioned at
http://sourceforge.net/tracker/index.php?func=detail&aid=1056706&group_id=23067&atid=377408
(which was dealing with error when granting permissions on table level)
Comment 1 Thierry Carrez (RETIRED) gentoo-dev 2005-03-02 03:15:44 UTC
Apparently fixed in upstream :
http://cvs.sourceforge.net/viewcvs.py/phpmyadmin/phpMyAdmin/server_privileges.php?r1=2.40&r2=2.42

Reporter: please try to apply patch and check it fixes the problem.
twp: we might need a new bump before releasing GLSA :)
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2005-03-02 03:29:59 UTC
Affirmative, captain. ;-) 

GRANT ALL PRIVILEGES ON `test\_db` . * TO 'test'@'localhost';

Now I can finally have some sleep. Thank you very much!
Comment 3 Tom Payne (RETIRED) gentoo-dev 2005-03-02 04:52:49 UTC
Martin (mholzer)  --

Could you bump this please? I won't have time to look at this until Monday evening at the earliest. Could you take maintainership of phpmyadmin?

Cheers,

Tom
Comment 4 Aaron Walker (RETIRED) gentoo-dev 2005-03-02 06:48:40 UTC
2.6.1_p2-r1 is in cvs, stable x86.  CC'd archs please stable.
Comment 5 Jakub Moc (RETIRED) gentoo-dev 2005-03-02 08:24:48 UTC
Created attachment 52466 [details]
failed patch

This patch does not work - see attachment

 * Applying 2.6.1_p2-no-wildcard-privs-for-you.patch ...

 * Failed Patch: 2.6.1_p2-no-wildcard-privs-for-you.patch!
 *
 * Include in your bugreport the contents of:
 *
 *  
/var/tmp/portage/phpmyadmin-2.6.1_p2-r1/temp/2.6.1_p2-no-wildcard-privs-for-you.patch-32018.out
Comment 6 Jakub Moc (RETIRED) gentoo-dev 2005-03-02 08:30:04 UTC
Created attachment 52467 [details, diff]
working patch

Note the redundant path phpmyadmin/phpMyAdmin/ was stripped. ;-)
Comment 7 Jakub Moc (RETIRED) gentoo-dev 2005-03-02 08:32:31 UTC
Also note that the post-install instructions are now wrong again (version changed)

1. Update MySQL's grant tables and the pmadb database:
     mysql -u root -p < /usr/share/webapps/phpmyadmin/2.6.1_p2/sqlscripts/mysql/2.6.1_p2_create.sql
Comment 8 Thierry Carrez (RETIRED) gentoo-dev 2005-03-02 09:27:57 UTC
Aaron: patch fails, see above
Comment 9 Aaron Walker (RETIRED) gentoo-dev 2005-03-02 09:58:10 UTC
Actually it has nothing to do with the patch.  As I originally thought it's due to the $Id: $ change in the source file.  cvs see's this and automatically updates the timestamp, thus causing the patch to fail.

I've had to patch the sources then change the $Id back then re-diff ;)

Fixed.  I've also updated the ebuild to automatically update the postinst-en.txt file that gets installed so that PVR is set correctly.
Comment 10 Aaron Walker (RETIRED) gentoo-dev 2005-03-02 09:59:06 UTC
err s/patch/paths/
Comment 11 Jakub Moc (RETIRED) gentoo-dev 2005-03-02 10:56:15 UTC
OK, it works now. :-)
Comment 12 Thierry Carrez (RETIRED) gentoo-dev 2005-03-02 11:52:50 UTC
Arches, please mark latest stable
Comment 13 Michael Hanselmann (hansmi) (RETIRED) gentoo-dev 2005-03-02 13:44:34 UTC
Stable on ppc.
Comment 14 Jan Brinkmann (RETIRED) gentoo-dev 2005-03-02 14:05:56 UTC
stable on amd64
Comment 15 Jason Wever (RETIRED) gentoo-dev 2005-03-02 18:09:36 UTC
Stable on SPARC.
Comment 16 Bryan Østergaard (RETIRED) gentoo-dev 2005-03-03 07:05:24 UTC
Stable on alpha.
Comment 17 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2005-03-03 14:27:01 UTC
GLSA 200503-07
Comment 18 Alexander M. Turek 2005-03-05 17:35:15 UTC
This bug should also be fixed in phpMyAdmin-2.6.1-pl3.
Comment 19 Luke Macken (RETIRED) gentoo-dev 2005-03-16 12:53:58 UTC
*** Bug 85556 has been marked as a duplicate of this bug. ***
Comment 20 René Nussbaumer (RETIRED) gentoo-dev 2005-06-26 06:13:51 UTC
ebuild no longer in portage.