Summary
During IMPORT FOREIGN SCHEMA, the mysql_fdw PostgreSQL extension copies column metadata returned by the remote MySQL server into locally executed CREATE FOREIGN TABLE statements without quoting. The COLUMN_DEFAULT value is placed directly into the DEFAULT clause, and the generated ENUM type name is inserted unquoted (CWE-89, SQL injection).
The attack is network-based, low complexity and requires no authentication, but depends on preconditions: the attacker must control or compromise the MySQL server or be able to tamper with the connection, and a user must actively run IMPORT FOREIGN SCHEMA. CVSS 4.0 score is 7.5 (high).
Successful exploitation runs arbitrary SQL in the local PostgreSQL session of the user performing the import, with high impact on confidentiality, integrity and availability. The vulnerability is not listed in the CISA KEV catalog.
Who is affected
Organizations running PostgreSQL with mysql_fdw versions earlier than 2.10.0 that import schemas from MySQL servers.
What to do
- Upgrade mysql_fdw to version 2.10.0 or later, which quotes these values before building the statements.
- Check the installed extension version (e.g. SELECT extversion FROM pg_extension WHERE extname = 'mysql_fdw';) on all PostgreSQL instances.
- Until upgraded, avoid running IMPORT FOREIGN SCHEMA against MySQL servers that are not fully trusted, especially as a highly privileged user.
- Secure the connection to the MySQL server (e.g. TLS) to prevent traffic tampering.
- Review the official EnterpriseDB advisory (cve202662154) and the REL-2_10_0 release notes.
Affected products and versions
CVSS vector, explained
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
- Attack vector
- Network (from the internet)
- Attack complexity
- Low
- Attack requirements
- Present
- Privileges required
- None (no login)
- User interaction
- Active
- Confidentiality
- High impact
- Integrity
- High impact
- Availability
- High impact
Weakness type (CWE)
- CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
References
- www.enterprisedb.com/docs/security/advisories/cve202662154/ vendor advisory
- github.com/EnterpriseDB/mysql_fdw/releases/tag/REL-2_10_0 patch
Sources: CVE.org (CNA and CISA ADP), CISA KEV, FIRST EPSS. Always check the vendor's official advisory.