CVE-2026-62152: mysql_fdw allows non-superusers to set connection options that run SQL and read server files
mysqlfdw accepts several security-sensitive connection options from roles that are not superusers. A role with USAGE on the mysqlfdw foreign data wrapper can set initcommand, which runs arbitrary SQL on the remote MySQL server at every connection, including connections made with other users' mappings on a shared foreign server. The same role can set mysqldefaultfile, sslkey, sslcert, sslca and sslcapath, which name files read from the PostgreSQL server host, allowing server-side file reads and connection redirection. The issue is fixed in mysqlfdw 2.10.0. From mysqlfdw 2.10.0, only superusers can set initcommand, mysqldefaultfile, sslkey, sslcert, sslca and sslcapath.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
mysql_fdwto a version that resolves this vulnerability.Fixed in 2.10.0
Event History
Frequently Asked Questions
Which PostgreSQL roles can exploit this issue?
Any non-superuser role with USAGE on the mysql_fdw foreign data wrapper can set the affected connection options. Exploitation does not require that role to be a PostgreSQL superuser.
What access or configuration is needed for impact beyond the attacker's own MySQL connection?
A role can use init_command on a shared foreign server, causing arbitrary SQL to run on the remote MySQL server whenever connections are made, including through other users' mappings. The file-related options can cause PostgreSQL server-host files to be read and can redirect connections.
Are affected options restricted in the fixed release?
Yes. In mysql_fdw 2.10.0, only superusers can set init_command, mysql_default_file, ssl_key, ssl_cert, ssl_ca, and ssl_capath.
How can administrators identify potentially exposed roles and configurations?
Review which non-superuser roles have USAGE on mysql_fdw, then inspect their foreign-server and user-mapping connection options for init_command, mysql_default_file, ssl_key, ssl_cert, ssl_ca, or ssl_capath. Shared foreign servers deserve particular attention because init_command can affect connections using other users' mappings.