GHSA-g9jj-cgmh-9f38

Suggest an improvement
Source
https://github.com/advisories/GHSA-g9jj-cgmh-9f38
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/08/GHSA-g9jj-cgmh-9f38/GHSA-g9jj-cgmh-9f38.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-g9jj-cgmh-9f38
Aliases
Downstream
CGA (61)
MINI (15)
Published
2026-08-28T22:41:56Z
Modified
2026-08-28T22:55:59Z
Severity
  • 5.9 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N CVSS Calculator
Summary
MariaDB has cleartext password disclosure to a MITM on the initial-handshake
Details

Summary

When a Java application connects with sslMode=verify-full (or verify-ca) and a password but does not pin a server certificate, Connector/J deliberately accepts an untrusted/self-signed certificate at the TLS layer (the "MITM-proof without a CA" feature) and proves the server's identity afterwards by binding the certificate fingerprint into the authentication exchange. That fingerprint enforcement is applied to the OK-packet and auth-switch paths but not to the initial-handshake path. An active man-in-the-middle that presents a self-signed certificate, claims to be MariaDB, and names the initial authentication plugin mysql_clear_password receives the victim's database password in cleartext, before any fingerprint/identity check runs. The connection is torn down a moment later, but the credential is already gone.

Details

For sslMode=verify-full/verify-ca with a password and no serverSslCert/trustStore, the connector falls back to an ephemeral trust manager (default fallbackToSystemTrustStore=true) that accepts any non-expired certificate at the TLS layer and records its fingerprint. Identity is then meant to be enforced via that fingerprint.

The enforcement guard is present on two of the three paths, the OK-packet fingerprint check and the auth-switch handler (where the clear-password plugin is only allowed when the fingerprint is already verified). It is absent on the initial-handshake send: HandshakeResponse.encode() builds the mysql_clear_password response after checking only that SSL is enabled, never consulting the recorded fingerprint, sslMode, or whether the plugin is MITM-proof. By that point the connector already knows the certificate was self-signed. The clear-password plugin does not declare itself MITM-proof (it inherits the safe default), which confirms it is meant to be refused on an unverified certificate; the initial-handshake path simply never consults that flag. The initial path also bypasses restrictedAuth.

Impact

An active man-in-the-middle steals the full cleartext database password of any Java application using Connector/J with sslMode=verify-full/verify-ca plus a password and no pinned certificate, the configuration documented as the easy, secure default. With the captured credentials the attacker can take over the database account and read or modify all data that account is authorized for. The victim takes no unusual action; the developer explicitly enabled TLS verification expecting exactly this protection.

Patches

Fixed in 2.7.14, 3.3.5, 3.4.3, and 3.5.9. Upgrade to the patched release on your branch (3.5.x → 3.5.9, 3.4.x → 3.4.3, 3.0/3.1/3.2/3.3.x → 3.3.5, 2.x → 2.7.14). The fix applies the same certFingerprint != null && !isMitMProof() guard to the initial-handshake path before writing the auth response, refusing to send a mysql_clear_password (or any non-MITM-proof) response on an as-yet-unverified certificate, matching the auth-switch path.

Workarounds

If you cannot upgrade immediately, pin the server certificate (serverSslCert= the real CA / server cert). With a pinned certificate the self-signed certificate of a man-in-the-middle is rejected at the TLS layer before any password is transmitted.

Credit

Reported by haaahaaahiihiiii

Database specific
{
    "cwe_ids":  [
        "CWE-522"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2026-08-28T22:41:56Z",
    "nvd_published_at":  null,
    "severity":  "MODERATE"
}
References

Affected packages

Maven
org.mariadb.jdbc:mariadb-java-client

Package

Name
org.mariadb.jdbc:mariadb-java-client
View open source insights on deps.dev
Purl
pkg:maven/org.mariadb.jdbc/mariadb-java-client

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
2.7.14

Affected versions

1.*
1.1.7
1.1.8
1.1.9
1.1.10
1.2.0
1.2.1
1.2.2
1.2.3
1.3.0-beta-1
1.3.0-beta-2
1.3.0
1.3.1
1.3.2
1.3.3
1.3.4
1.3.5
1.3.6
1.3.7
1.4.0-beta-1
1.4.0
1.4.1
1.4.2
1.4.3
1.4.4
1.4.5
1.4.6
1.5.0-RC1
1.5.1-RC
1.5.2
1.5.3
1.5.4
1.5.5
1.5.6
1.5.7
1.5.8
1.5.9
1.6.0
1.6.1
1.6.2
1.6.3
1.6.4
1.6.5
1.7.0
1.7.1
1.7.2
1.7.3
1.7.4
1.7.5
1.7.6
1.8.0
2.*
2.0.0-RC
2.0.1
2.0.2
2.0.3
2.1.0
2.1.1
2.1.2
2.2.0
2.2.1
2.2.2
2.2.3
2.2.4
2.2.5
2.2.6
2.3.0
2.4.0
2.4.1
2.4.2
2.4.3
2.4.4
2.5.0
2.5.1
2.5.2
2.5.3
2.5.4
2.6.0
2.6.1
2.6.2
2.7.0
2.7.1
2.7.2
2.7.3
2.7.4
2.7.5
2.7.6
2.7.7
2.7.8
2.7.9
2.7.10
2.7.11
2.7.12
2.7.13

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/08/GHSA-g9jj-cgmh-9f38/GHSA-g9jj-cgmh-9f38.json"
org.mariadb.jdbc:mariadb-java-client

Package

Name
org.mariadb.jdbc:mariadb-java-client
View open source insights on deps.dev
Purl
pkg:maven/org.mariadb.jdbc/mariadb-java-client

Affected ranges

Type
ECOSYSTEM
Events
Introduced
3.0.0
Fixed
3.3.5

Affected versions

3.*
3.0.1-beta
3.0.2-rc
3.0.3
3.0.4
3.0.5
3.0.6
3.0.7
3.0.8
3.0.9
3.0.10
3.0.11
3.1.0
3.1.1
3.1.2
3.1.3
3.1.4
3.2.0
3.3.0
3.3.1
3.3.2
3.3.3
3.3.4

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/08/GHSA-g9jj-cgmh-9f38/GHSA-g9jj-cgmh-9f38.json"
org.mariadb.jdbc:mariadb-java-client

Package

Name
org.mariadb.jdbc:mariadb-java-client
View open source insights on deps.dev
Purl
pkg:maven/org.mariadb.jdbc/mariadb-java-client

Affected ranges

Type
ECOSYSTEM
Events
Introduced
3.4.0
Fixed
3.4.3

Affected versions

3.*
3.4.0
3.4.1
3.4.2

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/08/GHSA-g9jj-cgmh-9f38/GHSA-g9jj-cgmh-9f38.json"
org.mariadb.jdbc:mariadb-java-client

Package

Name
org.mariadb.jdbc:mariadb-java-client
View open source insights on deps.dev
Purl
pkg:maven/org.mariadb.jdbc/mariadb-java-client

Affected ranges

Type
ECOSYSTEM
Events
Introduced
3.5.0
Fixed
3.5.9

Affected versions

3.*
3.5.0
3.5.1
3.5.2
3.5.3
3.5.4
3.5.5
3.5.6
3.5.7
3.5.8

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/08/GHSA-g9jj-cgmh-9f38/GHSA-g9jj-cgmh-9f38.json"