CVE-2026-62154: mysql_fdw runs SQL supplied by a malicious MySQL server during IMPORT FOREIGN SCHEMA
During IMPORT FOREIGN SCHEMA, mysqlfdw copies column metadata returned by the remote MySQL server into the CREATE FOREIGN TABLE statements it runs locally without quoting it. The COLUMNDEFAULT value is placed directly in the DEFAULT clause, and the name of the generated ENUM type is inserted unquoted. A malicious or compromised MySQL server, or an attacker who can tamper with the connection, can return crafted informationschema metadata and run arbitrary SQL in the local PostgreSQL session of the user who runs IMPORT FOREIGN SCHEMA. The issue is fixed in mysqlfdw 2.10.0. From mysqlfdw 2.10.0, mysqlfdw quotes these values before building the statements.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 2.10.0
Event History
Frequently Asked Questions
Who is exposed to exploitation?
Users of mysql_fdw before version 2.10.0 are exposed when they run IMPORT FOREIGN SCHEMA against a malicious or compromised MySQL server. The issue can also be exploited by an attacker able to tamper with the MySQL connection.
What access does an attacker need?
The attacker needs control of, or the ability to manipulate responses from, the remote MySQL server so it returns crafted information_schema metadata. The injected SQL runs in the local PostgreSQL session of the user executing IMPORT FOREIGN SCHEMA.
Is routine foreign-table use affected, or only schema import?
The described injection path is specifically during IMPORT FOREIGN SCHEMA, when mysql_fdw generates and executes local CREATE FOREIGN TABLE statements from remote metadata. The provided information does not identify other operations as affected.
What should be done if upgrading cannot happen immediately?
Do not run IMPORT FOREIGN SCHEMA against MySQL servers that are untrusted, suspected of compromise, or reachable through a connection that could be tampered with. Restrict use of the operation to trusted servers and protected connections until mysql_fdw can be upgraded to 2.10.0 or later.