Summary
MariaDB Connector/J: Rogue server can drive large heap allocations from server-declared lengths in OK packets
Advisory details
Summary
MariaDB Connector/J sized heap allocations from lengths declared by the server in OK packets before checking that those lengths fit in the packet. A rogue or MitM server can make the client allocate megabytes from a packet of a few bytes.
Details
When CLIENT_SESSION_TRACK is negotiated (the default), an OK packet carries an
info field followed by session-state blocks, each tracked variable being sent as a
length-encoded name and value. OkPacket.parse() and parseWithInfo() allocated
new byte[len] for the info field, the variable name and the value with the
server-declared len, then copied the packet data into it. The copy failed with an
ArrayIndexOutOfBoundsException when the packet was shorter, but only after the
allocation had taken place.
A server-declared length of 8 MiB in an 18-byte packet was enough to trigger an 8 MiB allocation; the integer-range validation of length-encoded values does not help, since such lengths are valid positive integers.
The fix validates every server-declared length against the remaining packet bytes
before any allocation (ReadableByteBuf.checkLength() and a bounded
readBytes(int)), and stops reading the session state at the first inconsistent
entry.
Impact
Availability only: a malicious or compromised server, or a MitM, can drive
attacker-controlled heap allocations on every OK packet, creating GC pressure up to
OutOfMemoryError in the client application. Exploitation requires control of the
server side of the connection; no authentication bypass, confidentiality or
integrity impact.
Credit
Reported by fg0x0
References
- https://github.com/advisories/GHSA-h599-m3w5-9m7x
- https://github.com/mariadb-corporation/mariadb-connector-j/security/advisories/GHSA-h599-m3w5-9m7x
- https://nvd.nist.gov/vuln/detail/CVE-2026-119276
- https://github.com/mariadb-corporation/mariadb-connector-j/commit/b9e1ee8d9b4d820d70719504cdfd5c97f1aede5f
- https://github.com/mariadb-corporation/mariadb-connector-j/commit/beb445fcf9294113878fc05ac77f0efdf0596ac6
- https://github.com/mariadb-corporation/mariadb-connector-j/commit/ea8c7b6537e50053444188a9a3fd9cae99550f56
- https://github.com/mariadb-corporation/mariadb-connector-j/releases/tag/3.3.7
- https://github.com/mariadb-corporation/mariadb-connector-j/releases/tag/3.4.5
Related vulnerabilities
All Supply chain →- MEDIUMCVE-2026-63476
isomorphic-git allows unbounded memory allocation from attacker-controlled delta target size (DoS)
- HIGHCVE-2026-103025
bep/imagemeta: Unbounded memory allocation decoding PNG `zTXt` "Raw profile type iptc" chunks
- HIGHCVE-2026-110789
libp2p: ASN.1 DER decoder drives an unbounded synchronous loop on attacker-controlled length fields, stalling the Node event loop pre-auth
- HIGHCVE-2026-62297
ag-psd can exhaust memory when parsing crafted PSD dimensions
- MEDIUMCVE-2026-119279
MariaDB Connector/J: Length-encoded integers larger than Integer.MAX_VALUE were truncated before being used as lengths
- HIGHCVE-2026-115907
zip: legacy Shrink/Reduce/Implode decoder: denial of service from attacker-controlled ZIP64 uncompressed size