Skip to main content
Mallory
HighPublic exploitVulnerability

CVE-2026-2005: Heap Buffer Overflow in PostgreSQL pgcrypto PGP Session Key Parsing

Published Feb 12, 2026 · Updated 11 days ago
Trending this weekNot trendingOutside this week’s top 100
Mention activity · 30 days3 mentions · peak 2 in a dayToday
CVSS8.8High · v3.1
EPSS1.4%72nd percentile
CISA KEVNoNot listed
In the wildNonePublic exploit, no exploitation reported
Vendor
Postgresql
IdentifiersCVE-2026-2005CWE-122 · Heap-based Buffer Overflow

CVE-2026-2005 is a heap buffer overflow in the PostgreSQL pgcrypto extension's public-key decryption handling. In pgp_parse_pubenc_sesskey(), decrypted RSA or ElGamal session-key material is copied into a fixed-size, 32-byte buffer without validating the copy length. After PKCS#1 v1.5 unpadding, the function derives the session-key length from the decrypted message length; the checksum validation does not enforce an upper bound. A crafted ciphertext and matching key can therefore cause an out-of-bounds heap write, potentially enabling arbitrary code execution as the operating system user running PostgreSQL. Affected releases are PostgreSQL 18 before 18.2, 17 before 17.8, 16 before 16.12, 15 before 15.16, and 14 before 14.21.

Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Analyst brief

Impact, mitigation & remediation

What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.

Impact

What an attacker gets, and what they’ve been doing with it.

Successful exploitation can compromise database confidentiality, integrity, and availability through arbitrary code execution under the PostgreSQL service account. Memory corruption can also crash database backend processes. A demonstrated exploitation chain obtains arbitrary memory read/write and elevates the database session to PostgreSQL superuser before executing operating-system commands. Host-level access remains bounded by the service account's operating-system permissions and any container or sandbox restrictions; operating-system root access is not an inherent outcome.

Mitigation

If you can’t patch tonight, do this now.

Until patched, prevent untrusted ciphertext from reaching pgcrypto public-key decryption operations. Restrict access to affected functions and application interfaces that invoke them, and audit callers accepting user-controlled ciphertext or keys. Limit database network access to trusted clients and apply least-privilege operating-system permissions to the PostgreSQL service account to reduce post-exploitation impact. These controls reduce exposure but do not repair the memory corruption flaw.

Remediation

Patch, then assume compromise.

Upgrade to PostgreSQL 18.2, 17.8, 16.12, 15.16, or 14.21, or a later release in the applicable major-version branch. Alternatively, install the distribution's vendor-patched packages, including the affected pgcrypto component. These cumulative minor updates require updating binaries and restarting PostgreSQL, but do not require dump/reload or pg_upgrade. For embedded PostgreSQL deployments, apply the corresponding product vendor update.

Public exploits

Exploits

2 exploits validated by Mallory's analysis. Hidden: 1 rejected by Mallory's analysis as not a working exploit.

View more in app →
CVE-2026-2005This repository is a real Python proof-of-concept exploit for CVE-2026-2005, a heap-based buffer overflow in PostgreSQL's pgcrypto extension during PGP session key parsing. The repo is small and focused: README.md documents the vulnerability and exploitation stages, poc.py contains the full exploit logic, and requirements.txt lists dependencies (psycopg2-binary, pwntools, pycryptodome). The exploit is not part of a larger framework. Its main entry point is poc.py, which connects to a PostgreSQL server using supplied credentials and crafts malicious OpenPGP data to trigger the overflow. Based on the README and visible code, the exploit performs a multi-stage chain: generate RSA material and PGP packets, trigger a heap corruption to leak a heap pointer, use a second corruption to obtain an arbitrary read primitive, scan leaked memory for candidate code pointers, compute/vote on possible PIE bases using symbol offsets from a locally supplied postgres ELF binary, validate the recovered base by reading CurrentUserId, then build an arbitrary write primitive that overwrites CurrentUserId with bootstrap superuser OID 10. Once elevated, it executes an arbitrary OS command through PostgreSQL COPY FROM PROGRAM and prints the output. Operationally, this is more than a simple crash PoC: it includes end-to-end exploitation and post-exploitation command execution, but the payload is still basic and operator-supplied rather than modular, so OPERATIONAL is the best fit. The exploit requires a matching vulnerable PostgreSQL build, pgcrypto enabled, valid DB connectivity, and likely an AArch64 target/build environment due to the explicit pwntools architecture setting. Fingerprintable targets/endpoints are primarily the PostgreSQL host/port and the local postgres binary path used for symbol resolution; there are no hardcoded C2 endpoints or exfiltration destinations.var77 · Disclosed May 13, 2026 · python · markdown · network · webOperationalCVE-2026-2005Repository is a self-contained proof-of-concept/operational exploit lab for CVE-2026-2005, a heap buffer overflow in PostgreSQL pgcrypto's pgp_parse_pubenc_sesskey(). The repo contains a Docker-based vulnerable environment, a Node.js exploit, and helper verification scripts. Core files: Dockerfile builds PostgreSQL 18.1 from a specific vulnerable commit with pgcrypto and pageinspect; docker-compose.yml exposes the database on 5432 with trust auth and mounts the exploit directory; init.sh initializes the cluster, enables remote access, and listens on all interfaces; exploit.js is the main entry point and implements a 7-stage exploit chain; verify.sh and test-pgcrypto.sql are validation helpers confirming pgcrypto availability rather than exploitation. The main exploit capability in exploit.js is full remote code execution against a reachable PostgreSQL instance after authenticating as a low-privileged user. The chain performs a heap pointer leak, arbitrary read, pointer candidate collection, PIE base resolution, arbitrary write to overwrite CurrentUserId with superuser OID 10, and finally OS command execution via COPY FROM PROGRAM. The exploit is highly environment-specific: it assumes aarch64/ARM64, glibc-dependent heap layout, vulnerable pgcrypto, and access to Docker/container internals for reliable PIE/symbol resolution. This is not merely a detector; it is real exploit code with a configurable command payload (--cmd), making it an operational PoC rather than a framework module.open-flaw · Disclosed Aug 10, 2026 · javascript · bash · network · local · webOperational
Exposure surface

