CVE-2026-136502: psqlODBC runs text it took for data as SQL because it reads statements differently from the server

ByLinuxtastic

November 30, 2026 #CVE, #psqlODBC

psqlODBC, the PostgreSQL ODBC driver behind every odbc-postgresql or postgresql-odbc package, does not send your SQL to the server untouched: it scans the statement text itself to substitute parameters, translate ODBC {d …} escapes, join batched statements and rewrite queries for updatable cursors. In every release up to and including 18.00.0006 that scanner read the text differently from the server in nine ways, from a lower-case e'…' escape string it did not recognise to a } inside a quoted literal that it took for the end of an ODBC escape, so text the driver treated as data ran as SQL, and a positioned update, insert or delete could land in another user’s table. Upgrade psqlODBC to 18.00.0007 or later (18.00.0008 is current) and restart every process that has the driver loaded; until then let the server prepare statements, keep cursors forward-only and never put an end user’s value into ConnSettings. It is one of seventeen psqlODBC CVEs fixed in that release.

CVE-2026-136502 at a glance.

ComponentpsqlODBC, the PostgreSQL ODBC driver (psqlodbca.so ANSI and psqlodbcw.so Unicode): its statement-text scanner (parameter substitution, ODBC escape translation, batched parameter arrays, updatable-cursor rewriting) and its ConnSettings parser; packaged as odbc-postgresql (Debian/Ubuntu), postgresql-odbc (RHEL), psqlODBC (SUSE)
Affected versionsevery psqlODBC release up to and including 18.00.0006 (the record’s range starts at 0); the distribution packages of 13.02, 17.00 and 18.00.0006 in the table below are all affected
Fixed inpsqlODBC 18.00.0007, whose changelog entry names this CVE with its advisory GHSA-4392-6j85-5q2q and sixteen siblings (CVE-2026-136499 to CVE-2026-136515); 18.00.0008, the current release, fixes three more. No release date is printed on the changelog; the CVE record is dated 25 November 2026
SeverityPostgreSQL (CNA) CVSS 3.1 8.1 High (AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H); NVD Received with the CNA’s vector and no score of its own; SUSE important, 8.1 and CVSS 4.0 9.2. CWE-89 (SQL injection) and CWE-706 (incorrectly resolved name). The GitHub advisory refused our reader on 30 November 2026; Red Hat and Ubuntu pages likewise
Exploited in the wildNot on CISA’s Known Exploited Vulnerabilities list as of 30 November 2026 (catalogue 2026.11.27). EPSS: no score yet on 30 November 2026
Who is exposedtwo different parties. An end user of an application that lets them control text the application puts into a statement, or a bound parameter value, on a connection where the driver substitutes parameters itself (UseServerSidePrepare=0, or any cursor type other than forward-only), or whose value the application puts into a SET command in ConnSettings, can run SQL with the application’s database role. A database user who can create a table with a crafted name (one containing $, or a quoted name starting with , or ;) can redirect another user’s positioned writes through an updatable cursor into that table
PublishedCVE record 25 November 2026 (PostgreSQL CNA); this page built 30 November 2026, last updated 30 November 2026

What it is

