Dev.to Security ๐Ÿ” Cybersecurity ๐Ÿ‘ 2 ๐Ÿ“– 8 min read

Keycloak 26.8.2 still ships pgjdbc 42.7.13 and its eight CVEs. Your connection string decides which ones matter

On 23 November the PostgreSQL driver for Java published fourteen security advisories at once, eight of them with a CVE number. The fix is version 42.7.15. Keycloak 26.8.2, released on 5 November, ships 42.7.13. As of 1 D

Keycloak 26.8.2 still ships pgjdbc 42.7.13 and its eight CVEs. Your connection string decides which ones matter

On 23 November the PostgreSQL driver for Java published fourteen security advisories at once, eight of them with a CVE number. The fix is version 42.7.15. Keycloak 26.8.2, released on 5 November, ships 42.7.13. As of 1 December, no Keycloak release carries the fix. I read all fourteen advisories against my own config, as I did for the 19 CVEs of 26.8.1.

TL;DR: the driver between Keycloak and PostgreSQL is pgjdbc, and it comes inside the Keycloak image. Its eight CVEs of 23 November are not fixed in any Keycloak release yet. Four of them are decided by your connection string: simple query mode, ssl=on, GSS, startup parameters. One is decided by the roles in your database. At home, none of the first four applies, but my connection string never verifies the server. Here are the commands to read yours.

State of the sources and of my repositories: checked on 1 December 2026. Read the advisories and the documentation of your version before changing a setting.

This article is for teams that host Keycloak themselves, with PostgreSQL behind it.

The driver comes with Keycloak, and it is one fix behind

Keycloak talks to PostgreSQL through JDBC. The PostgreSQL driver is called pgjdbc. You never install it: it sits inside the Keycloak image, and its version is pinned in the project's pom.xml.

At tag 26.8.2, that property reads 42.7.13. At tag 26.5.7, it reads 42.7.7. The fourteen advisories of 23 November cover every version up to and including 42.7.14. Both images are in scope.

The Keycloak project opened one issue per CVE on 26 November, eight issues numbered 55564 to 55571. Then an upgrade issue to 42.7.15 on 30 November, number 55668. It is still open. The release that will carry the fix does not exist yet.

You can read the bundled version in your image without guessing:

docker run --rm --entrypoint sh quay.io/keycloak/keycloak:26.8.2 \
  -c 'find /opt/keycloak/lib -name "org.postgresql*"'
# .../org.postgresql.postgresql-42.7.13.jar

On Kubernetes, the same command runs through kubectl exec in the pod. If the file name says 42.7.14 or lower, you are inside the scope of the fourteen advisories.

Eight CVEs, three places that decide

An advisory describes a flaw and its conditions. The score does not tell you whether your conditions are met. So I sorted the eight CVEs by where the condition lives: your connection string, the roles in your database, or your own code.

Where each of the eight pgjdbc CVEs is decided

Four of the eight CVEs are decided by your connection string. A fifth by the roles in your database. The last three depend on the code that talks to the driver, Keycloak or your SPIs.

Here is the grid, one CVE per row, with the condition and what a Keycloak without special settings does.

The six advisories without a CVE almost all start from the same point: a server the driver never verified. A fake server can then exhaust the client's CPU or memory. We come back to that with ssl=on.

Simple mode is not your case, unless you wrote it

PostgreSQL has two ways to receive a query. In extended mode, the query goes first, then the parameter values, in separate messages. The server never mistakes a value for SQL. In simple mode, the driver writes the values into the query text, between quotes. It then has to escape them itself.

CVE-2026-134842 comes from there. The driver escapes for the value of standard_conforming_strings it believes is active. If an earlier query, a trigger or a config reload turns the setting off, a value with \' closes the string. The rest of the value runs as SQL.

Simple mode is not the pgjdbc default. Keycloak does not turn it on. It only appears if someone wrote it into the URL, through db-url or db-url-properties. Read what your Keycloak loaded:

kubectl exec deploy/keycloak -- /opt/keycloak/bin/kc.sh show-config | grep -i 'db-url'
# kc.db-url = jdbc:postgresql://mimmo-postgresql:5432/keycloak
# no kc.db-url-properties

At home, the URL has no property at all. No preferQueryMode, so extended mode. That row is closed. The Go driver pgx has a flaw of the same class in its simple-protocol batches. I come back to it in another article.

ssl=on is not verified TLS

CVE-2026-134845 is the one I see most often in configs. Someone wants to encrypt the connection to the database. They add ?ssl=on to the URL, because it reads well. The driver accepts it, but translates that value to sslmode=prefer. Only ssl=true and ssl with no value give verify-full.

TLS in prefer mode encrypts if the server offers it, and accepts any certificate. An attacker on the network can refuse encryption, or present their own certificate. They read the traffic and, depending on the authentication method, the password.

jdbc:postgresql://db:5432/keycloak?ssl=on
# the driver applies sslmode=prefer: encrypted when possible, server never verified

jdbc:postgresql://db:5432/keycloak?sslmode=verify-full&sslrootcert=/certs/ca.crt
# encrypted, certificate and host name verified

