Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

🐞 Keycloak: mitigate Java4Shell and update to 26.6.4 (meta#15037) - #4279

Closed
edulix wants to merge 1 commit into
mainfrom
fix/java4shell-keycloak-step-main
Closed

edulix wants to merge 1 commit into
mainfrom
fix/java4shell-keycloak-step-main

Conversation

@edulix

@edulix edulix commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Sets ENV JAVA_OPTS_APPEND="-XX:-UseBASE64Intrinsics" in the final stage of packages/Dockerfile.keycloak (and Dockerfile.keycloak-vstl-build), so every deployment of the image gets the Java4Shell mitigation even without gitops changes.
  • Updates the Keycloak base image from 26.6.1 to 26.6.4, the latest 26.6 patch on quay.io. Also updated: the vstl Dockerfiles and the voter-enrollment integration-test Dockerfile. The minor version stays the same. The images are still pinned by tag, as before.
  • The extension poms stay on keycloak.version 26.6.1. com.github.dasniko:keycloak-spi-bom only goes up to 26.6.2 on Maven Central, so bumping the poms breaks the Maven build. The SPI deps are provided, and runtime uses 26.6.4.

Why

Tracking issue: sequentech/meta#15037.

Java4Shell (CVE-2026-114938) is an out-of-bounds heap write in OpenJDK's x86-64 AVX-512 VBMI Base64 decode intrinsic. It affects OpenJDK 17.0.6+ from every vendor. Calif reports pre-auth RCE against Keycloak in its default config. No fixed JDK exists yet. Both keycloak:26.6.1 and keycloak:26.6.4 ship Red Hat OpenJDK 21.0.11.0.10-1, which is still vulnerable. Until there is a fixed JDK, the JVM flag is the mitigation.

  • kc.sh appends JAVA_OPTS_APPEND after its defaults (heap, GC, add-opens). Unlike JAVA_OPTS, it does not replace them. The base image did not set JAVA_OPTS_APPEND before, and neither did this repo, so nothing gets overwritten.
  • A deployment that sets JAVA_OPTS_APPEND in its own env replaces this image value. For that reason the gitops PR sets the flag as well.
  • Calif says the flag breaks JVM startup on ARM. On arm64 with this JDK it does not: HotSpot defines UseBASE64Intrinsics on all architectures. So the flag is used bare, without -XX:+IgnoreUnrecognizedVMOptions, which would hide typos.

Keycloak 26.6.2 → 26.6.4 upgrade notes (from the upstream migration guide)

  • 26.6.2: token introspection now checks that the introspecting client is in aud (opt-out: allow-token-introspection-without-audience-check). UserInfo rejects lightweight access tokens. WebAuthn "Acceptable AAGUIDs" is now strict. Required actions and execute-actions-email tokens are single use. Avoid editing workflow definitions during a rolling update.
  • 26.6.3: valid redirect URIs no longer accept a hostname wildcard (https://host*). I found none in the repo's realm JSONs. The Admin user search no longer returns user-profile metadata. Extensions must not restart a session transaction. The token endpoint token parameter is now capped at 20k chars. Requests with an invalid CORS Origin now get a 403 early.
  • 26.6.4: Java Keystore provider files must be under data/<realm>/. Registration access tokens cannot manage disabled clients.
  • Also fixes many Keycloak CVEs. Among them are CVE-2026-11800 (JWT algorithm confusion auth bypass) and the 26.6.0/26.6.1 exit after async realm migration (keycloak#48438).

Rollout

Merging this PR does not change running deployments. They get the fix when the new Keycloak image is released and rolled out. The gitops PR sets the same flag through env for deployments that are not on this image yet.

Testing

All on an arm64 (aarch64) host:

  • docker buildx build --build-context beyond=<empty dir> -f packages/Dockerfile.keycloak packages builds. The beyond submodule was not available locally, so beyond extensions were not part of the build. CI builds with them.
  • The built image env has JAVA_OPTS_APPEND=-XX:-UseBASE64Intrinsics. java -XX:-UseBASE64Intrinsics -XX:+PrintFlagsFinal -version reports UseBASE64Intrinsics = false {command line}, and true {default} without the flag.
  • start-dev against a throwaway Postgres: kc.sh logs "Appending additional Java properties to JAVA_OPTS", Keycloak 26.6.4 starts (Quarkus 3.33.2.1), the JVM cmdline contains the flag, and /realms/master/.well-known/openid-configuration returns 200.
  • Not tested: x86-64 AVX-512 behaviour (no such hardware here), and a full e2e run.

@coderabbitai review

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Updated Keycloak to version 26.6.4 across the application’s build and runtime environments.
    • Updated runtime Java settings to disable Base64 intrinsics. Deployments that provide their own Java options may override this setting.

Set JAVA_OPTS_APPEND="-XX:-UseBASE64Intrinsics" in the final Keycloak image
stage to disable the vulnerable AVX-512 Base64 decode intrinsic
(CVE-2026-114938). kc.sh appends it to its own defaults. Bump the Keycloak
base image from 26.6.1 to 26.6.4, the latest 26.6 patch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Keycloak image tags change from 26.6.1 to 26.6.4 across five Dockerfiles. Two Dockerfiles also set JAVA_OPTS_APPEND to disable UseBASE64Intrinsics and add comments about the setting.

Changes: Keycloak image updates

Layer / File(s) Summary
Keycloak image version updates
packages/Dockerfile.keycloak, packages/Dockerfile.keycloak-vstl-build, packages/Dockerfile.keycloak-vstl-compile, packages/Dockerfile.keycloak-vstl-dependencies, packages/keycloak-extensions/voter-enrollment/src/test/integration/Dockerfile
Builder, compile, dependency, and integration-test image references change from Keycloak 26.6.1 to 26.6.4.
Runtime JVM options
packages/Dockerfile.keycloak, packages/Dockerfile.keycloak-vstl-build
The runtime image references change to Keycloak 26.6.4. Both Dockerfiles set JAVA_OPTS_APPEND to -XX:-UseBASE64Intrinsics. Comments describe the stated vulnerability context and note that a deployment-provided value replaces this setting.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: belsequent, findeton

Merge Risk: Minimal · up to ca684

This updates Keycloak images to 26.6.4 and disables a JVM Base64 intrinsic as a Java4Shell mitigation. No actionable merge-blocking issue was found. Running deployments are unaffected until the new image is released and rolled out.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names two changes that the changeset makes: mitigating Java4Shell by setting JAVA_OPTS_APPEND to disable UseBASE64Intrinsics, and upgrading Keycloak from 26.6.1 to 26.6.4 across the Dockerfi…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names two changes that the changeset makes: mitigating Java4Shell by setting JAVA_OPTS_APPEND to disable UseBASE64Intrinsics, and upgrading Keycloak from 26.6.1 to 26.6.4 across the Dockerfiles. The raw summary confirms both changes in the Keycloak builder, runtime, VSTL, and integration-test images. The title is specific and matches the main change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d1dcc83 and ca684b2.

Files selected for processing: 5

  • packages/Dockerfile.keycloak
  • packages/Dockerfile.keycloak-vstl-build
  • packages/Dockerfile.keycloak-vstl-compile
  • packages/Dockerfile.keycloak-vstl-dependencies
  • packages/keycloak-extensions/voter-enrollment/src/test/integration/Dockerfile

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

@edulix

edulix commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@edulix

edulix commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #4282, which follows the meta#15038/meta#15039 branch and title conventions.

@edulix edulix closed this Nov 18, 2026
@edulix
edulix deleted the fix/java4shell-keycloak-step-main branch November 18, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant