PT-2026-85144 · Npm · Mysql2

Publicado

2026-09-01

·

Atualizado

2026-09-01

CVSS v4.0

8.2

Alta

VetorAV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N

Summary

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

Details

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').
Note: caching sha2 password plugin DOES check for SSL before sending cleartext (line 77). But mysql clear password has no such guard.

Attack Scenario

  1. Attacker operates rogue MySQL server or performs MITM
  2. Server advertises caching sha2 password in handshake
  3. Client sends hashed auth response
  4. Server replies with AuthSwitchRequest to mysql clear password
  5. Client sends password in plaintext
  6. Attacker captures plaintext password

PoC

Rogue MySQL server (Node.js, ~80 lines) that captures plaintext passwords from mysql2 clients. Tested against mysql2 3.20.0. Full PoC available on request.

Suggested Fix

Remove mysql clear password from standardAuthPlugins, or add a guard requiring TLS/unix socket before allowing cleartext auth.

Impact

  • mysql2: 9M weekly downloads
  • Any application connecting without TLS is vulnerable to credential theft
  • Cloud environments with untrusted network paths are especially at risk

Correção

Insufficiently Protected Credentials

Encontrou algum problema na descrição? Tem algo a acrescentar? Fique à vontade para nos escrever 👾

Enumeração de Fraquezas

Identificadores relacionados

GHSA-3F6P-5WW8-9RCR

Produtos afetados

Mysql2