Skip to content

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

Closed
shawlz wants to merge 1 commit into
keycloak:mainfrom
shawlz:sa/java4shell-mitigation-a065
Closed

shawlz wants to merge 1 commit into
keycloak:mainfrom
shawlz:sa/java4shell-mitigation-a065

Conversation

@shawlz

@shawlz shawlz commented Nov 18, 2026

Copy link
Copy Markdown

Summary

Mitigates CVE-2026-114938 (Java4Shell), an OpenJDK heap corruption in hardware-accelerated java.util.Base64 decoding on x86-64 CPUs with AVX-512 VBMI. Calif's advisory shows pre-authentication attack surface on default Keycloak configurations (Basic auth, JWTs, SAML).

Until patched JDK builds are common in base container images, disable the vulnerable intrinsic by default:

-XX:-UseBASE64Intrinsics

This matches the recommended mitigation from Calif and works on all architectures (unlike -XX:UseAVX=2).

Changes

Location Change
quarkus/dist/src/main/content/bin/kc.sh Append -XX:-UseBASE64Intrinsics to default JAVA_OPTS
quarkus/dist/src/main/content/bin/kc.bat Same for Windows
operator/Dockerfile Pass flag on operator image java entrypoint (bypasses kc.sh)
JavaOptsScriptTest Assert default opts include the mitigation flag

Official Keycloak container images use kc.sh, so they pick up the script change automatically.

Related

Closes #55293

Notes

  • Patching the JDK (Oracle .1 builds, etc.) remains the long-term fix; this is a safe defense-in-depth default.
  • Performance impact of disabling Base64 intrinsics is expected to be minor relative to authentication workload.

Signed-off-by: Sola Ajayi sola.ajayi@gmail.com

Default Keycloak startup paths decode Base64 before authentication (Basic
auth, JWTs, SAML). On vulnerable OpenJDK builds with AVX-512 VBMI, malformed
input can trigger heap corruption (see https://calif.io/java4shell/).

Add -XX:-UseBASE64Intrinsics to kc.sh, kc.bat, and the operator image
entrypoint until patched JDKs are widely available in base images.

Closes keycloak#55293

Signed-off-by: Sola Ajayi <sola.ajayi@gmail.com>
@shawlz
shawlz requested review from a team as code owners November 18, 2026 09:11
Copilot AI balanced review requested due to automatic review settings November 18, 2026 09:11

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 closing parenthesis in a rem comment inside the kc.bat else block prematurely ends the block in cmd.exe, breaking Windows startup.

No open issues 🎉

What changed in this PR

This PR adds a JVM-level mitigation for the reported Base64 intrinsic vulnerability in #55293, covering Keycloak’s default startup options and the operator container.

Changes:

  • Disable Base64 intrinsics in the default Unix and Windows JVM options.
  • Apply the same flag to the operator’s Java entrypoint.
  • Assert that default startup options include the mitigation flag.
File Description
quarkus/​tests/​integration/​src/​test/​java/​org/​keycloak/​it/​cli/​dist/​JavaOptsScriptTest.java Assert the mitigation flag appears in default JVM options.
quarkus/​dist/​src/​main/​content/​bin/​kc.sh Add the flag to default Unix startup options.
quarkus/​dist/​src/​main/​content/​bin/​kc.bat Add the flag to default Windows startup options.
operator/​Dockerfile Disable Base64 intrinsics in the operator entrypoint.

Review effort: Balanced

@sschu

sschu commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Duplicate of #55294.

@shawlz shawlz closed this Nov 18, 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)

3 participants