Summary
ProxySQL incorrectly parses HAProxy PROXY protocol v1 UNKNOWN headers and treats user-supplied address fields as trusted client IP information.
An attacker who can connect to the MySQL frontend port can forge arbitrary source IPs, bypassing routing logic and IP-based access controls that rely on client_addr.
Affected context
The vulnerability occurs in ProxySQL deployments that:
- Enable the MySQL frontend and accept HAProxy PROXY protocol v1 frames
- Use the default
mysql-proxy_protocol_networks = '*', or otherwise permit untrusted peers to send PROXY headers - Rely on
client_addrinmysql_query_rulesfor routing, access control, or query filtering
In such contexts, ProxySQL treats address fields in PROXY UNKNOWN frames as if they were trustworthy client IPs, even though the PROXY protocol specification states they must be ignored.
Exploit preconditions
- Attack surface: ProxySQL MySQL frontend port that accepts PROXY protocol v1 frames
- Required access: Network-level ability to open a TCP connection to the frontend (no prior authentication needed)
- Trigger point: Sending a crafted PROXY protocol v1 line using the
PROXY UNKNOWN <addr> <addr> <port> <port>\r\nformat before the MySQL handshake - Why exploitation is possible: ProxySQL parses and stores the address fields from
UNKNOWNframes viasscanf, contrary to the specification, and propagates the spoofed IP intoclient_addrfor routing and ACL decisions.
Why this happens
The core issue is that ProxySQL violates the semantics of the HAProxy PROXY protocol v1 when handling PROXY UNKNOWN headers.
Instead of discarding any following address fields as mandated by the spec, the implementation parses them with sscanf and populates the session's addr.addr field from attacker-controlled data.
This behavior maps to CWE-348: Use of Insufficiently Secure Credentials, where a component accepts untrusted identity claims (in this case, a claimed client IP) without appropriate validation, and to aspects of CWE-863: Incorrect Authorization because authorization and routing decisions are made on forged identity attributes.
Abstractly, the bug is an insecure trust boundary: metadata intended to be non-authoritative is treated as a primary authentication and policy input.
Potential impact
- Bypass of IP-based access control lists (ACLs) that rely on
client_addr - Unauthorized routing of queries to internal-only backends or primary nodes
- Circumvention of query-filter rules that are restricted to specific CIDRs (for example, DDL-only-from-admin networks)
- Misrouting of multi-tenant or per-application traffic, leading to data exposure across logical boundaries
- Escalation of privileges within the database environment by impersonating trusted application or admin networks
General mitigation guidance
Effective mitigation focuses on tightening trust boundaries around PROXY protocol input and removing IP-based identity assumptions:
- Treat PROXY protocol headers from untrusted networks as untrusted metadata and disable them where not strictly required.
- Restrict
mysql-proxy_protocol_networksto explicit, tightly controlled proxy IP ranges instead of permissive wildcards. - Avoid using
client_addras the sole authentication or authorization factor; combine it with stronger credentials or connection attributes. - Prefer application-level authentication and role-based authorization over network-origin-based routing for sensitive operations.
- Design routing and ACL policies so that misclassification of client IP cannot alone grant high-privilege access (defense in depth).
How teams detect issues like this
Organizations can detect and monitor this pattern through a combination of configuration and behavioral analysis:
- Static/config review: Flag deployments where
mysql-proxy_protocol_networksis'*'or includes broad network ranges, especially whenmysql_query_rulesrely heavily onclient_addr. - Code and design review: Examine places where connection metadata (e.g., claimed client IP) is treated as authoritative identity for ACLs or routing, validating that the upstream source is trusted.
- Runtime monitoring: Analyze logs for unusual or impossible client IP patterns (e.g., public users appearing to originate from internal-only CIDRs or admin subnets).
- Automated policy checks: Use configuration linting or security-as-code tools to enforce policies that disallow PROXY protocol trust from unverified peers and highlight IP-based authorization rules.

