Advisories · Databases
CVE-2012-2122
High
CVSS 7.5
Actively exploited
MySQL memcmp authentication bypass
Disclosed 2012 · Last reviewed 2 Dec 2026
On those builds, a wrong password could be accepted about one time in 256 because the comparison result was truncated.
What happened
The server cast a memcmp result to a char and treated some non-zero values as equal.
Affected and patched versions
- Affected
- Certain MySQL 5.1 and 5.5 builds from 2012, on platforms where memcmp could return a value outside 0, 1, and -1. Current MySQL and MariaDB are not those builds.
- Patched
- The 2012 vendor updates. A current supported server is the practical fix.
How to check your server
Check
mysql --version
How to fix and harden
- Run mysql --version.
- A 5.1 or 5.5 package from 2012 needs to be replaced, not tuned.
- Current MariaDB and MySQL are a different code line. Keep the server on 127.0.0.1 anyway.
Fix
mysql --version
Sources
Version ranges and fixes follow the vendor advisory. When a distribution backports a fix, trust its security tracker over the upstream version number. New advisories: RSS · JSON