CVE-2026-62154 in MySQL Foreign Data Wrapperinfo

Summary

by MITRE • 11/25/2026

During IMPORT FOREIGN SCHEMA, mysql_fdw copies column metadata returned by the remote MySQL server into the CREATE FOREIGN TABLE statements it runs locally without quoting it. The COLUMN_DEFAULT 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 information_schema metadata and run arbitrary SQL in the local PostgreSQL session of the user who runs IMPORT FOREIGN SCHEMA. The issue is fixed in mysql_fdw 2.10.0. From mysql_fdw 2.10.0, mysql_fdw quotes these values before building the statements.

If you want to get best quality of vulnerability data, you may have to visit VulDB.

Analysis

by VulDB Data Team • 11/25/2026

The vulnerability identified involves a critical input validation failure within the mysql_fdw extension for PostgreSQL, specifically during the execution of the IMPORT FOREIGN SCHEMA command. This function is designed to automate the creation of foreign table definitions by querying metadata from a remote MySQL server and translating it into local PostgreSQL CREATE FOREIGN TABLE statements. The core technical flaw lies in the improper handling of string literals extracted from the remote information_schema tables. Specifically, when mysql_fdw retrieves column metadata such as default values or enumerated type names, it inserts these strings directly into the generated SQL syntax without applying necessary escaping or quoting mechanisms. This lack of sanitization means that any special characters, particularly single quotes used to delimit string literals in SQL, are passed through verbatim rather than being escaped.

This architectural oversight creates a severe risk of Remote Code Execution via SQL Injection. Because the metadata is sourced from an external database server, trust boundaries become critical. If the remote MySQL server is compromised by an attacker, or if the network connection between PostgreSQL and MySQL is intercepted and manipulated by a man-in-the-middle adversary, they can inject malicious payloads into the information_schema responses. For instance, an attacker could craft a column definition where the COLUMN_DEFAULT field contains a string like 'test'; DROP TABLE users;--'. When mysql_fdw processes this metadata, it constructs a local SQL statement that includes these unquoted characters directly in the DEFAULT clause or type name insertion points. Consequently, when PostgreSQL executes this malformed CREATE FOREIGN TABLE command, it interprets the injected syntax as valid commands rather than data values.

The operational impact of this vulnerability is significant for any organization relying on mysql_fdw to integrate MySQL data into their PostgreSQL environment. A successful exploitation allows an attacker with network access or control over the remote database server to execute arbitrary SQL statements within the context of the local PostgreSQL session. The privileges granted by these injected commands are determined by the permissions of the user account running the IMPORT FOREIGN SCHEMA operation. In many deployment scenarios, this could lead to unauthorized data exfiltration, modification of critical system catalogs, or complete compromise of the database server if the service account possesses elevated administrative rights. This represents a classic case where trust in external metadata sources is not sufficiently validated before use in dynamic SQL generation.

From a classification perspective, this vulnerability aligns with CWE-94 Improper Control of Generation of Code (SQL Injection), as it involves the construction of executable code using externally controlled input without proper neutralization of special elements. In terms of attack vectors and tactics, this scenario maps to ATT&CK technique T1059 Command and Scripting Interpreter, specifically SQL commands, under the broader category of Execution. The attacker leverages the database engine itself as a vehicle for executing arbitrary instructions, bypassing traditional application-level security controls by exploiting the trust relationship between the two database systems.

Mitigation strategies must address both immediate remediation and long-term architectural resilience. The primary defense is to upgrade mysql_fdw to version 2.10.0 or later, where this issue has been resolved by implementing proper quoting of column default values and generated ENUM type names before they are embedded into SQL statements. This ensures that special characters within metadata fields are escaped correctly, preventing them from being interpreted as syntactic delimiters for new commands. Additionally, organizations should enforce strict network segmentation to limit direct connectivity between PostgreSQL and MySQL instances, reducing the attack surface available to potential man-in-the-middle attackers. Implementing mutual TLS authentication can further ensure that the data received originates from a trusted source. Finally, adhering to the principle of least privilege is essential; users executing IMPORT FOREIGN SCHEMA should be granted only the minimum permissions necessary for table creation, thereby limiting the blast radius if an injection attempt were to succeed despite other controls.

Responsible

EDB

Reservation

07/13/2026

Disclosure

11/25/2026

Moderation

accepted

CPE

ready

EPSS

0.00721

KEV

no

Activities

very low

Sources

Interested in the pricing of exploits?

See the underground prices here!