Security vulnerability in MySQL/MariaDB sql/password.c

06/12/2012 19:41 .Rebel#1
Something very important for all

that article is not mine i am just sharing information


"Hi

We have recently found a serious security bug in MariaDB and MySQL.
So, here, we'd like to let you know about what the issue and its impact
is. At the end you can find a patch, in case you need to patch an older
unsuported MySQL version.

All MariaDB and MySQL versions up to 5.1.61, 5.2.11, 5.3.5, 5.5.22 are
vulnerable.
MariaDB versions from 5.1.62, 5.2.12, 5.3.6, 5.5.23 are not.
MySQL versions from 5.1.63, 5.5.24, 5.6.6 are not.

This issue got assigned an id CVE-2012-2122.

Here's the issue. When a user connects to MariaDB/MySQL, a token (SHA
over a password and a random scramble string) is calculated and compared
with the expected value. Because of incorrect casting, it might've
happened that the token and the expected value were considered equal,
even if the memcmp() returned a non-zero value. In this case
MySQL/MariaDB would think that the password is correct, even while it is
not. Because the protocol uses random strings, the probability of
hitting this bug is about 1/256.

Which means, if one knows a user name to connect (and "root" almost
always exists), she can connect using *any* password by repeating
connection attempts. ~300 attempts takes only a fraction of second, so
basically account password protection is as good as nonexistent.
Any client will do, there's no need for a special libmysqlclient library.

But practically it's better than it looks - many MySQL/MariaDB builds
are not affected by this bug.

Whether a particular build of MySQL or MariaDB is vulnerable, depends on
how and where it was built. A prerequisite is a memcmp() that can return
an arbitrary integer (outside of -128..127 range). To my knowledge gcc
builtin memcmp is safe, BSD libc memcmp is safe. Linux glibc
sse-optimized memcmp is not safe, but gcc usually uses the inlined
builtin version.

As far as I know, official vendor MySQL and MariaDB binaries are not
vulnerable.

Regards,
Sergei Golubchik
MariaDB Security Coordinator

References:

MariaDB bug report: [Only registered and activated users can see links. Click Here To Register...]
MariaDB fix: [Only registered and activated users can see links. Click Here To Register...]

MySQL bug report: [Only registered and activated users can see links. Click Here To Register...]
MySQL fix: [Only registered and activated users can see links. Click Here To Register...]
MySQL changelog:
[Only registered and activated users can see links. Click Here To Register...]
http://dev.mysql.com/doc/refman/5.5/en/news-5-5-24.html"

how to see if my server is vulnerable?

ther the vulnerable tester


PHP Code:
/*
 *
 * CVE-2012-2122 checker
 *
 * You may get differing results with/without -m32
 *
 * Joshua J. Drake
 */

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(void) {
        
int onetworet;
        
time_t start time(0);
        
time_t now;

        
srand(getpid()*start);
        while (
1) {
                
one rand();
                
two rand();
                
ret memcmp(&one, &twosizeof(int));
                if (
ret < -128 || ret 127)
                        break;
                
time(&now);
                if (
now start 10) {
                        
printf("Not triggered in 10 seconds, *probably* not vulnerable..\n");
                        return 
1;
                }
        }
        
printf("Vulnerable! memcmp returned: %d\n"ret);
        return 
0;

06/12/2012 19:51 MissUnderstoodOne#2
Everyone who knows how to fix it already got it...
And it's the wrong section
06/13/2012 05:16 .Rebel#3
how you know already if this bug was detected only in (Jun 09 2012)

let me guess you already know after i say so

and is not on the wrong section because metin is all in mysql

but again you guys dont diserve nothing at all
have fun this section is becoming very noob
06/13/2012 07:56 gio011#4
Quote:
Originally Posted by .Rebel View Post
Something very important for all

that article is not mine i am just sharing information


"Hi

We have recently found a serious security bug in MariaDB and MySQL.
So, here, we'd like to let you know about what the issue and its impact
is. At the end you can find a patch, in case you need to patch an older
unsuported MySQL version.

All MariaDB and MySQL versions up to 5.1.61, 5.2.11, 5.3.5, 5.5.22 are
vulnerable.
MariaDB versions from 5.1.62, 5.2.12, 5.3.6, 5.5.23 are not.
MySQL versions from 5.1.63, 5.5.24, 5.6.6 are not.

This issue got assigned an id CVE-2012-2122.

Here's the issue. When a user connects to MariaDB/MySQL, a token (SHA
over a password and a random scramble string) is calculated and compared
with the expected value. Because of incorrect casting, it might've
happened that the token and the expected value were considered equal,
even if the memcmp() returned a non-zero value. In this case
MySQL/MariaDB would think that the password is correct, even while it is
not. Because the protocol uses random strings, the probability of
hitting this bug is about 1/256.

