{"id":"CVE-2026-120147","kind":"vulnerability","aliases":["CVE-2026-120147"],"related":[],"title":"PostgreSQL dblink: use-after-free lets a database object creator run OS code","description":"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.","summary":"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.","severity":"high","cvss":8.8,"epss":null,"exploited":false,"exploited_at":null,"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"],"how_to_check":"- Run `SELECT version();` in psql and compare against the fixed versions.\n- Check whether the dblink extension is installed with `SELECT * FROM pg_extension WHERE extname = 'dblink';`.","fix":"- PostgreSQL `18.7`\n- PostgreSQL `17.12`\n- PostgreSQL `16.16`\n- PostgreSQL `15.20`\n- PostgreSQL `14.25`","status":"open","published_at":"2026-11-12T15:17:43+00:00","first_seen_at":"2026-11-12T15:41:56+00:00","triaged_at":"2026-11-12T15:43:11+00:00","updated_at":"2026-11-12T15:43:11+00:00","category":"runtime","confidence":0.7,"triage":{"at":"2026-11-12T15:43:11Z","model":"claude-haiku-5-5","output":{"fix":"- PostgreSQL `18.7`\n- PostgreSQL `17.12`\n- PostgreSQL `16.16`\n- PostgreSQL `15.20`\n- PostgreSQL `14.25`","reach":"network","title":"PostgreSQL dblink: use-after-free lets a database object creator run OS code","impact":"high","summary":"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.","audience":"businesses","category":"runtime","nicknames":[],"who_cares":["postgresql","dblink","self-hosted","database"],"confidence":0.7,"fix_status":"available","needs_auth":"yes","worst_case":"code runs as the database operating system user","analyst_note":"","how_to_check":"- Run `SELECT version();` in psql and compare against the fixed versions.\n- Check whether the dblink extension is installed with `SELECT * FROM pg_extension WHERE extname = 'dblink';`.","plain_action":"","product_name":"PostgreSQL","needs_analyst":false,"not_affected_if":["dblink-not-installed","trusted-users-only","managed-hosting-patched"],"who_is_affected":"Servers running PostgreSQL before 18.7, 17.12, 16.16, 15.20 or 14.25 with the dblink extension installed are affected. The attacker must be able to create database objects, so exposure is limited to deployments where untrusted users can create objects. Systems without dblink installed or with only trusted administrators can skip it.","user_interaction":"no","product_ecosystem":"runtime","needs_special_setup":"yes","severity_if_unknown":"high"},"cost_usd":0.000767,"input_tokens":4570,"output_tokens":619,"severity_before":"high"},"analyst_status":null,"analyst_note":null,"search":"'-120147':17A,20A '-2026':16A,19A '14.25':132C '15.20':130C '16.16':129C '17.12':128C '18.7':127C 'affect':134C 'allow':87C 'arbitrari':69B,93C 'bug':39B 'call':53B,121C 'close':45B,113C 'code':14A,70B,94C,106C 'connect':47B,115C 'convers':42B,105C 'creat':61B 'creator':11A,90C 'cve':15A,18A 'databas':9A,22B,62B,78B,102C 'dblink':2A,23B,31B,52B,85C,111C,120C 'enter':110C 'execut':68B,92C 'extens':32B,86C 'free':6A,38B,81C 'host':28B 'let':7A 'object':10A,63B,89C 'oper':73B,97C 'os':13A 'outer':51B,119C 'postgresql':1A,21A,24B,30B,84C,126C 're':109C 're-ent':108C 'read':56B,123C 'result':49B,117C 'run':12A,76B,100C 'runtim':25B 'self':27B 'self-host':26B 'still':55B 'system':74B,98C 'type':41B,104C 'use':4A,36B,65B,79C 'use-after-fre':3A,35B 'user':58B,75B,99C 'version':124C 'via':103C 'whose':48B,116C","nicknames":[],"mitigations":[],"who_affected":"Servers running PostgreSQL before 18.7, 17.12, 16.16, 15.20 or 14.25 with the dblink extension installed are affected. The attacker must be able to create database objects, so exposure is limited to deployments where untrusted users can create objects. Systems without dblink installed or with only trusted administrators can skip it.","tier":"B","verified":{},"analyst_revisit_at":null,"fix_status":"available","audience":"businesses","plain_action":null,"pkeys":["postgresql"],"ptokens":["postgresql"],"labels":["database","dblink","high","postgresql","runtime","selfhosted"],"campaign_type":null,"search_a":"'-120147':17A,20A '-2026':16A,19A 'code':14A 'creator':11A 'cve':15A,18A 'databas':9A 'dblink':2A 'free':6A 'let':7A 'object':10A 'os':13A 'postgresql':1A,21A 'run':12A 'use':4A 'use-after-fre':3A","search_b":"'arbitrari':69B 'bug':39B 'call':53B 'close':45B 'code':70B 'connect':47B 'convers':42B 'creat':61B 'databas':22B,62B,78B 'dblink':23B,31B,52B 'execut':68B 'extens':32B 'free':38B 'host':28B 'object':63B 'oper':73B 'outer':51B 'postgresql':24B,30B 'read':56B 'result':49B 'run':76B 'runtim':25B 'self':27B 'self-host':26B 'still':55B 'system':74B 'type':41B 'use':36B,65B 'use-after-fre':35B 'user':58B,75B 'whose':48B","search_c":"'14.25':132C '15.20':130C '16.16':129C '17.12':128C '18.7':127C 'affect':134C 'allow':87C 'arbitrari':93C 'call':121C 'close':113C 'code':94C,106C 'connect':115C 'convers':105C 'creator':90C 'databas':102C 'dblink':85C,111C,120C 'enter':110C 'execut':92C 'extens':86C 'free':81C 'object':89C 'oper':97C 'outer':119C 'postgresql':84C,126C 're':109C 're-ent':108C 'read':123C 'result':117C 'run':100C 'system':98C 'type':104C 'use':79C 'user':99C 'version':124C 'via':103C 'whose':116C","cause_entry":null,"cause_path":null,"disclosures_checked_at":null,"first_public_at":"2026-11-12T15:17:43+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","cvss_by":"f86ef6dc-4d3a-42ad-8f28-e6d5547a5007","poc_count":0,"sources":[{"source":"nvd","external_id":"CVE-2026-120147","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-120147","severity":null,"published_at":"2026-11-12T15:17:43+00:00","modified_at":"2026-11-12T15:17:43+00:00","first_seen_at":"2026-11-12T15:41:56+00:00","fetched_at":"2026-11-12T15:41:56+00:00","note":null}],"documents":[],"disclosures":[],"exploit_sources":[],"notice":"Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai"}