# CVE-2026-136509: Driver does not check that server replies match the queries it sent

> A hostile or compromised PostgreSQL server can corrupt memory in applications using psqlODBC via mismatched replies; developers using psqlODBC should care.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Harmful if only installed:** No
- **Needs a specific call:** No
- **Fix available:** No
- **Published:** 25 Nov 2026
- **Updated:** 25 Nov 2026
- **Also known as:** GHSA-98mx-57hv-xjpr, UBUNTU-CVE-2026-136509

## What is CVE-2026-136509?

CVE-2026-136509 is a high-severity memory corruption vulnerability in PostgreSQL psqlODBC, published on 25 Nov 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

psqlODBC did not check that a server reply matches the query it sent: that a FETCH returns no more rows than it asked for, that each row has the described number of columns, that one query produces one result, and that a COPY, a transaction or the connection ends where the protocol says. By sending replies that do not match, a hostile or compromised server, or anyone on the network path of a connection that does not use sslmode=verify-full (the default is disable) can corrupt memory in the application:

- A FETCH reply with more rows than requested overflows the row cache.
- Extra results in reply to a FETCH, or to the queries of a keyset-driven cursor, are freed while still in use.
- A key query of a keyset-driven cursor answered with extra columns, or a re-read row with fewer columns, overflows the row cache.
- Replies without columns or rows, or with NULL values, to the driver's internal queries at connect time and in catalog functions are dereferenced.
- A malformed relacl value in SQLTablePrivileges() makes the driver write past a buffer.
- On Windows with MSDTC, a long transaction name returned by the server overflows a buffer during recovery.
- Values in replies to the driver's internal queries are used without checking their range: an empty column name, a parameter count, a large-object size, a function's or trigger's argument count, and a result of exactly 32767 columns. They are dereferenced, read past, returned to the application or sent back to the server as stack memory, or make the driver loop forever.
- A reply that ends a COPY, the connection or the transaction at an unexpected point leaves freed results, keysets or table information in use: a CopyOutResponse followed by a lost connection, a ROLLBACK command tag under UseDeclareFetch=1, or a lost connection while a cursor with positioned updates is closed. Eight extra bytes in a reply also make the driver wait forever for a COPY to end.
- On Windows, a start-up reply without client_encoding crashes the driver, and with MSDTC a failed connection makes the XA library use a connection it has already freed.
- An error message ending in the first byte of a multibyte character leaves the SQLSTATE returned by SQLGetDiagRecW() unterminated.
- When a string value did not fit the application's buffer, eight Unicode entry points filled the buffer and wrote no null terminator, so a caller that reads to the terminator, as ODBC allows, read past the end of its own buffer.

This continues the fixes for CVE-2026-120058 and CVE-2026-120060, which covered other replies. The demonstrated results are crashes and heap corruption; code execution has not been demonstrated.

Versions up to and including psqlODBC 18.00.0006 are affected.

Weakness: CWE-787 (Out-of-bounds Write), CWE-476 (NULL Pointer Dereference), CWE-416 (Use After Free)

## Which versions are affected by CVE-2026-136509?

An affected version is exposed as installed. No special setting or call is needed.


## How do I fix CVE-2026-136509?

No fix has been published for CVE-2026-136509 yet. Limit exposure of the affected software until one is available.

## Is CVE-2026-136509 being exploited?

There is no known exploitation of CVE-2026-136509 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-136509 and fix it if it is affected.

What it is: CVE-2026-136509 is a high-severity memory corruption vulnerability in PostgreSQL psqlODBC, published on 25 Nov 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2026-136509 in the wild and no public exploit code.
Exposure: An affected version is exposed as installed. No special setting or call is needed.

Affected product: PostgreSQL psqlODBC. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-136509/ (Markdown: https://insights.sbomify.com/CVE-2026-136509/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-136509
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-136509
- OSV: https://osv.dev/vulnerability/CVE-2026-136509

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-136509/
Summaries are generated and may contain mistakes; the official description above is the record.
