PostgreSQL CVE-2026-116331 RCE proof-of-concept with ELF offset calibration, PIE base resolution and pre-calibrated profiles for 484 vulnerable Docker image tags.
Local PostgreSQL RCE lab + PoC.
Absolute slop, but it works.
Install dependencies:
python3 -m pip install -r requirements.txt
Calibrate a running instance without executing a command:
python3 calibrate.py PROFILE IP PORT --binary /path/to/postgres
This mode does not use Docker. PROFILE is an arbitrary safe label; use the
same label later for poc.py. The ELF must exactly match the target build.
Calibrate a Docker image and update offsets.json:
./calibrate.sh 18.6
offsets.json stores only static offsets and does not contain ASLR addresses.
For non-vulnerable tags it records runtime_calibrated: false.
./demo.sh VERSION
./demo.sh 18.6
Any valid postgres Docker tag is accepted, for example 18.6 or 17.12.
Both glibc and Alpine/musl images are supported.
The demo uses 127.0.0.1, a free local port, and the command id>x.
It connects as the default postgres/postgres role and database.
If the tag is not in offsets.json, the demo calibrates it first.
python3 poc.py VERSION IP PORT COMMAND
python3 poc.py VERSION IP PORT COMMAND \
--user USER --password PASSWORD --database DB
Example without Docker:
python3 calibrate.py prod-a 10.0.0.5 5432 \
--binary /path/to/postgres \
--user postgres --password secret --database postgres
python3 poc.py prod-a 10.0.0.5 5432 'id>x' \
--user postgres --password secret --database postgres
The PoC uses the matching profile from offsets.json. The target defaults to
postgres/postgres/postgres.
Use --verbose to print PIE, heap, and payload diagnostics.
calibrate.py reads /proc/self/maps and /proc/self/mem as postgres to
get the PIE base, function-pointer slot, and payload layout. This needs a
PostgreSQL superuser connection. calibrate.sh extracts the ELF into a
temporary directory and removes it after calibration. The heap read happens
while the leak cursor is still open; Alpine/musl releases the leaked
allocation as soon as the cursor closes.
Limit: COMMAND is 1-7 printable ASCII bytes. The trigger usually disconnects
the PostgreSQL backend. For a redirected command such as id>x, the PoC reads
the marker file from the backend working directory and prints it as OUTPUT;
this also verifies execution when PostgreSQL reports an error after the command
has already run.
offsets.json contains runtime-calibrated profiles for all 484 vulnerable tags
listed in vulnerable-tags.txt. Each profile includes the PostgreSQL binary
hash and static offsets; process addresses are discovered again at runtime.
The dataset was validated on 2026-11-16: all 484 PoC runs passed. The mirror
audit records 466 matching image index digests and 18 matching linux/amd64
child-manifest digests for older tags. The batch runner writes a local
calibration-report.json; it is generated output and is not part of the
published dataset.
Files:
demo.sh - local demo for one PostgreSQL tag.calibrate.py - resolve ELF offsets and the live PIE base.calibrate.sh - deploy a tag, calibrate it, and update offsets.json.calibrate_all.py - verify every vulnerable X.Y and X.Y-suffix tag.mirror-digest-audit.json - canonical Docker Hub and mirror digest comparisons;
batch calibration reuses only matching local images or digest-pinned mirror pulls.vulnerable-tags.txt - the 484 tag variants covered by the offsets dataset.offsets.json - calibrated static offsets grouped by Docker tag.poc.py - exploit.pg_client.py - persistent psycopg session with SCRAM/md5 support.elf_offsets.py - ELF parser and offset resolver.requirements.txt - Python dependencies.Use only against systems you are authorized to test, bla-bla-bla.