My case is different, and no better. In my chart, the URL has no ssl at all. So the driver takes its default, prefer. My traffic to PostgreSQL stays inside the cluster, and the chart's network rule is on in production. It says who may talk to Keycloak. It does not say that only my database answers: without verify-full, the driver accepts any certificate.

To know whether your connection is encrypted today, ask the server, not the driver:

SELECT a.usename, s.ssl, s.version
FROM pg_stat_ssl s JOIN pg_stat_activity a USING (pid)
WHERE a.usename = 'keycloak';

If ssl reads f, your connection runs in clear text. If it reads t under prefer, it is encrypted but the server was never verified. The 42.7.15 fix corrects the translation of ssl=on. It does not change the default. Writing sslmode=verify-full is still your job.

Catalog queries: who else has CREATE on your database?

CVE-2026-134844 needs an explanation. The driver reads the PostgreSQL catalog to learn about tables and types. Its queries used operators and functions without naming their schema. PostgreSQL then looks them up along the search_path. A role that can create objects in one of those schemas can plant a function with the same name. The driver runs it with Keycloak's privileges.

Keycloak reads the catalog at every startup. It migrates its schema with Liquibase, and Liquibase goes through those metadata queries. The driver-side condition is met. What remains is the database-side condition: another role with CREATE on a schema in the path.

Since PostgreSQL 15, the public schema no longer grants CREATE to everyone. On a database created before, or migrated without changing that privilege, it still does. Check the privileges on the schemas Keycloak walks through:

SHOW search_path;
-- "$user", public

SELECT nspname, nspacl FROM pg_namespace
WHERE nspname IN ('public', 'keycloak');
-- a =UC/... in nspacl: everyone has USAGE and CREATE

At home, Keycloak has its own schema, keycloak, and its own role. What I have not checked yet is the CREATE privilege on public in that database, and which roles can connect to it. The PostgreSQL server is shared with my Go services, each with its own role. Those roles have few rights beyond their own actions, and my services go through a user limited to its tenant by RLS. The public schema itself comes from the PostgreSQL image. If a role can enter Keycloak's database and has CREATE on public, the row is open. That is the first thing I run after this article.

The last three depend on code, and I do not read all of Keycloak

CVE-2026-134841 is in the driver's parser. A } inside a string closes a JDBC escape such as {ts '...'}. The rest of the string becomes SQL. The condition is a value pasted into the query text. Keycloak sends its values as parameters, separately. A custom SPI that builds a query by concatenation is in scope.

CVE-2026-134843 needs a binary stream sent without a length, then replayed or interrupted by an exception. 134847 needs a user-typed decimal stored as numeric. I know of no such path in Keycloak. I cannot rule them out from the outside either. For these three rows, the honest answer is the upgrade, not a setting.

What I do while waiting for the Keycloak release

The fix has existed since 23 November. The Keycloak release that will ship it has no date. In between, here is my order.

Step 3 is the most useful one. It closes CVE-2026-134845 and five advisories without a CVE at once, because they all start from an unverified server.

The checklist

A driver advisory concerns you twice: through the bundled version, and through the connection string that calls it.

  • [ ] Read the pgjdbc version in your image: find /opt/keycloak/lib -name "org.postgresql*"
  • [ ] Read your loaded connection string: kc.sh show-config | grep db-url
  • [ ] Look for preferQueryMode=simple, ssl=on, gssEncMode: each one opens a CVE
  • [ ] Ask the server whether the Keycloak session is encrypted: pg_stat_ssl
  • [ ] Switch to sslmode=verify-full with sslrootcert, the fix will not do it for you
  • [ ] List the roles with CREATE on the schemas of Keycloak's search_path
  • [ ] Search your SPIs for any query built by concatenation
  • [ ] Follow keycloak/keycloak issue 55668 and migrate as soon as 42.7.15 is bundled

What to remember

Eight CVEs in a driver you never chose, and no release to fix them yet. But four of them can be read in a single line, your connection string. A fifth can be read in your database privileges. You can close those five rows today, without waiting for anyone.

And the most common row, ssl=on, is not even a driver flaw. It is a promise the config makes and the driver does not keep. The fix will keep it. The verified server is still yours to write.

Want your connection string and PostgreSQL roles put through the same review? Have a look at my identity and SSO architecture offer, or let's talk.

Sources: pgjdbc advisories of 23 November 2026 (fourteen GHSAs, including GHSA-6rxc-3r4p-gpff, GHSA-3mrw-838h-x9j9, GHSA-j75g-99q3-vr5c) ยท pgjdbc 42.7.15 ยท CVE-2026-134841 to 134848 (cve.org) ยท keycloak/keycloak 55668 and issues 55564 to 55571 ยท Keycloak pom.xml at tags 26.8.2 and 26.5.7 ยท Keycloak, Configuring the database ยท pgjdbc connection parameters ยท PostgreSQL 15 release notes ยท my Helm chart and values, checked on 1 December 2026

๐Ÿ“ฐ Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.