Public PoC Released for 20-Year-Old PostgreSQL pgcrypto RCE Flaw
§A public proof-of-concept exploit has renewed attention on CVE-2026-2005, a serious PostgreSQL vulnerability in the pgcrypto extension. The flaw can allow code execution as the operating system user running the database when an attacker can reach the vulnerable pgcrypto code path.
The vulnerability affects PostgreSQL versions before 18.2, 17.8, 16.12, 15.16, and 14.21. The PostgreSQL project released fixes on February 12, 2026, but the public exploit raises the risk for systems that have not yet been updated.
Access content across the globe at the highest speed rate.
70% of our readers choose Private Internet Access
70% of our readers choose ExpressVPN
Browse the web from multiple devices with industry-standard security protocols.
Faster dedicated servers for specific actions (currently at summer discounts)
The issue is especially important because pgcrypto has existed for about two decades and is used to add cryptographic functions to PostgreSQL. In vulnerable deployments, crafted encrypted input can trigger a heap buffer overflow inside the database process.
What CVE-2026-2005 affects
CVE-2026-2005 affects PostgreSQL’s pgcrypto contrib module. The bug sits in the code that handles PGP-related encrypted data.
The PostgreSQL advisory says the flaw allows a ciphertext provider to execute arbitrary code as the operating system user running the database. That usually means code runs under the postgres service account, not as root by default.
The flaw has a CVSS 3.1 score of 8.8. The attack vector is network reachable, but the CVSS vector also lists low privileges as required. In practical terms, an attacker generally needs valid database access or an application path that can submit attacker-controlled encrypted data to pgcrypto.
CVE-2026-2005 at a glance
| Item | Details |
|---|---|
| CVE | CVE-2026-2005 |
| Affected component | PostgreSQL pgcrypto extension |
| Weakness type | CWE-122, heap-based buffer overflow |
| CVSS score | 8.8 |
| Privileges required | Low |
| User interaction | None |
| Main impact | Arbitrary code execution as the PostgreSQL operating system user |
| Fixed versions | 18.2, 17.8, 16.12, 15.16, and 14.21 |
Why the public PoC changes the risk
The vulnerability was patched in February, but a public proof of concept makes the issue more urgent for unpatched systems. Attackers can study public exploit logic and adapt parts of it to their own environments.
The published exploit targets a controlled PostgreSQL build and depends on memory layout details. That means it may not work reliably against every real-world server without changes.
Even so, public exploit work often shortens the time between disclosure and real abuse. Administrators should treat any unpatched PostgreSQL server using pgcrypto as a priority.
How the flaw can lead to code execution
The bug is a memory corruption issue. When pgcrypto processes specially crafted encrypted data, it can write beyond the intended heap buffer.
That memory corruption can crash the database process. Under the right conditions, it can also give an attacker a path toward code execution inside the PostgreSQL backend process.
Researchers have described a chain where memory corruption can lead to privilege changes inside the database session. From there, a database superuser-level capability may allow command execution through PostgreSQL features that can run operating system commands.
Who is most exposed
The highest-risk systems are unpatched PostgreSQL instances where pgcrypto is installed and reachable by application users or database roles that handle untrusted encrypted input.
Internet-exposed PostgreSQL servers face additional risk, especially if they allow broad network access or rely on weak credentials. The issue can also matter after an attacker compromises an application account, because database access can become the next step toward host compromise.
Managed database environments may reduce some risk through provider controls, but customers still need to confirm engine versions, extension usage, access permissions, and update status.
Affected and fixed versions
| PostgreSQL major version | Vulnerable before | Fixed in |
|---|---|---|
| PostgreSQL 18 | 18.2 | 18.2 or later |
| PostgreSQL 17 | 17.8 | 17.8 or later |
| PostgreSQL 16 | 16.12 | 16.12 or later |
| PostgreSQL 15 | 15.16 | 15.16 or later |
| PostgreSQL 14 | 14.21 | 14.21 or later |
What administrators should do now
The safest fix is to upgrade PostgreSQL to the patched minor release for the major version in use. PostgreSQL minor upgrades are designed for security and bug fixes, so administrators should not wait for a major-version migration.
Teams should also inventory pgcrypto usage. Some databases may have the extension installed for old application features that no longer need it.

