fix(opensearch): disable the Base64 intrinsics hit by CVE-2026-114938 (#5373)

## What this PR does

CVE-2026-114938 ("Java4Shell") is an out-of-bounds write in the AVX-512
VBMI Base64 decoder of OpenJDK 17.0.6 and later. OpenSearch decodes the
Basic credentials of a request before it authenticates it, so on an
x86-64 node with AVX-512 VBMI a tenant's cluster can be attacked by
anyone who reaches its HTTP port.

Two of the three versions the `opensearch` application offers bundle an
affected JDK, and OpenSearch has not released a build on a patched one
yet:

| Image | Bundled JDK | Affected |
|---|---|---|
| `opensearchproject/opensearch:3.0.0` | 21.0.7 | yes |
| `opensearchproject/opensearch:2.11.1` | 17.0.8 | yes |
| `opensearchproject/opensearch:1.3.20` | 11.0.25 | no |

This PR starts the nodes with `-XX:-UseBASE64Intrinsics`, the mitigation
[RHSB-2026-018](https://access.redhat.com/security/vulnerabilities/RHSB-2026-018)
recommends: it removes the vulnerable code path and keeps the other
AVX-512 optimizations.

The flag is delivered as a `jvm.options.d` file mounted from a ConfigMap
through `general.additionalVolumes`, because neither obvious route
works:

- `bin/opensearch-env` unsets `JAVA_TOOL_OPTIONS`, so an env var never
reaches the JVM;
- setting `nodePools[].jvm` makes the operator stop sizing the heap from
the memory request and use the string as is.

The operator mounts `general.additionalVolumes` into the node pools and
the bootstrap pod alike, and `restartPods` restarts them when the file
changes.

Verified by starting 3.0.0, 2.11.1 and 1.3.20 with the file mounted:
each server JVM runs with `-XX:-UseBASE64Intrinsics`, and the heap
passed in `OPENSEARCH_JAVA_OPTS` still applies after it. `helm unittest`
passes (156 tests), including a new suite. Not tested through the
operator on a live cluster.

Notes for the reviewer:

- This is a mitigation, not a fix. A version bump has to wait for an
OpenSearch release on a patched JDK.
- Upgrading restarts every OpenSearch cluster once.
- The securityadmin update Job is left alone: it is a client and accepts
no inbound connections. OpenSearch Dashboards is Node.js.
- The commit picks onto `release-1.7` cleanly and conflicts in
`templates/opensearch.yaml` on `release-1.6` (checked with a merge-tree
dry run).

### Screenshots

N/A — no UI changes.

### Downstream repositories

Walked the trigger map against the diff: one template, one new template
and one unit test under `packages/apps/opensearch`; no values key,
`values.schema.json`, README, version enum or default changes.

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

```release-note
fix(opensearch): mitigate CVE-2026-114938 (Java4Shell) by starting OpenSearch nodes with -XX:-UseBASE64Intrinsics, which disables the vulnerable OpenJDK Base64 decoder. Every OpenSearch cluster restarts once on upgrade.
```

Backported-from: 026b015635
This commit is contained in:
Myasnikov Daniil committed 2026-11-25 09:58:12 +00:00
commit e23dd27c27
3 files changed
+65

No files matched your search

@@ -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
@@ -17,6 +17,18 @@ spec:
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
{{- /*
The operator's own way to raise vm.max_map_count is a privileged init
container in every OpenSearch pod, and the PodSecurity level tenant
namespaces run at refuses that before any pod exists. The sysctl comes from
@@ -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