---
id: "CVE-2026-120147"
page: "https://infrastack.ai/live/CVE-2026-120147"
kind: "vulnerability"
aliases: ["CVE-2026-120147"]
title: "PostgreSQL dblink: use-after-free lets a database object creator run OS code"
severity: "high"
cvss: 8.8
epss: null
exploited: false
status: "open"
category: "runtime"
products: [{"name": "PostgreSQL", "fixed": [], "affected": "", "ecosystem": "runtime"}]
ecosystems: ["runtime"]
tags: ["database", "dblink", "postgresql", "runtime", "self-hosted"]
not_affected_if: ["dblink-not-installed", "managed-hosting-patched", "trusted-users-only"]
published_at: "2026-11-12T15:17:43+00:00"
first_seen_at: "2026-11-12T15:41:56+00:00"
updated_at: "2026-11-12T15:43:11+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-120147", "first_seen_at": "2026-11-12T15:41:56+00:00"}]
exploit_sources: []
---

# PostgreSQL dblink: use-after-free lets a database object creator run OS code

Link for people: https://infrastack.ai/live/CVE-2026-120147 (this .md is for agents)

The PostgreSQL dblink extension has a use-after-free bug: during type conversion it can close a connection whose results an outer dblink call is still reading. A user who can create database objects can use this to execute arbitrary code as the operating system user running the database.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- runtime:PostgreSQL affected range not listed fixed no fixed version listed

## How to check

- Run `SELECT version();` in psql and compare against the fixed versions.
- Check whether the dblink extension is installed with `SELECT * FROM pg_extension WHERE extname = 'dblink';`.

## Fix

- PostgreSQL `18.7`
- PostgreSQL `17.12`
- PostgreSQL `16.16`
- PostgreSQL `15.20`
- PostgreSQL `14.25`

## Timeline

- 2026-11-12T15:41:56+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-120147

## From the sources

Use after free in the PostgreSQL dblink extension allows an object creator to execute arbitrary code as the operating system user running the database, via type conversion code that re-enters dblink and closes a connection whose results an outer dblink call is reading.  Versions before PostgreSQL 18.7, 17.12, 16.16, 15.20, and 14.25 are affected.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
