Bug 528512 - MySQL memory DoS
MySQL memory DoS
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: mysql (Show other bugs)
5.4
x86_64 Linux
urgent Severity urgent
: rc
: ---
Assigned To: Tom Lane
qe-baseos-daemons
: Patch, ZStream
Depends On:
Blocks: 692953
  Show dependency treegraph
 
Reported: 2009-10-12 10:49 EDT by Kal McFate
Modified: 2013-01-10 21:35 EST (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-01-07 23:53:41 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Proposed patch (5.60 KB, patch)
2010-12-17 14:02 EST, Bryan Mason
no flags Details | Diff

  None (edit)
Description Kal McFate 2009-10-12 10:49:26 EDT
Description of problem: Memory Dos in mysql exploitable by anyone that can read two tables with sufficient rows.


Version-Release number of selected component (if applicable):
mysql-server-5.0.77-3

How reproducible:
Create database and two tables:

CREATE DATABASE bugtest;
USE bugtest; 

CREATE TABLE `A` (
  `id` int(11) NOT NULL default '0',
  `val` int(11) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `B` (
  `id` int(11) NOT NULL default '0',
  `val` int(11) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Populate:

for x in `seq 1 10000`; do mysql -e "insert into A values ($x,$x); insert into B values
($x,$x);" bugtest; done

Query:

SELECT *,count(*) count FROM A,B WHERE B.id IN( SELECT DISTINCT id FROM A WHERE A.id=B.id)
GROUP BY A.id ORDER BY count DESC;

 
Actual results:
Sit back and watch memory usage climb till death.


Expected results:
Memory usage should not uncontrollably climb.

Additional info:
Reported upstream as http://bugs.mysql.com/bug.php?id=47980 reported as not affecting 5.0.86
Comment 1 Kal McFate 2009-10-12 12:48:15 EDT
Found original mysql report: http://bugs.mysql.com/bug.php?id=42037
Comment 3 RHEL Product and Program Management 2010-08-09 15:04:01 EDT
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.
Comment 4 Kal McFate 2010-12-03 09:47:24 EST
Still broken in mysql-server-5.0.77-4.el5_5.4.x86_64
Comment 5 Bryan Mason 2010-12-07 19:45:45 EST
Upstream commit:

    http://lists.mysql.com/commits/64898

Actual uppstream patch appears to be here:

    http://bazaar.launchpad.net/~mysql/mysql-server/mysql-5.0/revision/2710.31.5
Comment 6 Bryan Mason 2010-12-17 14:02:26 EST
Created attachment 469431 [details]
Proposed patch

Adapted from upstream http://bazaar.launchpad.net/~mysql/mysql-server/mysql-5.0/revision/2710.31.5.
Comment 29 errata-xmlrpc 2013-01-07 23:53:41 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2013-0121.html

Note You need to log in before you can comment on or make changes to this bug.