VYPR
Unrated severityNVD Advisory· Published Jun 19, 2026

ProxySQL pre-auth heap overflow in MySQL and PostgreSQL first-packet handling

CVE-2026-48773

Description

ProxySQL is a proxy for MySQL and its forks, as well as PostgreSQL. Versions 2.0.18 through 3.0.8 have a pre-authentication heap memory corruption vulnerability in the MySQL and PostgreSQL protocol first-read paths. A remote unauthenticated client can declare an oversized first packet length, and ProxySQL passes that attacker-controlled length directly to recv() while writing into a fixed 32 KB input queue. Version 3.0.9 patches the issue.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Affected products

1

Patches

Vulnerability mechanics

Root cause

"No bounds check on attacker-controlled packet length before it is passed to recv() as the write size into a fixed 32768-byte input queue."

Attack vector

A remote unauthenticated attacker sends a crafted first packet to a ProxySQL frontend listener (e.g., MySQL port 6033 or PostgreSQL port 6133) that declares an oversized packet length in the protocol header. ProxySQL passes that attacker-controlled length directly to `recv()` [ref_id=1], writing past the fixed 32768-byte input queue. The bug is reachable before any authentication or protocol validation occurs, making it a pre-authentication heap buffer overflow [CWE-122]. The advisory [ref_id=1] provides ASAN proof demonstrating heap-buffer-overflow with WRITE sizes of 65532 bytes (MySQL) and 99999 bytes (PostgreSQL).

Affected code

The vulnerable code resides in `MySQL_Data_Stream::read_from_net()` at `lib/mysql_data_stream.cpp:653-665` and in `PgSQL_Data_Stream::read_from_net()` at `lib/PgSQL_Data_Stream.cpp:517-534`. Both paths read a fixed-size input queue (`QUEUE_T_DEFAULT_SIZE` of 32768 bytes) but use an attacker-controlled packet length directly as the size argument to a second `recv()` call without bound checking. Advisory [ref_id=1] confirms these exact code locations and the 32 KB queue size.

What the fix does

Version 3.0.9 patches the issue by ensuring the protocol header length is validated before it is used as a `recv()` size [ref_id=1]. The advisory recommends three corrective actions: first-read only the protocol header, validate the declared packet length against `max_allowed_packet` limits, and never call `recv()` with a length exceeding the remaining capacity of the fixed queue. A prior partial fix (commit 9cc20a8) only added a PROXY-protocol prefix check but did not address the general unbounded `recv()` path for ordinary MySQL or PostgreSQL first packets.

Preconditions

  • networkTarget must have a MySQL or PostgreSQL frontend listener exposed (e.g., ports 6033 or 6133)
  • authNo authentication required; the overflow occurs before any protocol handshake completes
  • inputAttacker must be able to send a raw TCP packet with a crafted protocol header declaring an oversized payload length

Generated on Jun 20, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

2

News mentions

0

No linked articles in our index yet.