Skip to content
cloudgrip

$ cat blog/java4shell-keycloak.md

//Vulnerabilities

Java4Shell and Keycloak: three pre-auth flaws in your login server

On November 17, 2026, OpenJDK and Oracle disclosed Java4Shell, a memory corruption bug in the JVM that researchers turned into pre-authentication remote code execution against Keycloak. It landed in a season when Keycloak already had two critical account takeover flaws. Here is what each one needs, how to check your exposure, and what to change today.

  • Nov 28, 2026
  • 8 min read
  • Cloudgrip team

Keycloak is the front door for a lot of companies. It holds the passwords, issues the tokens, and brokers logins from other identity providers. That makes it the server an attacker most wants to own, and the one that has to accept input from anyone on the internet before it knows who they are.

This autumn brought three separate ways in, each one reachable before login:

Flaw Where it lives Needs Impact
Java4Shell, CVE-2026-114938 The JVM (OpenJDK 17.0.6 and later) An x86-64 CPU with AVX-512 VBMI, and Base64 input from the attacker Memory corruption, demonstrated RCE
Password reset bypass, CVE-2026-18963 Keycloak's reset-credentials flow "Forgot password" turned on in the realm Takeover of any account in the realm
SAML redirect signature bypass, CVE-2026-117691 Keycloak's SAML identity brokering SAML brokering with the HTTP-Redirect binding, and an account at the external IdP Takeover of federated users

Java4Shell, CVE-2026-114938

What breaks

Java ships a standard Base64 decoder, java.util.Base64.Decoder. On x86-64 CPUs with the AVX-512 VBMI instruction set, the HotSpot JIT compiler replaces the decode loop with a hand-written, vectorized version, called an intrinsic. According to the write-up by Calif, whose researcher Quang Luong reported the exploitable path to Oracle, that intrinsic computes the write mask for the padded tail of the input wrongly. For some padding shapes the computed output length goes negative, the mask becomes all ones, and the CPU writes a full 64-byte block. That runs past the end of the output buffer.

The trigger is ordinary-looking Base64: a run of valid characters ending in =. Nothing in it looks like an attack to a web application firewall.

This is a memory safety bug in a memory-safe language. Java code that calls Base64.getDecoder().decode() correctly is still affected, because the fault is in the machine code the JVM generates, not in the application.

Who is affected

Red Hat's bulletin lists four conditions, and all four have to hold:

  1. OpenJDK 17.0.6 or later, including 21 and 25, from any vendor that builds on OpenJDK. Red Hat lists OpenJDK 8 and 11 as not affected.
  2. An x86-64 CPU with AVX-512 VBMI. That means Intel Ice Lake and newer server chips, and AMD Zen 4 and newer. ARM64 (Graviton, Ampere, Apple silicon) is not known to be affected.
  3. The JVM was not started with -XX:UseAVX=2 or lower, and Base64 intrinsics are on, which is the default.
  4. Attacker-controlled Base64 reaches the decoder. Red Hat's examples are HTTP Basic credentials, SAML artifacts, CSRF tokens and MIME encoded words.

Condition 4 is easy to meet. Basic auth headers, SAML messages and many token formats are Base64, and servers decode them to decide whether you are allowed in. That is why the bug is reachable before authentication.

Calif reports demonstrating pre-authentication RCE against Keycloak, Jenkins, Jira and Confluence, JFrog Artifactory and PingFederate in default configurations, and post-authentication exploitation in Kafka, Solr, Elasticsearch and others. The public proof of concept only shows the out-of-bounds write. The application exploit chains were withheld, and Calif notes that there is no universal exploit. None of the advisories we read reported exploitation in the wild at the time of writing. Watch CISA's Known Exploited Vulnerabilities catalog and the EPSS score for a change. That buys time, but not much: the root cause has been public since September, when a fix was proposed in the OpenJDK repository after a crash report from June.

What Keycloak admins need to do

The Keycloak team's guidance comes down to three steps.

