MySQL2: Auth Plugin Downgrade to mysql_clear_password Leaks Plaintext Credentials
What to do
Vendor fix available. Upgrade each affected package to the fixed version on its release line (mysql2 3.22.0), redeploy, then verify what is actually installed.
This page has no inventory attached, so it cannot say whether you are affected. A vendor fix is not proof that your deployment is fixed.
Affected packages
npm mysql2
- Affected
- < 3.22.0
- Fixed in
- 3.22.0
Sources
- GitHub Advisory Database and maintainer security advisories on GitHub
GitHub-reviewed advisory GHSA-3f6p-5ww8-9rcr lists affected ranges: npm mysql2 >=0 <3.22.0
VerifiedObserved Structured GitHub Advisory Database record (type=reviewed) from the GitHub REST API.
Severity and exploitation
- Exploitation
- No confirmed exploitation recorded. Patch Next marks exploitation only from CISA KEV.
- CVSS 4.0
- 8.2 · CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N · score source
- EPSS
- No dated EPSS signal available.
Source description
As published by the source; long descriptions are shortened.
Summary A rogue MySQL server (or MITM) can force mysql2 to send credentials in plaintext by requesting an auth switch to mysqlclearpassword. The driver complies without verifying that TLS is active. Details mysqlclearpassword is registered as a default standard plugin in lib/commands/authswitch.js (line 21). When a server sends an AuthSwitchRequest (0xFE) requesting mysqlclearpassword, the driver executes it without checking for TLS. The plugin (lib/authplugins/mysqlclearpassword.js) returns Buffer.from(password + '\0'). Note: cachingsha2password plugin DOES check for SSL before sending cleartext (line 77). But mysqlclearpassword has no such guard. Attack Scenario 1. Attacker operates rogue MySQL server or performs MITM 2. Server advertises cachingsha2password in handshake 3. Client sends hashed auth response 4. Server replies with AuthSwitchRequest to mysqlclearpassword 5. Client sends password in plaintext 6. Attacker captures plaintext password PoC Rogue MySQL server (Node.js, ~80…
Dates and revisions
- Published by the source
- Last modified by the source
- Source last checked
- Revision 1 · created ·
Published from ghsa record GHSA-3f6p-5ww8-9rcr
Agent brief
Preview the exact text before you copy it. Commands are read-only suggestions; review them before running anything.
# Patch Next advisory brief: GHSA-3f6p-5ww8-9rcr Advisory: MySQL2: Auth Plugin Downgrade to mysql_clear_password Leaks Plaintext Credentials IDs: GHSA-3f6p-5ww8-9rcr Record: https://patchnext.com/advisories/ghsa-3f6p-5ww8-9rcr (revision 1, source checked 26 Oct 2026, 13:01 UTC) Inventory: none attached. This brief comes from a public page and does not say whether any deployment is affected. Severity: High (CVSS 8.2) Exploitation: no confirmed exploitation recorded. Patch Next confirms exploitation only from CISA KEV. Vendor response: Vendor fix available; fixed versions by package: mysql2 3.22.0. A vendor fix does not mean a deployment is fixed. ## Affected components - npm mysql2: affected < 3.22.0; fixed in 3.22.0 ## Suggested inspection (read-only) - `npm ls mysql2 --all`: lists every installed copy and version, including transitive ones. Run in the project root after `npm ci`. ## Supported action Upgrade each affected component to a fixed version on its release line. For a transitive dependency, upgrade the parent package or add an override or constraint, then regenerate the lockfile. Redeploy every environment that ran an affected version. ## Required regression checks - Run the test suite and a production build. - Exercise the features that depend on mysql2. - Repeat the inspection and confirm that only fixed versions remain installed. ## Rollback considerations - Keep the previous lockfile and deployment artifact. Rolling back reinstates the vulnerable version, so apply any documented mitigation while you fix forward. ## Unresolved questions - Which deployments run an affected version? - Exploitation status can change. Check again before lowering the priority. - Mark the work resolved only after the fixed version is verified in production. ## Sources - Verified: https://github.com/advisories/GHSA-3f6p-5ww8-9rcr (GitHub-reviewed advisory GHSA-3f6p-5ww8-9rcr lists affected ranges: npm mysql2 >=0 <3.22.0) Commands are suggestions: review each one before running it.
Loading voting…