If immediate patching is not possible, administrators should reduce exposure by limiting database network access, tightening role permissions, and restricting use of pgcrypto functions to trusted roles only.
- Upgrade to PostgreSQL 18.2, 17.8, 16.12, 15.16, 14.21, or a later supported release.
- Check which databases have pgcrypto installed.
- Remove pgcrypto where it is not needed.
- Restrict execution of pgcrypto functions to trusted roles.
- Review application paths that pass user-controlled encrypted input to the database.
- Block direct internet access to PostgreSQL where possible.
- Rotate exposed or widely shared database credentials.
Signs teams should monitor
Security teams should watch for unexpected PostgreSQL backend crashes, segmentation faults, or repeated database process restarts. These events can indicate malformed input reaching vulnerable code paths.
They should also monitor for unusual child processes started by the postgres user. Command shells, scripting tools, or unexpected network utilities launched from a database host deserve immediate investigation.
Database logs alone may not show the full picture. Teams should combine PostgreSQL logs with host telemetry, process monitoring, network logs, and file integrity monitoring.
Detection and response checklist
| Area | What to check |
|---|---|
| Version | Confirm the PostgreSQL minor release is patched. |
| Extensions | List databases with pgcrypto installed. |
| Permissions | Review which roles can create extensions or call pgcrypto functions. |
| Logs | Look for backend crashes, abnormal errors, and repeated restarts. |
| Host activity | Watch for unexpected processes running under the postgres account. |
| Network | Check for unusual outbound connections from database servers. |
Why this flaw stood out
CVE-2026-2005 stands out because it lived in long-standing PostgreSQL code and affects supported versions across several major release lines. It also shows how extensions can become high-impact targets when they handle complex, attacker-controlled input.
The pgcrypto extension is useful, but it should not be exposed broadly by default. Database roles should only receive the permissions they need, and application accounts should not have broad create or execution rights unless there is a clear reason.
The public PoC does not mean every PostgreSQL server will be compromised. It does mean defenders should move quickly if their systems remain on vulnerable versions.
Summary
- CVE-2026-2005 is a heap buffer overflow in PostgreSQL’s pgcrypto extension.
- The vulnerability can allow code execution as the operating system user running PostgreSQL.
- The flaw affects versions before 18.2, 17.8, 16.12, 15.16, and 14.21.
- A public PoC has increased concern for unpatched deployments.
- Attackers generally need database-level access or an application path into pgcrypto.
- Administrators should patch, review pgcrypto usage, restrict permissions, and monitor database hosts.
FAQ
CVE-2026-2005 is a heap-based buffer overflow vulnerability in PostgreSQL’s pgcrypto extension. It can allow code execution as the operating system user running the database.
PostgreSQL versions before 18.2, 17.8, 16.12, 15.16, and 14.21 are affected. Administrators should upgrade to the fixed minor release for their major version or a later supported release.
Yes. The CVSS vector lists low privileges as required. In practical terms, an attacker usually needs database access or an application path that can submit attacker-controlled encrypted data to affected pgcrypto functions.
A public proof of concept gives attackers technical guidance and may speed up weaponization. Even if the exploit needs changes for different environments, unpatched systems face higher risk after PoC release.
Administrators should upgrade PostgreSQL, inventory pgcrypto usage, remove the extension where it is not needed, restrict pgcrypto function access, limit database network exposure, and monitor for unexpected backend crashes or processes launched by the postgres user.
Read our disclosure page to find out how can you help VPNCentral sustain the editorial team Read more
User forum
0 messages