1. Find out whether your hosts have the instruction set. On the host (containers see the host's flags), all four flags printed means the CPU is in scope:

shell
grep -m1 '^flags' /proc/cpuinfo | tr ' ' '\n' | grep -E '^(avx512f|avx512bw|avx512vbmi|bmi2)$'

Cloud fleets often mix CPU generations, so check every node pool, not one machine. An autoscaler can move a pod onto newer hardware tomorrow.

2. Apply the interim mitigation and restart. Red Hat's preferred workaround switches off only the vulnerable code path:

shell
# Keycloak distribution (ZIP / TAR.GZ)
export JAVA_OPTS_APPEND="-XX:-UseBASE64Intrinsics"

# Container
docker run -e JAVA_OPTS_APPEND=-XX:-UseBASE64Intrinsics quay.io/keycloak/keycloak:26.8.2 start

With the Keycloak Operator, set JAVA_OPTS_APPEND in the Keycloak resource. The Operator pod runs Java itself, so it needs JDK_JAVA_OPTIONS on its own Deployment.

Then verify on the running process, because an environment variable that never reached the JVM protects nothing:

shell
jcmd <pid> VM.flags -all | grep UseBASE64Intrinsics
# expect: bool UseBASE64Intrinsics = false {product} {command line}

3. Install a fixed Java runtime. Oracle, Red Hat and other vendors shipped fixes on November 17. Red Hat's fixed builds are OpenJDK 17.0.21.1, 21.0.13.1 and 25.0.5.1. Keycloak rebuilt its 26.8 images on the fixed runtime (tag 26.8.2-3 and later). The x86-64 images 26.8.2-1 and 26.8.2-2 bundle an affected JDK. The Keycloak version number alone does not tell you whether you are fixed. Check the Java runtime inside the image.

Keycloak is not the only Java service at your edge. CI servers, artifact repositories, wikis and internal tools on the same JVMs need the same check.

Password reset bypass, CVE-2026-18963

In August, Keycloak fixed a flaw in the reset-credentials flow that Red Hat rates 9.1 on the CVSS scale. In a realm where users can click "Forgot password", an unauthenticated attacker could complete a password reset without the link from the reset email, then set a new password for any user. No credentials and no user interaction are needed.

  • Affected: keycloak-services 26.0.0 up to the fixed releases below. "Forgot password" is off by default in a new realm, but most customer-facing realms turn it on.
  • Fixed: community Keycloak 26.7.2 and later, Red Hat build of Keycloak 26.4.15 and 26.6.6 (GHSA-6qm4-x97f-55fh).
  • If you cannot upgrade today: turn "Forgot password" off in each realm until you can.

SAML redirect signature bypass, CVE-2026-117691

Fixed in community Keycloak 26.8.2 on November 5, this one affects SAML identity brokering over the HTTP-Redirect binding. Keycloak decoded percent-encoded parameter names, so %53AMLResponse was read as SAMLResponse. The signature check, however, matched only the literal names in the raw query string. An attacker could send one validly signed message and have Keycloak process a different, unsigned one. Red Hat rates it 9.1 and describes the result as a full takeover of federated users.

The attacker needs an account at the external identity provider, to obtain one legitimately signed message such as a logout response. In a business-to-business setup, where any customer's IdP can broker into your realm, that bar is low. No validated workaround exists, so the fix is to upgrade to 26.8.2 on the patched Java runtime above.

Still open: OTP step-up bypass, CVE-2026-135768

26.8.2 is not the end of the list. On November 25, Red Hat published CVE-2026-135768: when a client policy selects a high-assurance flow with OTP, Keycloak can accept an existing password-only SSO session instead, if the request does not explicitly ask for a specific assurance level. An attacker who has a user's password, from phishing or credential stuffing, can reach the OTP-protected application without the second factor.

Red Hat scores it 6.8 (medium), because the attacker needs a valid password and a user interaction. At the time of writing there is no fix, and Red Hat says the available workarounds do not meet its criteria. If you rely on client policies to force OTP for sensitive applications, treat that control as weaker than it looks until a patch ships, and watch for it in your logs (see below).

The common thread

None of these three is exotic. Each one sits in code that must parse untrusted input before it knows who sent it: a Base64 header, a reset request, a signed SAML message. Scanners can flag a version number. They cannot tell you whether "Forgot password" is on in the realm your customers use, whether your SAML brokers use the redirect binding, or which node pool your login server lands on.

That gap is where most of the work is. A version upgrade fixes the code, but your exposure depends on configuration, hardware and reachability, which only show up when someone actually tests the running system.

How Cloudgrip helps

Hydra tests identity flows the way an attacker would: it logs in, resets passwords, follows SSO and SAML brokering, and tries to cross from one account to another. For logic flaws like the reset bypass and the SAML confusion, it tries the attack against the test accounts you give it, and reports a finding only after the takeover works, with the replayable requests as proof and the fix attached. It also maps the Java services you expose, and which of them decode attacker-supplied Base64 before login.

Some proofs are not worth their side effects. A memory corruption trigger can crash the JVM, so Hydra does not fire it at your production login server. It follows the confirm and hold rule: the smallest action that removes doubt, and nothing after it. For Java4Shell that means confirming the runtime, the CPU flags and the reachable decode path, and reporting what is exposed and what to change.

Cerberus watches for the same paths in the telemetry you already collect. For this season's Keycloak flaws that includes:

  • JVM crashes and restarts on identity hosts, such as hs_err_pid files and container restarts, following requests with long, padded Base64 values in Authorization headers or SAML parameters.
  • Percent-encoded SAML parameter names such as %53AMLResponse in requests to the broker endpoint.
  • Password changes without a reset email: an UPDATE_PASSWORD event with no SEND_RESET_PASSWORD for the same user just before it.
  • Logins to OTP-protected clients without an OTP step: a session reaching a client that policy says needs OTP, where the session's authentication never included one.

These signals depend on Keycloak user events being turned on, so turn them on.

Every attack path Hydra proves becomes a detection Cerberus watches for, so the next variant of a flaw you have already fixed is less likely to go unnoticed.

Key takeaways

  • Java4Shell (CVE-2026-114938) is a memory corruption bug in the JVM's AVX-512 Base64 intrinsic. It affects OpenJDK 17.0.6 and later on x86-64 CPUs with AVX-512 VBMI, and was demonstrated as pre-auth RCE against Keycloak.
  • Today: check CPU flags on every node, set -XX:-UseBASE64Intrinsics, verify it with jcmd, then install a fixed Java runtime. A Keycloak version number does not prove you are fixed.
  • Upgrade Keycloak to 26.8.2 on a patched runtime to close the password reset bypass (CVE-2026-18963) and the SAML redirect signature bypass (CVE-2026-117691) as well.
  • The OTP step-up bypass (CVE-2026-135768) has no fix yet. Until it does, do not treat a client policy as your only second-factor control.
  • Turn on Keycloak user and admin events. You cannot detect what you do not log.

See what an attacker would find.

Give us a URL and two test logins. If there’s something to find, your first exploited findings land within 24 hours.

You talk to the people who build Hydra and Cerberus. No sales script.

or write to founders@cloudgrip.ai