Description
sql/password.c in Oracle MySQL 5.1.x before 5.1.63, 5.5.x before 5.5.24, and 5.6.x before 5.6.6, and MariaDB 5.1.x before 5.1.62, 5.2.x before 5.2.12, 5.3.x before 5.3.6, and 5.5.x before 5.5.23, when running in certain environments with certain implementations of the memcmp function, allows remote attackers to bypass authentication by repeatedly authenticating with the same incorrect password, which eventually causes a token comparison to succeed due to an improperly-checked return value.
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 6.0 | mysql-5.1 | 5.1.63-0+squeeze1 | DSA-2496-1 |
Red Hat
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| RHEL 6 | mysql +7 | 5.1.66-1.el6_3 | RHSA-2012:1462 |
Public exploits
Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.
Metasploit 1 module
-
MySQL Authentication Bypass Password Dump
auxiliary/scanner/mysql/mysql_authbypass_hashdump
Exploit-DB 1
- MySQL - Authentication Bypass EDB-19092 · remote · Jun 12, 2012 · verified
GitHub 5 repositories
-
cyberharsh/Oracle-mysql-CVE-2012-2122 ★ 1 · Jun 24, 2020
-
Avinza/CVE-2012-2122-scanner ★ 1 · May 9, 2013
This is used to scan for CVE-2012-2122 vulnerable servers.
-
CyberCTF/vulhub-mysql-cve-2012-2122 ★ 0 · Oct 8, 2026
Vulhub mysql/CVE-2012-2122: MySQL Authentication Bypass (CVE-2012-2122), run with Isoloom
-
netw0rk7/CVE-2012-2122-Home-Lab ★ 0 · Nov 24, 2025
CVE-2012-2122 MySQL Authentication Bypass Home Lab
-
zhangkaibin0921/CVE-2012-2122 ★ 0 · Dec 1, 2023
Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.
Automated scanner template
A ready-made Nuclei template detects this vulnerability automatically. Vulnerabilities with public scanner templates are typically probed across the internet soon after the template appears — exposed systems should be patched first.
- MySQL - Authentication Bypass javascript/cves/2012/CVE-2012-2122.yaml
Source: projectdiscovery/nuclei-templates (MIT) — updated daily. Only links are listed.
Advisories 2
- RHSA-2012:1462 Red Hat Security Advisory: mysql security update Red Hat Security Advisories (RHSA) · Jun 28, 2026
- DSA-2496-1 mysql-5.1 - several Debian Security (DSA / DLA) · Mar 9, 2026
References
- http://bugs.mysql.com/bug.php?id=64884
- 53911 vdb-entry
- 19092 exploit
- 53372 third-party-advisory
- GLSA-201308-06 vendor-advisory
- SUSE-SU-2012:0984 vendor-advisory
- https://community.rapid7.com/community/metasploit/blog/2012/06/11/cve-2012-2122-a-tragically-comedic-security-flaw-in-mysql
- 1027143 vdb-entry
- 49417 third-party-advisory
- [oss-security] 20120609 Security vulnerability in MySQL/MariaDB sql/password.c mailing-list
- http://kb.askmonty.org/en/mariadb-5162-release-notes/