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

🐞 Mitigate Java4Shell in the Keycloak image (release/10.1) - #4275

Closed
edulix wants to merge 1 commit into
release/10.1from
fix/java4shell-keycloak-step-r10.1
Closed

edulix wants to merge 1 commit into
release/10.1from
fix/java4shell-keycloak-step-r10.1

Conversation

@edulix

@edulix edulix commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Parent issue: https://github.com/sequentech/meta/issues/15037

Summary

  • The final stage of packages/Dockerfile.keycloak and packages/Dockerfile.keycloak-vstl-build now sets ENV JAVA_OPTS_APPEND="-XX:-UseBASE64Intrinsics". This turns off the vulnerable x86-64 AVX-512 Base64 decode intrinsic.
  • Keycloak stays on 26.7.5 (same digest, sha256:37dbaf6f…) because that is already the latest 26.7 patch on quay.io (26.7.5-0 has the same digest). The image ships Red Hat OpenJDK 21.0.12.1, which is still vulnerable. No fixed JDK or Keycloak image exists yet, so this PR has no upgrade notes.

Why

Java4Shell (CVE-2026-114938, https://calif.io/java4shell/): Calif reports pre-auth RCE against Keycloak in its default config on x86-64 hosts with AVX-512 VBMI. Tracking: https://github.com/sequentech/meta/issues/15037.

Notes:

  • kc.sh appends JAVA_OPTS_APPEND to its default JAVA_OPTS, so the defaults stay in place. Setting JAVA_OPTS would replace them.
  • kc.sh appends JAVA_OPTS_APPEND even when JAVA_OPTS is set in the deployment env, so the flag still reaches the JVM where gitops replaces JAVA_OPTS. A deployment env JAVA_OPTS_APPEND overrides this image ENV, so it must keep the flag. The gitops PR (sequentech/gitops#12532) sets the same value in the deployment env, which also covers image tags built before this change.
  • Calif warns the flag breaks startup on ARM. I tested this on aarch64 with this JDK and it does not: -XX:-UseBASE64Intrinsics is accepted (only -XX:UseAVX=2 is rejected). I left out -XX:+IgnoreUnrecognizedVMOptions so that typos in other options still fail loudly.
  • No release-notes change: this is a support PR on a release branch, and its release notes come from the meta issue.

Rollout

Merge, build and deploy the Keycloak image as usual. Keycloak config does not change. Remove the flag once a fixed Red Hat JDK lands in an upstream Keycloak image.

Testing

  • Native arm64 build: docker buildx build --build-context beyond=<empty dir> -f packages/Dockerfile.keycloak packages succeeded (the private beyond extensions were not included).
  • java -XX:-UseBASE64Intrinsics -XX:+PrintFlagsFinal -version in the built image prints UseBASE64Intrinsics = false {command line}.
  • start-dev with the image ENV: kc.sh logs "Appending additional Java properties to JAVA_OPTS", the JVM command line includes -XX:-UseBASE64Intrinsics, and Keycloak 26.7.5 started.
  • The amd64 manifest of the pinned digest ships the same Red Hat OpenJDK 21.0.12.1 (checked from its release file).
  • Not tested on x86-64 AVX-512 hardware.

@coderabbitai review

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Updated Keycloak runtime settings to avoid a problematic Base64 optimization on x86-64 systems. The setting is also accepted on ARM-based systems, keeping the configuration compatible across architectures.
    • Deployments that override Java runtime options should retain this setting to preserve the updated behavior.

Set JAVA_OPTS_APPEND=-XX:-UseBASE64Intrinsics in the final stage of the
Keycloak images to disable the vulnerable AVX-512 Base64 decode intrinsic
(CVE-2026-114938). kc.sh appends it to its default JAVA_OPTS. The base
image stays on 26.7.5, already the latest 26.7 patch.

Refs sequentech/meta#15037

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

Both Keycloak Dockerfiles now set JAVA_OPTS_APPEND to disable UseBASE64Intrinsics. Their comments describe the setting’s architecture and deployment caveats.

Changes: Keycloak Intrinsic Setting

Layer / File(s) Summary
Set JVM option in Keycloak images
packages/Dockerfile.keycloak, packages/Dockerfile.keycloak-vstl-build
Both Dockerfiles set JAVA_OPTS_APPEND to -XX:-UseBASE64Intrinsics. Comments describe the x86-64 intrinsic, aarch64 support, and the effect of deployments overriding JAVA_OPTS_APPEND.

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

Possibly related PRs

  • sequentech/step#3577: Updates the Keycloak image pin on release/10.0; this PR adds the JVM option to Keycloak Dockerfiles on release/10.1.

Suggested reviewers: findeton, belsequent

Merge Risk: Minimal · up to e68b3

This adds a JVM flag to the Keycloak images to disable a vulnerable Base64 intrinsic. No concrete merge-blocking risk was found. Deployments that set their own JAVA_OPTS_APPEND must keep the flag, as the PR already documents.

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 the main change: mitigating Java4Shell in the Keycloak image by setting JAVA_OPTS_APPEND to -XX:-UseBASE64Intrinsics. The raw summary and PR objectives both describe this change to pac…
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 the main change: mitigating Java4Shell in the Keycloak image by setting JAVA_OPTS_APPEND to -XX:-UseBASE64Intrinsics. The raw summary and PR objectives both describe this change to packages/Dockerfile.keycloak and packages/Dockerfile.keycloak-vstl-build. The title also names the release/10.1 target branch. The emoji prefix is noise, but it does not make the title misleading.

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 4528ccb and e68b3a4.

Files selected for processing: 2

  • packages/Dockerfile.keycloak
  • packages/Dockerfile.keycloak-vstl-build

Included review availability: This review used your included allowance. 3 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 #4283, 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-r10.1 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