Skip to content

fix(jres): disable Base64 intrinsics on OpenJDK JREs that are not updated yet - #1561

Merged
stokpop merged 4 commits into
cloudfoundry:mainfrom
stokpop:base64-intrinsics-mitigation
Nov 18, 2026
Merged

stokpop merged 4 commits into
cloudfoundry:mainfrom
stokpop:base64-intrinsics-mitigation

Conversation

@stokpop

@stokpop stokpop commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Adds -XX:-UseBASE64Intrinsics for the OpenJDK (Liberica) JRE while the installed JRE is older than the first release with the fix for CVE-2026-114938 (a heap overflow in the AVX-512 Base64 decoder of HotSpot on x86-64). Temporary: once the manifest ships fixed JREs, the option is no longer added.

  • The version is read from the release file of the JRE. Fixed releases: 17.0.21.1, 21.0.13.1 and 25.0.5.1. Not added for Java 8 and 11, for 17.0.0 to 17.0.5, or for Zulu and SapMachine (already fixed in the manifest).
  • The option goes into JAVA_OPTS and into JDK_JAVA_OPTIONS (profile.d script, existing value kept), so custom start commands, tasks and cf ssh are covered too. JAVA_TOOL_OPTIONS is not used: a Java 8 JVM refuses to start with the option in it, while Java 8 ignores JDK_JAVA_OPTIONS.
  • Opt out with JBP_CONFIG_OPEN_JDK_JRE '{base64_intrinsics_mitigation: {enabled: false}}', or keep only JAVA_OPTS with {base64_intrinsics_mitigation: {jdk_java_options: false}} (the java launcher prints a NOTE: Picked up JDK_JAVA_OPTIONS line on stderr). The JRE docs describe both.

Tested: unit tests, and Docker (cflinuxfs4, zip from this branch) on Java 8, 11, 17, 21 and 25, with a custom start command, both opt-outs, and the fixed Zulu and SapMachine releases. Also on a Cloud Foundry test system with the build from this branch: the flag is on the command line of the app's JVM, JDK_JAVA_OPTIONS is in the environment of the app and of a cf run-task task, and on a host with UseAVX = 3 the intrinsic goes from true {default} to false with the option set. Not tested: triggering the overflow itself, and that Liberica uses the same fixed numbers as Zulu and SapMachine (the table is in base64_mitigation.go). No integration test is added, because the mitigation is temporary.

…ated yet

Add -XX:-UseBASE64Intrinsics to JAVA_OPTS, and to JDK_JAVA_OPTIONS through a
profile.d script, for the OpenJDK JRE while its version is below the first
release that fixes CVE-2026-114938. JDK_JAVA_OPTIONS covers java processes that
do not use JAVA_OPTS, and Java 8 ignores it, unlike JAVA_TOOL_OPTIONS.

Opt out with base64_intrinsics_mitigation.enabled: false, or keep only the
JAVA_OPTS part with base64_intrinsics_mitigation.jdk_java_options: false in
JBP_CONFIG_OPEN_JDK_JRE.

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.

🟡 Changes recommended

The mitigation lookup ignores the supported JBP_CONFIG_OPENJDK configuration name, silently leaving the mitigation enabled when users disable it through that name.

1 open issue
What changed in this PR

Adds a temporary Base64 intrinsics mitigation for affected OpenJDK (Liberica) runtimes in the Java buildpack, with version-based expiry and application opt-outs.

Changes:

  • Checks the installed JRE version and adds -XX:-UseBASE64Intrinsics when mitigation is needed.
  • Applies the option through JAVA_OPTS and an optional JDK_JAVA_OPTIONS profile script.
  • Adds unit tests and documents configuration, coverage, and launcher stderr behavior.
File Description
src/​java/​jres/​openjdk.go Enables mitigation for OpenJDK.
src/​java/​jres/​base64_mitigation.go Implements version checks, opt-outs, and option publication.
src/​java/​jres/​base64_mitigation_test.go Tests version boundaries, configuration, and profile behavior.
src/​java/​jres/​base_jre.go Invokes mitigation during JRE finalization.
docs/​jre-open_jdk_jre.md Documents mitigation behavior and opt-outs.

Review effort: Balanced

Comment thread src/java/jres/base64_mitigation.go Resolved
… too

JBP_CONFIG_OPENJDK is a supported configuration name and takes precedence over
JBP_CONFIG_OPEN_JDK_JRE in the version selection. The opt-out now uses the same
precedence, so disabling the mitigation through that name is no longer ignored.
@stokpop

stokpop commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, good catch. The opt-out now follows the same precedence as the version selection: JBP_CONFIG_OPENJDK first, then JBP_CONFIG_OPEN_JDK_JRE. Tests cover both names, a conflict between them, and the fallback. Fixed in d5e27a53.

…he Base64 option

A plain cf ssh session does not run the profile.d scripts, so JDK_JAVA_OPTIONS is not set there. Apps are not affected: their JVM and custom start commands are started through the launcher.
Checked on a Cloud Foundry test system: a task run with cf run-task gets JDK_JAVA_OPTIONS, like the app JVM.
@stokpop
stokpop requested a balanced review from Copilot November 18, 2026 12:41
@stokpop
stokpop marked this pull request as ready for review November 18, 2026 12:41

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

Automatic removal of the security mitigation relies on unverified Liberica version cutoffs, requiring human confirmation of fix provenance and release-file version values.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@stokpop
stokpop merged commit 09b81eb into cloudfoundry:main Nov 18, 2026
1 check passed
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.

3 participants

⌂ Proxy