{"answers":{"affected":"2 open source packages ship an affected version, including mysql2.","exploited":"There is no known exploitation of GHSA-3f6p-5ww8-9rcr in the wild and no public exploit code.","fix":"Upgrade mysql2 to 3.22.0 or later.","what":"GHSA-3f6p-5ww8-9rcr is a vulnerability in mysql2, published on 1 Sep 2026. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-3f6p-5ww8-9rcr and fix it if it is affected.\n\nWhat it is: GHSA-3f6p-5ww8-9rcr is a vulnerability in mysql2, published on 1 Sep 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-3f6p-5ww8-9rcr in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- mysql2 (npm): affected all versions; fixed in 3.22.0\n- mysql2 (npm): affected all versions; fixed in 3.22.0\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-3f6p-5ww8-9rcr/ (Markdown: https://insights.sbomify.com/GHSA-3f6p-5ww8-9rcr/index.md)","id":"GHSA-3f6p-5ww8-9rcr","markdown":"https://insights.sbomify.com/GHSA-3f6p-5ww8-9rcr/index.md","name":"GHSA-3f6p-5ww8-9rcr","record":{"aliases":[],"analysis":{"component_type":"library","fix_type":"patch","impacts":["data_read","account_takeover"],"network_reachable":"yes","non_default_config":false,"product_category":"MySQL Node.js driver","requires_auth":"none","summary":"A rogue MySQL server can force the mysql2 driver to send plaintext credentials by downgrading authentication, allowing attackers to steal passwords.","user_interaction":"not_required","vuln_class":"weak_cryptography"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"## Summary\n\nA rogue MySQL server (or MITM) can force mysql2 to send credentials in **plaintext** by requesting an auth switch to `mysql_clear_password`. The driver complies without verifying that TLS is active.\n\n## Details\n\n`mysql_clear_password` is registered as a default standard plugin in `lib/commands/auth_switch.js` (line 21). When a server sends an AuthSwitchRequest (0xFE) requesting `mysql_clear_password`, the driver executes it without checking for TLS. The plugin (`lib/auth_plugins/mysql_clear_password.js`) returns `Buffer.from(password + '\\0')`.\n\nNote: `caching_sha2_password` plugin DOES check for SSL before sending cleartext (line 77). But `mysql_clear_password` has no such guard.\n\n## Attack Scenario\n\n1. Attacker operates rogue MySQL server or performs MITM\n2. Server advertises `caching_sha2_password` in handshake\n3. Client sends hashed auth response\n4. Server replies with AuthSwitchRequest to `mysql_clear_password`\n5. Client sends password in plaintext\n6. Attacker captures plaintext password\n\n## PoC\n\nRogue MySQL server (Node.js, ~80 lines) that captures plaintext passwords from mysql2 clients. Tested against mysql2 3.20.0. Full PoC available on request.\n\n## Suggested Fix\n\nRemove `mysql_clear_password` from `standardAuthPlugins`, or add a guard requiring TLS/unix socket before allowing cleartext auth.\n\n## Impact\n\n- mysql2: 9M weekly downloads\n- Any application connecting without TLS is vulnerable to credential theft\n- Cloud environments with untrusted network paths are especially at risk","ecosystems":["npm"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"MySQL2: Auth Plugin Downgrade to mysql_clear_password Leaks Plaintext Credentials","id":"GHSA-3f6p-5ww8-9rcr","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"npm","product":null,"products":[],"type":"weak_cryptography","year":"2026"},"n_packages":2,"n_references":null,"packages":[{"ecosystem":"npm","fixed":["3.22.0"],"introduced":["0"],"last_affected":[],"package":"mysql2","purl":null,"source":"GHSA-3f6p-5ww8-9rcr"},{"ecosystem":"npm","fixed":["3.22.0"],"introduced":["0"],"last_affected":[],"package":"mysql2","purl":"pkg:npm/mysql2","source":"GHSA-3f6p-5ww8-9rcr"}],"products":null,"published":"2026-09-01","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"A rogue MySQL server can force the mysql2 driver to send plaintext credentials by downgrading authentication, allowing attackers to steal passwords.","url":"https://insights.sbomify.com/GHSA-3f6p-5ww8-9rcr/"}