---
id: "CVE-2026-120058"
kind: "vulnerability"
aliases: ["CVE-2026-120058"]
title: "psqlODBC: a malicious server can overflow driver memory via FETCH replies"
severity: "high"
cvss: 7.5
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["c-sharp", "odbc", "package", "postgresql", "psqlodbc", "python"]
not_affected_if: ["default-config", "no-declare-fetch", "trusted-server-only"]
published_at: "2026-11-02T19:18:02+00:00"
first_seen_at: "2026-11-02T19:24:39+00:00"
updated_at: "2026-11-02T19:26:41+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-120058", "first_seen_at": "2026-11-02T19:24:39+00:00"}]
---

# psqlODBC: a malicious server can overflow driver memory via FETCH replies

psqlODBC sizes its row cache from the first result's column count but trusts later FETCH replies without checking them. A server the client does not trust can send a later reply with more columns and make the driver write past a heap allocation, or underflow a field count on keyset replies.

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

## How to check

- Find the installed psqlODBC driver version and check whether it is below `18.00.0006`.
- Check whether `UseDeclareFetch` is enabled in the DSN or connection string.
- Check whether the connection can reach a database server that is not trusted under current SSL settings.

## Fix

- psqlODBC versions before `18.00.0006` are affected; move to `18.00.0006` or later.

## Timeline

- 2026-11-02T19:24:39+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-120058

## Documents

- [advisory] Vendor advisory: github.com https://github.com/postgresql-interfaces/psqlodbc/security/advisories/GHSA-6rmx-9q62-4w6m

## From the sources

psqlODBC sizes its row cache from the column count of a cursor's first result, but recomputes the column count from each later FETCH reply without checking that it matches. A server not trusted under current SSL settings can answer a later FETCH with more columns and make the driver write tuple records past the end of the heap allocation. A keyset reply with fewer columns than the key fields also underflows the unsigned field count. This is reachable with UseDeclareFetch enabled. Versions before psqlODBC 18.00.0006 are affected.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
