MySQL Authentiacation Bypass Vulnerability [CVE-2012-2122]

MySQL

A security issue and vulnerability have been reported in MySQL, which can be exploited by malicious people to bypass certain security restrictions.

It is possible to execute a one-liner bash command to exploit the vulnerability:

$ for i in `seq 1 1000`; do mysql -u root --password=bad -h 127.0.0.1 2>/dev/null; done

Recommended steps include the following:

a)  Secure MySQL so that it’s not exposed to the network at large in the first place. Most Linux distributions bind the MySQL daemon to localhost, preventing remote access to the service.

In cases where network access must be provided, MySQL also provides host-based access controls. For the few use cases where the MySQL daemon should be intentionally exposed to the wider network and without any form of host-based access control.

By modifying the my.cnf file – you can restrict access to the local system – Open my.cnf > find the section labeled [mysqld] > change (or add a new line to set) the “bind-address” parameter to “127.0.0.1”. Restart the MySQL service to apply this setting.

b)  The next step would be to upgrade to a stable, non-vulnerable update, as per vendor recommendation.

The following distros have been confirmed vulnerable:

  • Ubuntu Linux 64-bit ( 10.04, 10.10, 11.04, 11.10, 12.04 )
  • OpenSuSE 12.1 64-bit MySQL 5.5.23-log
  • Debian Unstable 64-bit 5.5.23-2
  • Fedora (confirmed by Red Hat )
  • Arch Linux