From 330e8c516fb8126cc59338bb38da9b0ae76c7be4 Mon Sep 17 00:00:00 2001 From: Andrey Kolkov Date: Fri, 20 Nov 2026 15:54:15 +0700 Subject: [PATCH] fix(opensearch): disable the Base64 intrinsics hit by CVE-2026-114938 CVE-2026-114938 is an out-of-bounds write in the AVX-512 VBMI Base64 decoder of OpenJDK 17.0.6 and later, reachable on x86-64 hosts with attacker-supplied Base64. OpenSearch decodes the Basic credentials of a request before it authenticates it, so a tenant's cluster is exposed to anyone who can reach its HTTP port. Two of the three versions this chart offers bundle an affected JDK: opensearchproject/opensearch:3.0.0 carries 21.0.7 and 2.11.1 carries 17.0.8. 1.3.20 carries 11.0.25, which is not affected. OpenSearch has not released a build on a patched JDK yet. Start the nodes with -XX:-UseBASE64Intrinsics, which removes the vulnerable code path and leaves the other AVX-512 optimizations in place. It is delivered as a jvm.options.d file mounted from a ConfigMap, because neither obvious route works: bin/opensearch-env unsets JAVA_TOOL_OPTIONS, and setting nodePools[].jvm makes the operator stop sizing the heap from the memory request. The operator mounts general.additionalVolumes into the node pools and the bootstrap pod alike. Rolling this out restarts every OpenSearch cluster once. Tested with helm unittest, and by starting 3.0.0, 2.11.1 and 1.3.20 with the file mounted: each server JVM runs with the flag, and the heap passed in OPENSEARCH_JAVA_OPTS still applies. Assisted-by: LLM Signed-off-by: Andrey Kolkov (cherry picked from commit 65f09437101511ab88b88b50df2d925afb8c0744) Signed-off-by: Myasnikov Daniil --- .../opensearch/templates/jvm-options.yaml | 11 +++++ .../apps/opensearch/templates/opensearch.yaml | 12 ++++++ .../opensearch/tests/jvm_options_test.yaml | 42 +++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 packages/apps/opensearch/templates/jvm-options.yaml create mode 100644 packages/apps/opensearch/tests/jvm_options_test.yaml diff --git a/packages/apps/opensearch/templates/jvm-options.yaml b/packages/apps/opensearch/templates/jvm-options.yaml new file mode 100644 index 000000000..7228c53b2 --- /dev/null +++ b/packages/apps/opensearch/templates/jvm-options.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-jvm-options +data: + # -XX:-UseBASE64Intrinsics turns off the AVX-512 Base64 decoder hit by + # CVE-2026-114938: OpenSearch decodes the Basic credentials of a request + # before it authenticates it, and the image may bundle an OpenJDK that + # predates the fix. + cozystack.options: | + -XX:-UseBASE64Intrinsics diff --git a/packages/apps/opensearch/templates/opensearch.yaml b/packages/apps/opensearch/templates/opensearch.yaml index adcdb63ad..96632ec6d 100644 --- a/packages/apps/opensearch/templates/opensearch.yaml +++ b/packages/apps/opensearch/templates/opensearch.yaml @@ -13,6 +13,18 @@ spec: serviceName: {{ .Release.Name }} version: {{ include "opensearch.versionMap" $ }} httpPort: 9200 + {{- /* + JVM options go in as a jvm.options.d file because neither other route works: + bin/opensearch-env unsets JAVA_TOOL_OPTIONS, and setting nodePools[].jvm makes + the operator stop sizing the heap from the memory request. + */}} + additionalVolumes: + - name: jvm-options + path: /usr/share/opensearch/config/jvm.options.d/cozystack.options + subPath: cozystack.options + restartPods: true + configMap: + name: {{ .Release.Name }}-jvm-options setVMMaxMapCount: true drainDataNodes: true {{- if gt (len .Values.images.opensearch) 0 }} diff --git a/packages/apps/opensearch/tests/jvm_options_test.yaml b/packages/apps/opensearch/tests/jvm_options_test.yaml new file mode 100644 index 000000000..8195ee1d8 --- /dev/null +++ b/packages/apps/opensearch/tests/jvm_options_test.yaml @@ -0,0 +1,42 @@ +suite: opensearch JVM options + +release: + name: test-os + namespace: tenant-test + +set: + _cluster: + cluster-domain: cozy.local + +tests: + - it: ships the Base64 intrinsics switch as a jvm.options.d file + template: templates/jvm-options.yaml + asserts: + - isKind: + of: ConfigMap + - equal: + path: metadata.name + value: test-os-jvm-options + - equal: + path: data["cozystack.options"] + value: | + -XX:-UseBASE64Intrinsics + + - it: mounts that file into every pod of the cluster + template: templates/opensearch.yaml + documentSelector: + path: kind + value: OpenSearchCluster + asserts: + - contains: + path: spec.general.additionalVolumes + content: + name: jvm-options + path: /usr/share/opensearch/config/jvm.options.d/cozystack.options + subPath: cozystack.options + restartPods: true + configMap: + name: test-os-jvm-options + # setting jvm would stop the operator sizing the heap from the memory request + - notExists: + path: spec.nodePools[0].jvm