Repository navigation
Conversation
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>
Contributor
There was a problem hiding this comment.
🔵 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
Contributor
|
Duplicate of #55294. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mitigates CVE-2026-114938 (Java4Shell), an OpenJDK heap corruption in hardware-accelerated
java.util.Base64decoding 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:
This matches the recommended mitigation from Calif and works on all architectures (unlike
-XX:UseAVX=2).Changes
quarkus/dist/src/main/content/bin/kc.sh-XX:-UseBASE64Intrinsicsto defaultJAVA_OPTSquarkus/dist/src/main/content/bin/kc.batoperator/Dockerfilejavaentrypoint (bypasseskc.sh)JavaOptsScriptTestOfficial Keycloak container images use
kc.sh, so they pick up the script change automatically.Related
Closes #55293
Notes
.1builds, etc.) remains the long-term fix; this is a safe defense-in-depth default.Signed-off-by: Sola Ajayi sola.ajayi@gmail.com