Skip to content

Mitigate CVE-2026-114938 (Java4Shell) by disabling Base64 intrinsics - #55294

Closed
Diogo-Rego wants to merge 1 commit into
keycloak:mainfrom
Diogo-Rego:fix/cve-2026-114938-java4shell-mitigation
Closed

Diogo-Rego wants to merge 1 commit into
keycloak:mainfrom
Diogo-Rego:fix/cve-2026-114938-java4shell-mitigation

Conversation

@Diogo-Rego

Copy link
Copy Markdown

This PR disables OpenJDK hardware-accelerated Base64 decoding intrinsics (-XX:-UseBASE64Intrinsics) in default JVM options across kc.sh, kc.bat, and the Keycloak Operator Dockerfile.

This mitigates the critical CVE-2026-114938 (Java4Shell), which affects HotSpot C2 compiler Base64 intrinsics on x86-64 CPUs with AVX-512 VBMI instruction support. In default configurations, processing malformed Base64 data prior to authentication (such as HTTP Authorization: Basic headers, SAML assertions, and JWTs) can trigger an out-of-bounds write / memory corruption.

Disabling the intrinsic serves as the recommended mitigation until vendor-patched OpenJDK packages are broadly distributed in base container images.

Related Issue

Closes #55293

Verification & Testing

  • Verified that kc.sh injects -XX:-UseBASE64Intrinsics into the active JVM process (/proc/1/cmdline).
  • Verified that OAuth2 / OIDC token issuance, JWT handling, and realm operations continue functioning normally.
  • Verified that malformed Base64 authentication payloads are safely rejected without JVM crashes.

@Diogo-Rego
Diogo-Rego requested review from a team as code owners November 17, 2026 23:20
Copilot AI balanced review requested due to automatic review settings November 17, 2026 23:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

An unescaped parenthesis breaks the Windows launcher's option-selection control flow, and shared launcher tests lack an explicit assertion protecting the security mitigation.

No open issues 🎉

What changed in this PR

This PR adds JVM defaults intended to mitigate the reported Base64 intrinsic vulnerability in Keycloak server launchers and the Operator process.

Changes:

  • Add -XX:-UseBASE64Intrinsics and explanatory comments to the Unix and Windows launcher defaults.
  • Add the same flag to the Operator container’s Java entrypoint.
File Description
quarkus/​dist/​src/​main/​content/​bin/​kc.sh Disables Base64 intrinsics in default Unix JVM options.
quarkus/​dist/​src/​main/​content/​bin/​kc.bat Adds the mitigation to default Windows JVM options.
operator/​Dockerfile Disables Base64 intrinsics for the Operator JVM.

Review effort: Balanced

Disables OpenJDK hardware-accelerated Base64 intrinsics in default JVM options
to protect against heap out-of-bounds write / memory corruption (CVE-2026-114938)
on x86-64 processors supporting AVX-512 VBMI instructions.

Closes keycloak#55293

Signed-off-by: Diogo Rego <diego.arruda.amaral@gmail.com>
@Diogo-Rego
Diogo-Rego force-pushed the fix/cve-2026-114938-java4shell-mitigation branch from 729bec7 to 783a39a Compare November 17, 2026 23:28
Copilot AI balanced review requested due to automatic review settings November 17, 2026 23:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the change disabling JVM Base64 intrinsics by default.

No open issues 🎉

Review effort: Balanced

@stianst stianst self-assigned this Nov 18, 2026
@stianst

stianst commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR; for now we are not planning on doing a release with enabling -XX:-UseBASE64Intrinsics, but I will leave this PR open for now.

Update container images will be released as soon as OpenJDK fixes are available, we are actively monitoring that and will do a re-spin of container images as soon as possible.

In the meantime we recommend everyone applying the mitigation (JAVA_OPTS_APPEND=-XX:-UseBASE64Intrinsics) as soon as possible to their Keycloak deployments.

@stianst

stianst commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Keycloak container images for 26.8 have been updated to Red Hat OpenJDK 21.0.13.1, which includes fixes for CVE-2026-114938.

The updated tags include latest, 26.8, and 26.8.2-3.

If you are not using the container images or building your own check if your OpenJDK vendor has released updates. Fixed
versions include 17.0.21.1, 21.0.13.1, 25.0.5.1 and 27.0.1.1. Older releases of OpenJDK 17, 21, and 25 are affected.

As of publishing Oracle and Red Hat have released updates. Eclipse Temurin
for Linux have been released, while other platforms are in-progress
.

@stianst stianst closed this Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CVE-2026-114938] Mitigate OpenJDK Base64 intrinsic vulnerability (CVE-2026-114938 / Java4Shell)

4 participants