An ODBC driver that rewrites SQL on the client has to parse SQL on the client, and any place where its idea of where a literal, a comment or an identifier ends differs from the server’s is a place where data becomes code. The record lists nine such places. An escape string constant written e'…' in lower case was not recognised as one, while '…' after a keyword ending in E, as in LIKE'…', was taken for one. A } inside a quoted literal ended an ODBC {d …}, {t …}, {ts …} or {escape …} sequence. Dollar-quote tags containing _ were not recognised, and an identifier such as _$$ was taken for the start of a dollar quote, so a parameter marker inside a literal was substituted. A trailing -- comment in one statement of a batched parameter array swallowed the next statement. An integer parameter with an embedded NUL byte cut the query short. /*/ was read as a comment that opens and closes, where the server reads one that only opens.

Two more are about updatable cursors, the feature where the driver rewrites your SELECT into its own queries so that SQLSetPos() can update, insert or delete the current row. To build those queries it has to find the FROM and WHERE clauses of yours, and it misread comments, literals longer than 255 bytes and escape strings while doing so, so that “the text copied into the cursor’s own queries could include SQL from inside a literal”. Worse, a table name containing $ was cut at the $, and a quoted table name starting with , or ; ended the table list, “so positioned updates, inserts and deletes went to another table”. That is the CWE-706 half of the record: a database user who can create a table with a crafted name redirects writes that another user’s application believes it is making to its own table. The ninth defect is at connect time: ConnSettings was split at every semicolon, including one inside a quoted literal, so an application that puts an end user’s value into a SET command there ran the rest of the value as SQL before the first query.

This is one of seventeen psqlODBC advisories published together on 25 November 2026 and fixed in 18.00.0007. Its nearest siblings are CVE-2026-136500, the multibyte-encoding escaping bug, and CVE-2026-136507, the connection-string injection; CVE-2026-136506 is also an injection through names the driver puts into its own queries. The CNA scores all three 8.1 with high attack complexity, because each needs a specific configuration or a specific pattern of application behaviour; on an application that has it, this one is ordinary SQL injection. The distributions are only beginning to catch up: Debian unstable and openSUSE Tumbleweed have 18.00.0007, and every stable release we could read is still on an affected version with no advisory.

Who is affected on Linux

Each row is what the distribution’s own security tracker said on 30 November 2026; the link in the row is the tracker page, which will be newer than this one.

DistributionStatusFixed package
AlpineTracker unreachable on 30 November 2026—
DebianVulnerable in bookworm (1:13.02.0000-2), trixie (1:17.00.0004-2) and forky (1:18.00.0006-1); fixed in sid; no DSA or DLAsid psqlodbc 1:18.00.0007-1 (now 1:18.00.0007-2)
UbuntuTracker returned a server error on 30 November 2026not read; odbc-postgresql at 18.00.0007 or later is the version to look for
RHEL, Rocky, Alma, CentOS StreamSecurity-data feed unreachable on 30 November 2026not read; the package is postgresql-odbc
openSUSE/SLEimportant, 8.1 / CVSS 4.0 9.2, Pending (bug 1292050); Affected on every listed SLE, Leap, SUSE Manager and Enterprise Storage product; released for TumbleweedTumbleweed psqlODBC 18.00.0007-1.1 (openSUSE-Tumbleweed-2026-12716); nothing for SLE on 30 November 2026
Fedora, Arch; source builds and vendor-bundled driversNot consulted; upstream fixed versions applypsqlODBC 18.00.0007 or 18.00.0008

How to check

Three questions: which driver is installed, do any DSNs or connection strings make the driver substitute parameters or carry a ConnSettings line, and does the application use updatable cursors or batched statements with user-supplied text. The first two are files; the third is the application’s ODBC calls.

# 1. which psqlODBC is installed, and which driver files the ODBC manager knows about
dpkg -l odbc-postgresql 2>/dev/null | awk '/^ii/{print $2, $3}'; rpm -q postgresql-odbc psqlODBC 2>/dev/null
odbcinst -q -d
for f in $(grep -rhoE '^Driver\s*=\s*\S+psqlodbc\S*' /etc/odbcinst.ini 2>/dev/null | awk -F= '{print $2}'); do
  echo "$f: $(strings "$f" 2>/dev/null | grep -m1 -E '^[0-9]{2}\.[0-9]{2}\.[0-9]{4}$')"; done

# 2. DSN lines that put you on the vulnerable paths: client-side parameter substitution, cursor types, ConnSettings
grep -nEi 'UseServerSidePrepare|ConnSettings|UseDeclareFetch|Fetch|UpdatableCursors|Protocol' /etc/odbc.ini ~/.odbc.ini 2>/dev/null

# 3. does the application rewrite through the driver? look for positioned updates, parameter arrays and ODBC escapes in its code or ODBC trace
grep -rnE 'SQLSetPos|SQL_ATTR_PARAMSET_SIZE|SQL_CURSOR_(KEYSET|DYNAMIC|STATIC)|\{(d|t|ts|escape) ' /opt/myapp /srv/myapp 2>/dev/null | head
# ODBC trace (unixODBC): Trace=Yes in /etc/odbcinst.ini [ODBC], then grep the log for SQLSetPos and SQLParamOptions

A driver file reporting 18.00.0007 or 18.00.0008, or a distribution package at or above the version in the table, is fixed. Anything older is affected, and exposed when step 2 or 3 turns something up: UseServerSidePrepare=0 or a non-forward-only cursor type means the driver is splicing parameters into SQL text itself; a ConnSettings line built from anything a user typed is the connect-time case; SQLSetPos() with a keyset or dynamic cursor is the redirected-writes case, which needs only a hostile table name on the server, not a hostile client. An application that binds every parameter, lets the server prepare, uses forward-only cursors and never builds statement text from user input is not on any of the nine paths.

How to fix it

Upgrade to psqlODBC 18.00.0007 or later and restart every process that has the driver loaded; a shared library already mapped into a long-running application server, ETL daemon or reporting service keeps the old code until that process exits. On 30 November 2026 only Debian sid and openSUSE Tumbleweed ship the fix as a package, so on a stable release the choice is a backport, a build from source, or the mitigation below until the distribution catches up.

# Debian sid (and trixie/bookworm once a DSA lands) / Ubuntu once a USN lands
apt update && apt install --only-upgrade odbc-postgresql
# RHEL family, once an erratum lands
dnf upgrade postgresql-odbc
# openSUSE Tumbleweed (SLE: nothing yet, bug 1292050)
zypper patch
# from source: 18.00.0008 is the current release; the tarballs live under https://ftp.postgresql.org/pub/odbc/releases/
tar xzf psqlodbc-18.00.0008.tar.gz && cd psqlodbc-18.00.0008 && ./configure --with-unixodbc && make && sudo make install
# then restart whatever has it mapped
for p in $(sudo grep -l psqlodbc /proc/[0-9]*/maps 2>/dev/null | cut -d/ -f3); do ps -o pid,comm= -p "$p"; done