Which means, if one knows a user name to connect (and "root" almost
always exists), she can connect using *any* password by repeating
connection attempts. ~300 attempts takes only a fraction of second, so
basically account password protection is as good as nonexistent.
Any client will do, there's no need for a special libmysqlclient library.

But practically it's better than it looks - many MySQL/MariaDB builds
are not affected by this bug.

Whether a particular build of MySQL or MariaDB is vulnerable, depends on
how and where it was built. A prerequisite is a memcmp() that can return
an arbitrary integer (outside of -128..127 range). To my knowledge gcc
builtin memcmp is safe, BSD libc memcmp is safe. Linux glibc
sse-optimized memcmp is not safe, but gcc usually uses the inlined
builtin version.

As far as I know, official vendor MySQL and MariaDB binaries are not
vulnerable.

Regards,
Sergei Golubchik
MariaDB Security Coordinator

References:

MariaDB bug report: [Only registered and activated users can see links. Click Here To Register...]
MariaDB fix: [Only registered and activated users can see links. Click Here To Register...]

MySQL bug report: [Only registered and activated users can see links. Click Here To Register...]
MySQL fix: [Only registered and activated users can see links. Click Here To Register...]
MySQL changelog:
[Only registered and activated users can see links. Click Here To Register...]
http://dev.mysql.com/doc/refman/5.5/en/news-5-5-24.html"

how to see if my server is vulnerable?

ther the vulnerable tester


PHP Code:
/*
 *
 * CVE-2012-2122 checker
 *
 * You may get differing results with/without -m32
 *
 * Joshua J. Drake
 */

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(void) {
        
int onetworet;
        
time_t start time(0);
        
time_t now;

        
srand(getpid()*start);
        while (
1) {
                
one rand();
                
two rand();
                
ret memcmp(&one, &twosizeof(int));
                if (
ret < -128 || ret 127)
                        break;
                
time(&now);
                if (
now start 10) {
                        
printf("Not triggered in 10 seconds, *probably* not vulnerable..\n");
                        return 
1;
                }
        }
        
printf("Vulnerable! memcmp returned: %d\n"ret);
        return 
0;

in don't know how to fix if you say tell me ;)
06/13/2012 15:36 Teh Daroo#5
Quote:
Originally Posted by gio011 View Post
in don't know how to fix if you say tell me ;)
And I don't know who teached you english. A worm or something comparable?

Auf Deutsch, das ist ein C++ Quellcode, wie ich dem Header entnehmen konnte. Ihr müsst ihn also kompilieren. (Edit: Platform: x86 Unix)

Update: Tutorial hier zu finden: [Only registered and activated users can see links. Click Here To Register...]
06/13/2012 16:05 Mi4uric3#6
Quote:
Originally Posted by Teh Daroo View Post
And I don't know who teached you english.
Wer im Glashaus sitzt.. [...] :rolleyes:
"taught" nicht "teached" lol
06/13/2012 16:41 Teh Daroo#7
Quote:
Originally Posted by Mi4uric3 View Post
Wer im Glashaus sitzt.. [...] :rolleyes:
"taught" nicht "teached" lol
Tut nichts zur Sache, da du verstanden hast, was ich sagen wollte, was auf meine Vorposter leider nicht zutrifft. Ein Flüchtigkeitsfehler kann jedem mal passieren, was jedoch kein Grund ist, jemanden direkt wegen so etwas trivialem direkt an den Pranger zu stellen.
06/13/2012 16:56 5203307a#8
Freebsd is not vulnerable!
06/13/2012 19:19 Sphinx²#9
Nur so nebenbei:
-> mysql Ver 14.12 Distrib 5.0.92, for portbld-freebsd7.4 (i386) using 5.2 <-
Vulnerable?

So wie es oben steht ist es anscheinend nicht "Vulnerable".

Gruss
Sphinx
06/14/2012 09:32 Mi4uric3#10
Quote:
Originally Posted by Teh Daroo View Post
Tut nichts zur Sache, da du verstanden hast, was ich sagen wollte, was auf meine Vorposter leider nicht zutrifft. Ein Flüchtigkeitsfehler kann jedem mal passieren, was jedoch kein Grund ist, jemanden direkt wegen so etwas trivialem direkt an den Pranger zu stellen.
Höh? Du weißt schon, was die Bedeutung hinter dem Spruch mit dem Glashaus ist, oder?
Du sagst, dass er schlecht Englisch spricht und machst in dem Satz, in dem du ihn anprangerst selbst einen Fehler. Somit ist das von mir kein Anprangern sondern nur ein kleiner Hinweis, dass du vielleicht erstmal auf dich selbst achten solltest :b
06/15/2012 13:13 Brigatagraz#11
thanks x3