Skip to content

PostgreSQL wave (52 GHSAs): attacker-controlled foreign server gets RCE on the database host

Wave in one line: The November 12 coordinated PostgreSQL release (fixed 18.7 / 17.12 / 16.16 / 15.20 / 14.25) ships 52 advisories, and the operator-relevant cores are four legs that turn a foreign server, a dump file, a low-priv CREATE grant, or a pg_temp schema into code execution, plus the RLS/DROP OWNED and security_barrier bypass pair that every app pentest against a Postgres back end should re-run.

All 52 advisories landed at 2026-11-12T15:31-15:32Z with empty GHSA CVSS fields (vendor-advisory band fingerprinting per the Oct 14 NGINX precedent); band details are in each description. The memory-safety majority (type-confusion via ALTER ... SET DATA TYPE, plperl/plpgsql/pltcl UAFs, tsvector overflows, tuple-size wraparound) is the tracked memory-safety class and is not published standalone. The legs below are durable because they cross a trust boundary an attacker who is not the DBA can reach, or they invert the direction of a well-known attack.

Lab instances and disposable data only

Every probe here runs against a disposable PostgreSQL you own, with synthetic roles, synthetic extensions, and marker tables. The client-tool legs require running pg_dump/pg_restore/vacuumdb/psql against hostile inputs, so run them in a throwaway container as a non-privileged user. Never point a customer's server at your foreign-data-wrapper listener or restore untrusted dumps outside the container.

1. A malicious foreign server is a remote attacker against the database host

  • Heap overflow in foreign batch inserts (GHSA-gqm6-3wfg-52x5 / CVE-2026-120149, high): a foreign server that reports more inserted rows than the batch supplied overflows a heap buffer on the local side, giving code execution as the OS user running the database. The vendor notes postgres_fdw can legitimately hit the count mismatch when a remote rule expands an INSERT, so the local side treats the remote's row count as trusted bookkeeping.
  • Reverse-direction deserialization: this inverts the standard FDW attack. Normally the pentester controls the local server and pokes a configured foreign one. Here the foreign endpoint is the attacker-controlled input channel: row counts, and by adjacency the dblink type-conversion reentry UAF (GHSA-63j6-rm8q-mhqx / CVE-2026-120147, type-conversion code re-enters dblink and closes a connection whose results an outer call is reading).
  • Compromised-publisher leg: logical replication lets a compromised publisher execute code as the OS user running a superuser-owned subscription by naming a system catalog as a replication target (GHSA-j3p3-grqw-h5vf / CVE-2026-120145, high, superuser-owned subscriptions only).
  • Validation workflow (authorized lab): stand up a synthetic FDW listener that speaks enough of the protocol to accept a batch and lie about the returned row count; run INSERT INTO foreign_table ... from a lab subscriber and watch for subscriber-backend crash. Same-shape probe battery for any product embedding a foreign-data client (postgres_fdw, dblink, oracles_fdw, pg_mssql_server-adjacent wrappers): treat every server-supplied count/length/ordinal in the wire contract as attacker-controlled even when the connection was configured by an admin.
  • Reporting angle: the trust boundary is operator config (a trusted foreign server entry) does not make the peer trusted at runtime. This is the FDW sibling of the "remote listing entries steer endpoint operations" rule from the Camel page: server-controlled input crossing into client-side bookkeeping.

