GHSA-42r5-vhpq-m858: Medium severity npm/mariadb vulnerability
Summary
When PAM (dialog) authentication is used, the connector can be coerced into sending the account password in cleartext over an insecure connection. A hostile or man-in-the-middle server can trigger this with the default configuration, disclosing the user's password.
Details
The mysqlclearpassword plugin is gated behind a secure connection: the driver refuses to transmit the password in cleartext over plain TCP. The sibling PAM plugin handler (SendPamAuthPacketFactory, server-side plugin name dialog) did not override that gate and inherited the default value false, so it was not subject to the same secure-transport requirement.
As a result, a hostile or man-in-the-middle server can issue an Authentication Switch Request for the dialog plugin over plain TCP, and the driver responds with the user's password in cleartext. With the default configuration (sslMode=DISABLE, restrictedAuth=null) this is reachable with no non-default options.
Am I affected?
You are affected if all of the following hold:
You use mariadb Connector/Node.js at a version below the patched release(s). Connections can occur over an insecure transport: plain TCP (sslMode=DISABLE), or a TLS mode that establishes server identity only via self-signed-certificate fingerprint validation. An attacker can occupy an on-path (MITM) position, or otherwise cause the client to connect to a server they control, and present an Authentication Switch Request for the dialog plugin.
Connections over properly verified TLS or a local Unix socket are not exposed to this vector.
Impact
Disclosure of the authenticating account's password in cleartext to an on-path or hostile server. The captured credentials can then be reused to authenticate to the database (and, if reused elsewhere, beyond it).
Patches
Fixed in 3.2.4, 3.3.3, 3.4.6, and 3.5.3. Upgrade to the patched release on your branch (3.5.x → 3.5.3, 3.4.x → 3.4.6, 3.3.x → 3.3.3, 3.2.x and earlier → 3.2.4). PAM (dialog) is now treated exactly like mysqlclearpassword: it may only run over a secure transport. SendPamAuthPacketFactory overrides the secure-required flag to true, and the authentication dispatcher permits a secure-required plugin only when the connection is TLS or a local Unix socket. The pre-existing check that blocks non-MITM-proof plugins when server identity relies solely on self-signed-certificate fingerprint validation continues to apply. Net effect: PAM is allowed over TLS or a Unix socket, and rejected over plain TCP or fingerprint-only connections.
Workarounds
If you cannot upgrade immediately:
Restrict the permitted authentication plugins via restrictedAuth so dialog cannot be negotiated over an insecure transport. Avoid PAM (dialog) authentication over plain TCP.
###Credit
Reported by Yalguun Tumenkhuu (@fg0x0).
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/mariadbto a version that resolves this vulnerability.Fixed in 3.5.3 - Upgrade
Upgrade
npm/mariadbto a version that resolves this vulnerability.Fixed in 3.4.6 - Upgrade
Upgrade
npm/mariadbto a version that resolves this vulnerability.Fixed in 3.3.3 - Upgrade
Upgrade
npm/mariadbto a version that resolves this vulnerability.Fixed in 3.2.4 - Upgrade
Upgrade
mariadb Connector/Node.jsto a version that resolves this vulnerability.Fixed in 3.2.4 - Upgrade
Upgrade
mariadb Connector/Node.jsto a version that resolves this vulnerability.Fixed in 3.3.3 - Upgrade
Upgrade
mariadb Connector/Node.jsto a version that resolves this vulnerability.Fixed in 3.4.6 - Upgrade
Upgrade
mariadb Connector/Node.jsto a version that resolves this vulnerability.Fixed in 3.5.3 - Configuration
Avoid PAM (dialog) authentication over plain TCP; do not use sslMode=DISABLE. Use a properly verified TLS connection or a local Unix socket instead.
mariadb Connector/Node.js sslMode = DISABLE - Configuration
Restrict the permitted authentication plugins via restrictedAuth so the dialog plugin cannot be negotiated over an insecure transport.
mariadb Connector/Node.js restrictedAuth = (set to restrict permitted authentication plugins)
Event History
Frequently Asked Questions
Which applications are exposed by default?
Applications using mariadb Connector/Node.js below the patched releases can be exposed when they use PAM dialog authentication and connect over plain TCP. The default configuration, sslMode=DISABLE with restrictedAuth=null, allows the condition without non-default options.
What does an attacker need to do to obtain a password?
A hostile server or a man-in-the-middle server must send an Authentication Switch Request for the dialog plugin while the connection is insecure. The connector can then return the account password in cleartext.
Does this affect the mysql_clear_password plugin in the same way?
No. The mysql_clear_password plugin is gated to require a secure connection before sending a cleartext password, while the PAM dialog handler did not enforce that gate.
How can I assess whether a deployment is affected?
Check whether the application uses a vulnerable Connector/Node.js release, PAM dialog authentication, and connections that can use insecure transport such as plain TCP with sslMode=DISABLE. A deployment meeting all of those conditions is affected.