Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-2005_lab — Self-contained Docker lab for practicing exploitation of CVE-2026-2005, a heap buffer overflow in PostgreSQL's pgcrypto extension, enabling privilege escalation and container code execution. | Kitploit
Tools/GitHubGitHub/stvm8/cve-2026-2005_lab
Vulnerability AnalysisExploitationCTFLearning & EducationDatabase SecurityBinary ExploitationLabs & Practice
GitHubstvm8/cve-2026-2005_lab

CVE-2026-2005_lab

Self-contained Docker lab for practicing exploitation of CVE-2026-2005, a heap buffer overflow in PostgreSQL's pgcrypto extension, enabling privilege escalation and container code execution.

View Repository
476 months agoNot yet reviewed
Share

CVE-2026-2005 — PostgreSQL pgcrypto Heap Overflow Lab

A self-contained Docker lab for practicing exploitation of CVE-2026-2005, a heap buffer overflow in PostgreSQL's pgcrypto extension that enables remote code execution without superuser privileges.

Affected versions: PostgreSQL ≤ 17.7 / 16.11 / 15.15 / 14.20 / 18.1
Fixed in: 18.2, 17.8, 16.12, 15.16, 14.21 (released 2026-02-12)


Setup

Requirements: Docker, Docker Compose

git clone <this-repo>
cd CVE-2026-2005
docker compose up -d

PostgreSQL will be listening on 127.0.0.1:5433.


Your Starting Point

You have obtained database credentials from an application config file:

ParameterValue
Host127.0.0.1
Port5433
Databasetargetdb
Usernamepentester
Passwordpentester123

Connect to confirm access:

psql -h 127.0.0.1 -p 5433 -U pentester -d targetdb

The account has CREATE privilege on the public schema. It is not a superuser.


Objectives

Capture both flags to complete the lab.

Flag 1 — Database privilege escalation

SELECT * FROM flag_db;
-- Only readable after escalating to superuser within the DB session

Flag 2 — Container code execution

/var/lib/postgresql/flag.txt
-- Only readable after executing commands as the postgres OS user inside the container

Scope note: COPY TO PROGRAM executes inside the Docker container, not on the host. The primary real-world impact is full database read access (all tables, all databases). Reaching the Docker host requires a separate container escape technique.


Vulnerability Background

The flaw is in pgp_parse_pubenc_sesskey() inside pgcrypto/pgp-pubenc.c.

When decrypting a public-key encrypted session key packet, the function derives the session key length as msglen - 3 from an attacker-controlled RSA/ElGamal payload and copies it into a fixed 32-byte buffer (PGP_MAX_KEY) without bounds validation. An attacker can write hundreds of bytes beyond the buffer boundary.

The exploit proceeds in three stages:

  1. Info leak — overflow exposes adjacent heap metadata, leaking PIE base and heap addresses
  2. Arbitrary write — corrupt the dst struct to overwrite CurrentUserId in .data with 10 (BOOTSTRAP_SUPERUSERID)
  3. Container RCE — with superuser privileges, COPY (SELECT '') TO PROGRAM '<cmd>' executes OS commands as the postgres user inside the container. In a real deployment without Docker, this means OS-level access on the database host.

Because the ASLR layout is identical across all connections to the same postmaster process, addresses leaked on one connection remain valid on the next.


Useful References

  • NVD: CVE-2026-2005
  • Technical writeup: https://www.zeroday.cloud/blog/postgres-xint
  • PostgreSQL pgcrypto source: pgcrypto/pgp-pubenc.c
  • Symbol resolution: objdump -t $(which postgres) | grep CurrentUserId

Teardown

docker compose down -v

Legal

This lab is for authorized security research and education only. Run it only on systems you own or have explicit permission to test.

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    565
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    478
  • 3

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    383
  • 4

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    327
  • 5

    estorides

    grisuno/estorides

    Aggregates 99+ free OSINT sources in parallel, resolves entities into a knowledge graph, and exports STIX 2.1, MISP, or GraphML with LLM-assisted analysis.

    258
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    256

Explore all tools

Browse our collection of tools

View all tools →