# CVE-2026-136503: Use after free, double free and out-of-bounds writes in result and transaction clean-up

> A hostile or compromised PostgreSQL server can trigger use-after-free, double free or out-of-bounds writes in psqlODBC clients, potentially executing code.

- **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-48v4-hjc5-hx8w, UBUNTU-CVE-2026-136503

## What is CVE-2026-136503?

CVE-2026-136503 is a high-severity use after free 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 frees memory that is still in use, frees it twice, or writes outside an application buffer in these cases:

- The clean-up the driver runs at commit and rollback sends queries of its own, and the reply to one of them can start the clean-up again while it is running. The nested run frees the rollback log, or the list of cursors and prepared statements to close, and the outer run uses and frees it again.
- The callback through which libpq delivers notices could run that clean-up, and close the connection, while libpq was still using the connection.
- Freeing a statement whose result holds several cursors (FetchRefcursors=1, or UseDeclareFetch=1) used the freed first result while the later cursors were closed.
- With UseDeclareFetch=1, after a rollback closed an updatable cursor, rows added or deleted through it were counted but not stored, so freeing the statement freed uninitialised pointers, and adding a row wrote past the keyset.
- After a multi-row fetch failed on a row other than the first of its rowset, SQLGetData() wrote at an offset past the buffer the application passed.
- SQLProcedureColumns() freed the result of its catalog query twice when the query failed.
- In a process named sqlservr (SQL Server linked servers), a server version below 8.4 made the statement parser free a buffer twice.
- A failed SQLPutData in the middle of a SQLSetPos() or SQLBulkOperations() data-at-execution sequence left the whole operation pending, with the internal statement still allocated and autocommit silently off, so later statements were rolled back at disconnect. The next positioned update ran the stale callback against a statement that was never executed and dereferenced NULL.

Most of these can be triggered by 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). A database user who can make a statement fail, or who controls the contents of a row the application reads, can trigger the UseDeclareFetch=1 and SQLGetData() cases against an honest server. 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-416 (Use After Free), CWE-415 (Double Free)

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

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


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

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

## Is CVE-2026-136503 being exploited?

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

## Fix prompt for AI coding agents

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

What it is: CVE-2026-136503 is a high-severity use after free 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-136503 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-136503/ (Markdown: https://insights.sbomify.com/CVE-2026-136503/index.md)
```

## Sources

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

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