Until the upgrade, take the driver out of the SQL-rewriting business. Set UseServerSidePrepare=1 and use forward-only cursors so bound parameters travel to the server in the protocol rather than being spliced into text; do not use SQLSetPos() positioned writes on a server where other roles can create tables; and build ConnSettings only from constants. What not to do: escaping quotes in the application before binding does not help, because the driver’s misreadings are about comments, escapes, dollar quotes and NUL bytes, not about quotes; and a server-side client_encoding or search_path setting does nothing against a table named to end the driver’s table list.

# mitigation in /etc/odbc.ini (or the connection string): server-side prepare, forward-only cursors, no user-built ConnSettings
[myapp]
Driver=PostgreSQL Unicode
UseServerSidePrepare=1
UseDeclareFetch=0
# remove any ConnSettings= line whose value is assembled at run time
# verify after a reconnect, on the server: the statement should arrive with $1 placeholders, not inlined values
psql -Atc "select query from pg_stat_activity where application_name ilike '%odbc%';"

Sources

  • CVE-2026-136502 at CVE.org — the PostgreSQL CNA record (25 November 2026): the nine defects, affected 0 to and including 18.00.0006, CVSS 3.1 8.1, CWE-89 and CWE-706
  • psqlODBC changelog — the 18.00.0007 entry naming this CVE, GHSA-4392-6j85-5q2q and its sixteen siblings, and the 18.00.0008 entry; the GitHub advisory itself refused our reader on 30 November 2026
  • NVD entry — Received on 30 November 2026, carrying the CNA’s vector and CWEs; no NVD score or CPEs yet
  • Distribution trackers: Debian (fixed in sid 1:18.00.0007-1, no DSA) · Ubuntu (server error on 30 November) · Red Hat (unreachable on 30 November) · SUSE (important, bug 1292050, Tumbleweed fixed) · Alpine (unreachable on 30 November)
  • CISA KEV catalogue 2026.11.27, not listed · EPSS, no score on 30 November 2026

Related reading

This advisory page was assembled from the primary sources listed above on 30 November 2026 and is updated when they change. The facts are theirs; the checks and the ordering are ours. If a row in the distribution table is out of date, the tracker link in that row is the current word.