CVE-2012-2122
MediumPublic exploitmysql: incorrect type cast in check_scramble() leading to authentication bypass
Published Jun 9, 2012 · Updated Mar 9, 2026
Key Facts
Patch immediately- CVE-2012-2122 is a medium-severity vulnerability (CVSS 5.1 v2) affecting Mariadb, Mysql (Oracle), mysql-5.1 (debian) and 9 more products.
- It is not listed in any known-exploited vulnerabilities catalog. Public exploit code is available.
- EPSS estimates a 96% probability of exploitation in the next 30 days.
- Fixed versions are available, including Mysql 0:5.1.66-1.el6_3, mysql-5.1 5.1.63-0+squeeze1, mysql55 5.5.24-1.24.amzn1.
- Brandefense priority: patch immediately, because it is very likely to be exploited soon.
CVSS v2
5.1
AV:N/AC:H/Au:N/C:P/I:P/A:P
EPSS (30-day exploit likelihood)
97%
Higher than 99.8% of all scored CVEs
Exploited in the wild
No known
Not in a known-exploited catalog
Public exploit code
Available
Proof-of-concept or weaponized module
Get the full CVE-2012-2122 brief as a PDF
Every affected product and fixed release, exploitation status and a first 24 hours response checklist, emailed within minutes.
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.
Affected Products
72 affected entries in total| Product | Affected versions | Fixed in |
|---|---|---|
| MariadbMariadb | 5.1.41, 5.1.42, 5.1.44, 5.1.47, 5.1.49, 5.1.50, 5.1.51, 5.1.53 | n/a |
| MysqlOracle | 5.1.51, 5.1.52, 5.1.52-sp1, 5.1.53, 5.1.54, 5.1.55, 5.1.56, 5.1.57 | 0:5.1.66-1.el6_3 |
| mysql-5.1debian | See advisory | 5.1.63-0+squeeze1 |
| mysql55-benchamazon | See advisory | 5.5.24-1.24.amzn1 |
| mysql55-commonamazon | See advisory | 5.5.24-1.24.amzn1 |
Patched Releases
Mysql
0:5.1.66-1.el6_3
mysql-5.1
5.1.63-0+squeeze1
mysql55
5.5.24-1.24.amzn1
mysql55-bench
5.5.24-1.24.amzn1
mysql55-common
5.5.24-1.24.amzn1
mysql55-devel
5.5.24-1.24.amzn1
mysql55-embedded
5.5.24-1.24.amzn1
mysql55-embedded-devel
5.5.24-1.24.amzn1
mysql55-libs
5.5.24-1.24.amzn1
mysql55-server
5.5.24-1.24.amzn1
mysql55-test
5.5.24-1.24.amzn1
Timeline
Publicly disclosed
Jun 9, 2012
Last updated
Mar 9, 2026
Weakness Type
- CWE-287 Improper Authentication
- CWE-305 Authentication Bypass by Primary Weakness
- CWE-393 Return of Wrong Status Code
- CWE-704 Incorrect Type Conversion or Cast
- CWE-843 Access of Resource Using Incompatible Type ('Type Confusion')
References
- advisoryRHSA-2012:1462
- advisory49417
- patch[oss-security] 20120609 Security vulnerability in MySQL/MariaDB sql/password.c
- exploithttp://bugs.mysql.com/bug.php?id=64884
- exploithttps://community.rapid7.com/community/metasploit/blog/2012/06/11/cve-2012-2122-a-tragically-comedic-security-flaw-in-mysql
FAQ
Common Questions.
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…
Affected: Mariadb versions 5.1.41, 5.1.42, 5.1.44, 5.1.47, 5.1.49, 5.1.50, 5.1.51, 5.1.53; Mysql (Oracle) versions 5.1.51, 5.1.52, 5.1.52-sp1, 5.1.53, 5.1.54, 5.1.55, 5.1.56, 5.1.57; mysql-5.1 (debian), among others. The full list is in the CVE brief.
It is not listed in any known-exploited vulnerabilities catalog.
No, it is not currently listed in the CISA Known Exploited Vulnerabilities catalog.
Public exploit code is available.
Fixed versions are available, including Mysql 0:5.1.66-1.el6_3, mysql-5.1 5.1.63-0+squeeze1, mysql55 5.5.24-1.24.amzn1.
Brandefense priority: patch immediately, because it is very likely to be exploited soon.
Is CVE-2012-2122 Running On Your Attack Surface?
Brandefense maps vulnerabilities like this one to your internet-facing assets and tells you exactly where to patch.
Request A Demo