Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 115907 - dev-db/phpmyadmin Possible SQL injection
Summary: dev-db/phpmyadmin Possible SQL injection
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo Security
URL: http://www.securityfocus.com/archive/...
Whiteboard: DerCorny
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-17 23:08 UTC by Sune Kloppenborg Jeppesen (RETIRED)
Modified: 2005-12-19 23:30 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2005-12-17 23:08:38 UTC
phpMyAdmin server_privileges.php SQL Injection Vulnerabilities.
 
 I. BACKGROUND
 phpMyAdmin is a tool written in PHP intended to handle the administration of MySQL over the Web.
 
 II. DESCRIPTION
 phpMyAdmin server_privileges.php is prone to SQL Injection vulnerability. A remote attacker may execute arbitrary SQL command by sending specially-crafted URI to server_privileges.php db_name or checkprivs parameter.
 
 III. PUBLISH DATE
 2005-12-7
 
 IV. AUTHOR
 lwang (at) lwang (dot) org [email concealed]
 
 V. AFFECTED SOFTWARE
 phpMyAdmin 2.7.0 is confirmed to affected. Older versions may also be affected.
 The following vendors distribute vulnerable phpMyAdmin package:
 The FreeBSD Project 
 Gentoo Foundation 
 Novell, Inc. (SuSE) 
 The Debian Project (SuSE)
 
 VI. ANALYSIS
 in server_privileges.php
 line 27:
 if ( isset( $dbname ) ) {
 //if ( preg_match( '/\\\\(?:_|%)/i', $dbname ) ) {
 if ( preg_match( '/(?<!\\\\)(?:_|%)/i', $dbname ) ) {
 $dbname_is_wildcard = true;
 } else {
 $dbname_is_wildcard = false;
 }
 }
 parameter $dbname is not validate properly.
 
 line 1197:
 if (isset($viewing_mode) && $viewing_mode == 'db') {
 $db = $checkprivs;
 $url_query .= '&goto=db_operations.php';
 
 // Gets the database structure
 $sub_part = '_structure';
 require('./db_details_db_info.php');
 echo "\n";
 } else {
 require('./server_links.inc.php');
 }
 
 line 1241: 
 if ( empty( $adduser ) && empty( $checkprivs ) ) {
 
 parameter $checkprivs not validate properly.
 
 VII. Proof of Concept
 http://victim/phpmyadmin/server_privileges.php?server=1&checkprivs='
 http://victim/phpmyadmin/server_privileges.php?server=1&hostname='&usern
 ame=1&dbname=1&tablename=1
 
 VIII. SOLUTION
 I have not contact the vendor, and no aware of any security patch till now.
Comment 1 Stefan Cornelius (RETIRED) gentoo-dev 2005-12-17 23:22:40 UTC
web-apps, please verify and provide fixed ebuilds if we are affected. thx
Comment 2 Thierry Carrez (RETIRED) gentoo-dev 2005-12-18 01:36:42 UTC
I'd wait for upstream confirmation. If it allows an authenticated phpmyadmin user to inject SQL, there is 95% of chances that this user can already do it by using the software...
Comment 3 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2005-12-19 22:28:22 UTC
Supposedly posted by one of the phpmyadmin team members, nothing on the site to verify that.

http://www.securityfocus.com/archive/1/419832/30/0/threaded

phpMyAdmin's team answer to vulnerability announcement
 of Dec 17, 2005
 [ http://www.securityfocus.com/archive/1/419709/30/0/threaded ]
 
 We don't think that this is a real threat. The server_privileges.php 
 script checks at the beginning if the user is privileged. So, for this 
 attack to work, the victim's phpMyAdmin installation would have to be 
 set as to allow any user to auto-login as a privileged user! If this is 
 the case, this phpMyAdmin installation is wide open and this situation 
 has to be fixed by the person who configured phpMyAdmin.
 
 Marc Delisle, for the team
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-12-19 23:22:31 UTC
I meant to post here yesterday, but as part of upstream, I confirm Marc's response - We've discussed the issue.
Comment 5 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2005-12-19 23:30:00 UTC
Thx Robin