2. The dump/restore toolchain is an attack surface, not just a data plane

  • restore.sql predictable restriction key (GHSA-3cj4-r426-m55g / CVE-2026-116330, high): a compromised origin server puts untrusted content into the undocumented restore.sql inside a pg_dump --format=tar archive, and the predictable restriction key means the client-side psql executes it; RCE as the OS account running psql. Explicitly a gap in the fix for CVE-2025-8714, incomplete-fix genealogy to fingerprint.
  • pg_restore archive-provider code execution (GHSA-mhqh-c375-96c6 / CVE-2026-116314, high): a crafted non-plain archive yields code execution in the pg_restore process itself, the advisory drawing the line the community routinely blurs: crafted archive data legitimately confers arbitrary SQL at the restore destination, not arbitrary code in the client OS process.
  • pg_dump SQLi via constraint quoting (GHSA-6vgg-f58c-3v5x / CVE-2026-116318, high, 18.x): an inherited column whose child-local not-null constraint name requires quoting injects SQL executed as the restoring user. Same shape as reindexdb --jobs --index parallel catalog query injection via a crafted index name (GHSA-qq3m-7qq2-628h / CVE-2026-116325) and vacuumdb --missing-stats-only operator shadowing (GHSA-64m9-jq4j-66v4 / CVE-2026-116313, where the pg_upgrade docs themselves recommend the affected invocation).
  • Durable rules:
  • Object names are code in the toolchain. Any identifier you can create (constraint, index, table) is re-embedded into SQL that a higher-privileged maintenance user will run hours later. Deferred-execution SQLi family: object-creator privilege, restorer/DBA execution.
  • Operator-path search-path hijack: vacuumdb's catalog query resolves operators unqualified, so a created pg_temp operator shadows theirs. Grep the same flaw in every client tool that runs catalog SQL: pg_dump, pg_upgrade scripts, backup agents, ORM migration runners.
  • Dump-consumption pipeline test (authorized): if a target ingests dumps/archives from customer servers, feed it a tar-format archive from a compromised-origin stand-in in a container and instrument for psql-side execution; also diff "restores cleanly" against "restores in a sandbox" since the restore.sql executes during plain restores.
  • sslkeylogfile arbitrary-file-append via dblink/CREATE SUBSCRIPTION connection parameters (GHSA-qr4r-2rhh-hpj4 / CVE-2026-14661, high) is the connection-string-as-file-primitive leg: NSS-keylog-format appends to a user-chosen path (no arbitrary bytes), persistent DoS when the target is a config file. Connection-string parameters deserve the same file-path audit as any URL field (July 30 URL-policy page family).

3. Database-level CREATE is bootstrap-superuser RCE on trusted extensions

  • CREATE EXTENSION search-path hijack (GHSA-pm32-vprj-4hwf / CVE-2026-6467, high): via ALTER SCHEMA ... RENAME or CREATE EXTENSION ... SCHEMA "$user", a trusted-extension script locates the wrong object and executes attacker SQL as the bootstrap superuser. Requires only database-level CREATE privilege.
  • Extension-script substitution injection (GHSA-w429-xmhm-p6jc / CVE-2026-120153, high): a schema or owner name containing newlines/special substrings injects into @extschema@-style substitutions in a non-bundled extension's script, again code as the bootstrap superuser; explicitly the CVE-2023-39417 genealogy with a new precondition.
  • pg_temp type hijack of security-restricted operations (GHSA-vhhp-qrj9-rf8m / CVE-2026-116316, high): create a domain/enum/range type in pg_temp, then wait for a victim session running a security-restricted operation to write an unqualified type name (SELECT '1'::bigint shape), and your type's casts/functions run as the operation's caller. Advisory notes autovacuum avoids unqualified casts, so hunt the other scheduled/daemon sessions (maintenance jobs, app cron roles, pgAgent, backup tooling).
  • Operator checklist on any Postgres-backed app or platform (the "can I escalate through the database itself" audit):
  • Enumerate installed and installable extensions (SELECT * FROM pg_available_extensions), flagging non-bundled ones with @extschema@/@extowner@ substitutions in their scripts, then test CREATE EXTENSION as the lowest privileged role that holds database CREATE.
  • Test the search-path legs: CREATE EXTENSION <trusted> SCHEMA "$user" under a role owning a schema named after itself, and rename-schema variants; a trusted script touching your objects = the finding.
  • Plant pg_temp domain/enum/range types shadowing common casts; instrument which daemon/maintenance sessions consume them (logged statements + synthetic functions writing marker rows in your own lab).
  • Rules: trusted extension = trusted code run through untrusted name resolution; search-path resolution order is an authorization decision, and $user/pg_temp are user-writable rungs on it. Same family as the Aurora wrapper search-path privilege leg (June wave) but executed by PostgreSQL core itself.