Affected products & vendors

Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.

VendorProductType
PostgresqlPostgresqlapplication
FAQ

Frequently asked questions

Is CVE-2026-2005 exploited in the wild?
As of Nov 7, 2026, Mallory has no reports of CVE-2026-2005 being exploited in the wild. It is not listed in CISA KEV.
Is there a public exploit for CVE-2026-2005?
Yes. Mallory tracks 2 public exploits or proofs of concept for CVE-2026-2005, the earliest disclosed May 13, 2026.
Is there a patch for CVE-2026-2005?
Upgrade to PostgreSQL 18.2, 17.8, 16.12, 15.16, or 14.21, or a later release in the applicable major-version branch. Alternatively, install the distribution's vendor-patched packages, including the affected pgcrypto component.
What products are affected by CVE-2026-2005?
Postgresql.
How severe is CVE-2026-2005?
CVE-2026-2005 has a CVSS v3.1 score of 8.8 (High) and an EPSS score of 1.4% (72nd percentile) as of Nov 7, 2026.
Activity feed

Recent activity

67 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.

View more in app →
tenable nessus pluginsNews · Nov 2, 2026Photon OS 5.0: Postgresql16 PHSA-2026-5.0-90-1039 | Tenable®A vulnerability covered by the PhotonOS PostgreSQL 16 security check; its technical nature and individual exploitation status are not specified.Read more ↗tenable nessus pluginsNews · Nov 2, 2026Photon OS 5.0: Postgresql15 PHSA-2026-5.0-90-1039 | Tenable®Listed in the Photon OS 5.0 PostgreSQL 15 security check. No vulnerability-specific technical details or exploit-availability attribution are provided.Read more ↗tenable nessus pluginsNews · Oct 30, 2026CentOS Linux 7 [TuxCare] Security Update: postgresql / postgre... | Tenable®Referenced as covered by the CentOS Linux 7 PostgreSQL package security update and used as the source of the plugin's CVSS v3 score of 8.8. The associated temporal vector indicates proof-of-concept exploit maturity and an official fix. No vulnerability-specific technical description is supplied.Read more ↗tenable cloud security pluginsNews · Oct 2, 2026Echo: postgresql-15: security update to 15.16postgresql-17: se... | Tenable®A heap buffer overflow in PostgreSQL's pgcrypto component enables a ciphertext provider to execute arbitrary code with the privileges of the database's operating-system user. The plugin reports a high-severity CVSS v3 base score of 8.8 and available exploits. Fixed releases are PostgreSQL 18.2, 17.8, 16.12, 15.16, and 14.21. The stated remediation is to update postgresql-15 and related packages to version 15.16 or later.Read more ↗
+15 more in the timeline. Sign up to see them
Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Mallory platform

The version that knows your environment.

This page is what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which adversaries are exploiting it right now, and which detections to deploy tonight.
Exposure mappingQuery your assets running an affected version, and investigate the blast radius.
Threat actor evidenceEvery report linking this CVE to a named adversary.
Associated malwareMalware families linked to this CVE, with evidence and IOCs.
Detection signaturesYARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.
Vendor-by-vendor mappingCross-references every affected SKU, including bundled OEM variants.
Social activity35Community discussion across Reddit, Mastodon, and other social sources.