mysql_fdw runs SQL supplied by a malicious MySQL server during IMPORT FOREIGN SCHEMA
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.
Improper Neutralization of Special Elements used in an SQL Command CWE-89
An attacker can send database commands through a form or address, to read, change or delete the data behind a site.
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.
Weakness data: MITRE Common Weakness Enumeration.
New to this? Read how to keep your software updated.
The products and versions NIST lists as vulnerable. If what you run is not listed it is probably not affected, but ask your provider if you are unsure.
| Product | Type | Vulnerable versions | Fixed in |
|---|---|---|---|
| EnterpriseDB MySQL Foreign Data Wrapper (mysql_fdw) | Software | from 0, before 2.10.0 | 2.10.0 |
The 7.5 severity score (high) from the company that reported it, broken into what it means in practice. Red means it makes the flaw easier or worse.
| How it is reached | Network | Can be attacked from anywhere on the internet, with no need to be near the target. |
| How hard it is | Low | Easy to carry out. No special conditions have to line up. |
| Setup needed on the target | Present | The target has to be set up in a particular way. |
| Login needed | None | The attacker does not need an account or password. |
| Someone has to act | Active | A person has to take a deliberate action, such as clicking through a warning. |
| Data exposed | High | Total loss of confidentiality: the attacker can read all the data the program can reach. |
| Data changed | High | The attacker can change or delete anything the program can reach. |
| Service disrupted | High | The attacker can take the service down completely. |
NIST lists 2 sources for this flaw, none tagged as a vendor patch.