4. The two privilege-model bypasses worth re-running on every app assessment

  • DROP OWNED escapes row-level security (GHSA-c93m-7254-wq8r / CVE-2026-116311, medium): a role can DROP OWNED to remove itself from restrictive RLS policies, then read/modify rows the policy denied. Multi-tenant apps that lean on RLS as the tenant boundary while roles own schema objects have a same-connection policy-removal path. Adjacent: REASSIGN OWNED lets a role granted INHERIT but not SET transfer objects to the granted role and reassign database ownership without CREATEDB (GHSA-v5xq-4x8p-53j2 / CVE-2026-120146), where the equivalent ALTER ... OWNER is blocked, utility-command vs DDL-command authorization parity.
  • security_barrier view leak via leaky function (GHSA-w7w5-rq5g-wxfw / CVE-2026-116327, medium): apply a leaky function to a CASE test value or an indirect parameter to infer values the barrier view hides; the barrier's predicate-ordering guarantee is defeated through expression evaluation order.
  • INSERT ... ON CONFLICT breaks view WHERE and RLS both: iterated INSERT ... ON CONFLICT DO UPDATE through an auto-updatable view bypasses the view's WHERE condition and reads and writes every base-table row (GHSA-wrm7-crvq-vpv9 / CVE-2026-16237); the RLS variant reads every row despite policies (GHSA-9pxp-38rf-5pgv / CVE-2026-120154). Both are read-oracles-with-a-write-primitive: the iterated upsert is also a row-existence probe. MERGE transition-table state confusion (wrong AFTER trigger row on partitioned insert-then-update, GHSA-xqm8-qxc4-qxc9 / CVE-2026-116312) completes the "auditing triggers lie" set: audit triggers on MERGE/partitioned tables cannot be trusted as an integrity record.
  • Assessment pattern: on a Postgres back end, always ask which enforcement layer the app trusts (RLS, view WITH CHECK, security_barrier, trigger auditing, column grants) and attack that layer's utility-command interactions, not just the query text. These five legs are the November 2026 vocabulary for that question, and all predate 18.7: run the battery against current versions first, then fingerprint minor versions from behavior differences (e.g. ON CONFLICT-on-view works or doesn't).

Tracked from the same wave without publication

  • Memory-safety class (per parser precedent): type-confusion septet via ALTER ... SET DATA TYPE / any-parameter SQL functions / type-cache invalidation race / extended-statistics RECORD ids / operator commutator-negator links / min-max aggregate SORTOP / composite-field assignment deform-reform (CVE-2026-6460, 18447, 120144, 120148, 116335, 120148-adjacent, 116308 group); plperl UAF quartet + plpgsql record-field + pltcl reentrant-domain-CHECK UAF (116307/116319/116320/116309/120151/116323); portal-setup, trigger-cursor-over-transition-table, expanded-record-domain, parallel RECORD-descriptor UAFs (116332, 120143, 120150, 116304); ts_rank_cd/tsvector_delete overflows (116317, 116315), tuple-size + generation-context integer wraparound (120139, 116328), parallel B-tree and dict_int over-reads, pg_show_all_settings UAF (memory disclosure, revisit if an infoleak chain emerges). Watch for KEV on any of these; the unauthenticated auth_timeout spinlock server-restart DoS (116322) is availability-only.
  • pg_basebackup format-string memory disclosure (16240) needs a compromised origin plus a guess-and-check oracle, tracked with the FDW legs if a replayable chain lands.
  • MIT Kerberos GSS-RPC/authgss resource-management pack (112314-112323, updated-feed 15:32Z): leak/size-limit family in svc_auth_gssapi/clnt_tcp, memory-discipline class per parser precedent, tracked; revisit only if a service-level oracle workflow emerges.

Reporting notes

  • For the client-tool legs, state which tool version executes attacker content, which OS user runs it, and whether the trigger requires restoring from a hostile origin (pg_dump/restore.sql) vs merely naming objects (pg_dump/reindexdb/vacuumdb SQLi). Quote the pg_restore SQL-vs-code line, it pre-empts the "restores execute SQL by design" dismissal.
  • For the FDW legs, the finding is a pre-auth-to-DB-host primitive against the connecting server from the peer side, prove crash or marker-write in a disposable subscriber, no production FDW configs touched.
  • For RLS/view bypasses, prove read or write of one marker row that policy denies, from a role that legitimately holds only view INSERT+UPDATE; report the enforcement-layer name the app relies on.

November 25 second follow-up: the FDW wave continues in third-party wrappers, postgres_fdw's cousins ship the same grammar holes with fewer eyes (mysql_fdw 2.10.0, mongo_fdw 5.6.0, hdfs_fdw 2.4.0)

