Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessAttacker controls/compromises foreign server
-
DeliveryVictim issues postgres_fdw batch INSERT
-
ExploitServer over-reports inserted row count
-
ExecutionHeap buffer overflow in local server
-
ImpactExecute arbitrary code as PostgreSQL process
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Heap buffer bounds checking
MITRE ATT&CK
1 technique across 1 tactic: Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires the local PostgreSQL instance to use the postgres_fdw extension and perform foreign batch inserts (e.g. INSERT into a foreign table with batching) against a remote/foreign server that the attacker controls or has compromised; the overflow is triggered specifically when that foreign server reports having inserted more rows than the local server supplied. This is NOT a default configuration - it depends on postgres_fdw being in use and a trust relationship to a malicious or subverted foreign server, which meaningfully limits the exposed population to environments that federate to untrusted PostgreSQL servers. The same bug can also be hit benignly when a rule on the remote table legitimately expands an INSERT into additional rows, but attacker-driven code execution requires control of the foreign server's response. Affected versions are those before PostgreSQL 18.7, 17.12, 16.16, 15.20, and 14.25; updating to those versions is the fix stated by the vendor. |
| Impact | The signals are moderately strong but conditional. The input CVSS vector (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H, base 8.8) describes network-reachable, low-complexity, low-privilege code execution with full confidentiality/integrity/availability impact - consistent with a heap overflow (CWE-122) yielding RCE. However, the vector understates the real precondition: the 'attacker' here is the remote foreign server, and exploitation only matters where the victim runs postgres_fdw batch inserts against a server the attacker controls or has compromised, so AV:N is technically correct but the practical attack surface is narrower than a generic internet-facing RCE. No EPSS score is provided and the vulnerability is NOT in CISA KEV, so there is no evidence of active exploitation; the only reference is the PostgreSQL vendor advisory. The vuln.today decision label is 'this_week' (not act_now/emergency), aligning with a serious-but-not-actively-exploited posture. Bottom line: a genuine high-severity RCE worth prompt patching for anyone using postgres_fdw with untrusted foreign servers, but not a mass-exploitation emergency given the specific deployment prerequisite and absence of KEV/EPSS/PoC signals. |
| Exploit ScenarioDerived | A local PostgreSQL server uses postgres_fdw to perform batch INSERTs into a foreign table hosted on a server the attacker controls or has compromised. The malicious foreign server replies that it inserted more rows than were actually supplied, overflowing a heap buffer in the local server and enabling arbitrary code execution in the context of the local PostgreSQL process. No public exploit identified at time of analysis; a benign trigger of the same bug can also occur when a rule on the remote table expands an INSERT into additional rows. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Nov 12, 2026
Heap-based buffer overflow in PostgreSQL's postgres_fdw foreign data wrapper allows a malicious or compromised foreign server to execute arbitrary code on the local PostgreSQL instance by reporting that it inserted more rows than the local server supplied during a batched INSERT into a foreign table. Affected deployments are those running PostgreSQL before 18.7, 17.12, 16.16, 15.20 or 14.25 that actually use postgres_fdw with batch inserts against a foreign server outside their trust boundary; the CVSS:3.1 vector (AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H, 8.8) indicates an authenticated attacker over the network with high confidentiality, integrity and availability impact, though our assessment notes the prerequisite of controlling or subverting the foreign server meaningfully narrows the exposed population. No public exploit code was identified at time of analysis and the CVE is not in CISA KEV; priority is this_week.
RemediationAI
PostgreSQL has released fixed versions 18.7, 17.12, 16.16, 15.20 and 14.25, and updating to the release matching your branch is the fix stated by the vendor (advisory: https://www.postgresql.org/support/security/CVE-2026-120149/). Because the overflow is in the local FDW code path, upgrading the local instance is required even if the foreign servers remain on older releases; upgrading only the remote side does not close the hole. For environments that cannot patch immediately, the exploitable path requires a foreign server that is malicious or already compromised, so reducing exposure means restricting postgres_fdw connections to remote servers inside your own trust boundary and auditing which foreign servers and foreign tables currently accept batched inserts - a compensating measure that lowers risk from untrusted federation but does not repair the overflow for a subverted server, and it carries the operational cost of losing or reworking federated write paths that depend on batching.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
postgres_fdw is PostgreSQL's built-in foreign data wrapper implementing the SQL/MED Foreign Data Wrapper API, letting a local server read and write tables that live on a remote PostgreSQL server. When the planner batches inserts, the local executor calls ExecForeignBatchInsert and trusts the row count returned by the remote side to size the result handling; CWE-122 (heap-based buffer overflow) results when that count exceeds the number of rows the local server actually handed over, so a foreign server that inflates the reported insert count drives writes past the bounds of a heap allocation. The bug can be reached without any attacker at all in a benign scenario the vendor calls out: a rule on the remote table that expands one INSERT into additional rows legitimately produces a larger returned count. Turning that into code execution, however, requires the attacker to control or have compromised the foreign server's responses. Affected code ships in core PostgreSQL (CPE cpe:2.3:a:n/a:postgresql:*:*:*:*:*:*:*:*) across the 14.x, 15.x, 16.x, 17.x and 18.x branches; the flaw is in the local client-side FDW handling, so patching the local instance is what matters regardless of the remote server's version.
Know when PostgreSQL gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Attacker acts as the remote foreign server (AV:N, PR:L for control of that server), the over-reported row count reliably triggers the overflow (AC:L), and RCE in the local server yields C:H/I:H/A:H.
Primary rating from Vendor (PostgreSQL).
CVSS VectorVendor: PostgreSQL
Lifecycle Timeline
2DescriptionCVE.org
Heap-based buffer overflow in PostgreSQL foreign batch inserts allows a foreign server to execute arbitrary code, via reporting that it inserted more rows than the server supplied. postgres_fdw can legitimately encounter this when a rule on the remote table expands an INSERT into additional rows. Versions before PostgreSQL 18.7, 17.12, 16.16, 15.20, and 14.25 are affected.
Articles & Coverage 1
Executive ViewAI
A high-severity heap buffer overflow in PostgreSQL's postgres_fdw extension could allow a compromised foreign server to execute arbitrary code on the local database instance, potentially leading to full system compromise. This vulnerability affects organizations using postgres_fdw with batched inserts against external servers, requiring immediate attention to prevent unauthorized access and data manipulation.
Apply vendor patch.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.
A heap overflow occurs when a program writes data beyond the bounds of a buffer allocated in the heap memory region.
Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.
More in PostgreSQL
View allPostgreSQL libpq functions PQescapeLiteral(), PQescapeIdentifier(), PQescapeString(), and PQescapeStringConn() improperl
An issue was discovered in Appsmith before 1.52. Rated critical severity (CVSS 9.8), this vulnerability is remotely expl
Argument injection vulnerability in PostgreSQL 9.2.x before 9.2.4, 9.1.x before 9.1.9, and 9.0.x before 9.0.13 allows re
Unauthenticated arbitrary file write in Splunk Enterprise (below 10.2.4 and 10.0.7) and Splunk Cloud Platform (below 10.
Unauthenticated SQL injection in Sangoma Switchvox SMB Edition 8.3 (build 104997) lets remote attackers execute arbitrar
PostgreSQL versions before 9.2.22, 9.3.18, 9.4.13, 9.5.8 and 9.6.4 are vulnerable to incorrect authentication flaw allow
The build_tablename function in pgsql.c in the PostgreSQL (aka pgsql) extension in PHP through 5.6.7 does not validate t
A vulnerability in the h2oai/h2o-3 REST API versions 3.46.0.4 allows unauthenticated remote attackers to execute arbitra
In PostgreSQL 9.3 through 11.2, the "COPY TO/FROM PROGRAM" function allows superusers and users in the 'pg_execute_serve
Unauthenticated SQL injection in Vendure Shop API allows remote attackers to execute arbitrary SQL commands against the
Parse Server is an open source http web server backend. Rated critical severity (CVSS 10.0), this vulnerability is remot
Hard-coded default PostgreSQL credentials shipped in the docker-compose.yaml of langgenius Dify through version 1.5.1 al
EUVD-2026-124423
GHSA-gqm6-3wfg-52x5
NVD
CVE.org
EPSS
VulDB
Exploit-DB