Source: 2026-11-25T18:30Z wave. Same operator vocabulary as section 1 (attacker-controlled foreign server) and section 3 (privilege separation inside FDW option handling), now proven again across three independent wrapper extensions in one release train.

  • Charset-blind escaping in mysql_fdw literal building (GHSA-373c-36hr-jp62 / CVE-2026-62151): pushed-down WHERE literals are escaped without character-set awareness, so on GBK/SJIS/Big5 connections with MySQL backslash escaping enabled, a value ending in 0x5C absorbs the escape backslash and leaves the next quote open. SELECT-only on a foreign table = arbitrary SQL on the remote MySQL as the user mapping's credentials. The classic GBK injection, resurrected in 2026 inside a PostgreSQL extension.
  • Unescaped identifiers and options in mysql_fdw control statements (GHSA-wcgx-886g-jx87 / CVE-2026-62153): dbname/table_name in ANALYZE, remote schema plus LIMIT TO/EXCEPT names in IMPORT FOREIGN SCHEMA, and sql_mode in SET are inserted raw, so table-creation/alter or IMPORT rights break out of literals into remote-server SQL.
  • Reverse-direction FDW again: compromised MySQL server writes SQL into your session (GHSA-x5jx-6546-4m83 / CVE-2026-62154, high): IMPORT FOREIGN SCHEMA copies COLUMN_DEFAULT and generated ENUM type names from the remote information_schema unquoted into local CREATE FOREIGN TABLE statements, so a malicious or MITM'd MySQL server runs arbitrary SQL in the importing user's local session. This is section 1's reversed-FDW rule reproduced in a wrapper.
  • Privilege separation inside FDW options (GHSA-gv24-j96j-h75w / CVE-2026-62152): a non-superuser with USAGE on the foreign server could set init_command (arbitrary SQL at every connect, including other users' sessions on a shared foreign server) and mysql_default_file/ssl_key/ssl_cert/ssl_ca/ssl_capath (server-host file reads + connection redirection). Fix restricts these to superusers.
  • URI-structure injection through unencoded credential options (GHSA-68g8-hj67-cq52 / CVE-2026-62155): mongo_fdw concatenated user-mapping username/password into the mongodb:// URI without percent-encoding, so @ : / ? # & = in your own credentials redirect the connection to an attacker host (credential capture + MITM), and server-level address/database/replica-set options inject the same way. Option values are data to the user but grammar to the URI parser.
  • Fixed-length ObjectId reads (GHSA-58x3-p638-vfwc / CVE-2026-62157): short _id values make libbson read past input, crashing the backend or leaking adjacent memory into the query sent to MongoDB, triggerable by any user who can supply an _id predicate on a foreign table. Also from the train: hdfs_fdw IN/=ANY literals unescaped for HiveQL pushdown (GHSA-99w4-7pj7-8wx2 / CVE-2026-62156, SELECT-only = HiveQL injection with foreign-server credentials, plus trustStorePassword logged).

Operator rules extending this page's FDW vocabulary:

  1. Audit the wrapper extensions first, not core. Core Postgres got the November coordinated wave; these three wrappers are maintained by smaller teams and shipped the same classes (charset-blind escaping, unescaped identifier positions, unencoded option-to-URI concatenation, reverse-direction metadata trust). On any Postgres assessment: SELECT fdwname FROM pg_foreign_data_wrapper (or enumerate installed extensions), and run the pushed-down-literal battery per wrapper: GBK-style trailing-0x5C pairs, quote-breakout on WHERE and identifier positions, @/?/# inside user-mapping credential fields, short/hex-odd _id shapes on mongo_fdw foreign tables.
  2. Shared foreign server = shared user mapping = lateral channel. init_command-style "run at connect" options (also: mysql_read_default_file, postgres_fdw's own options, any per-server OPTIONS(...) clause) let one USAGE holder execute SQL in other users' sessions. Enumerate foreign servers and their options with \dew+/pg_foreign_data_wrapper, then ask which options a non-superuser settable value reaches.
  3. IMPORT FOREIGN SCHEMA is a remote-to-local SQL bridge worth one probe per engagement. Point it at a MySQL/Postgres server you control (owned fixture) and return hostile information_schema rows (COLUMN_DEFAULT containing a statement) against your own importing role; a local statement executing from remote metadata is the finding. Never import from third-party production servers.
  4. Read-primitive bonus on mongo_fdw: short _id predicates are a backend-memory oracle whose output lands in the outbound query to MongoDB, which means with an owned foreign server you read the crash/leak back. Prove with an owned disposable MongoDB listener and short synthetic _id values only.