mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-11-20 06:16:52 +00:00
Mitigate Java4Shell by disabling UseBASE64Intrinsics for Java 17 and later versions (#4400)
This commit is contained in:
1 parent
99f8c589d3
commit
22613f0349
2 files changed
+14
-3
No files matched your search
@@ -160,3 +160,7 @@ When `MEMORY` is greater than or equal to 12G, then the Aikar flags will be adju
|
|||||||
The set of flags documented there can be added by setting the environment variable `USE_MEOWICE_FLAGS` to `true`. There is an optional `USE_MEOWICE_GRAALVM_FLAGS` variable to enable GraalVM specific optimizations, defaults to `FALSE`.
|
The set of flags documented there can be added by setting the environment variable `USE_MEOWICE_FLAGS` to `true`. There is an optional `USE_MEOWICE_GRAALVM_FLAGS` variable to enable GraalVM specific optimizations, defaults to `FALSE`.
|
||||||
|
|
||||||
MeowIce's flags use the G1 garbage collector by default. MeowIce also provides a [ZGC version of the flags](https://github.com/MeowIce/meowice-flags#zgc-version-for-large-servers-with-32gb-allocated-heap), which is recommended for servers with 32GB or more of allocated memory and many CPU cores. To use it instead, also set `USE_MEOWICE_ZGC_FLAGS` to `true`. When `MAX_MEMORY` (or `MEMORY`) is larger than 2GB, the soft max heap size is set to 2GB below it, as in MeowIce's flags.
|
MeowIce's flags use the G1 garbage collector by default. MeowIce also provides a [ZGC version of the flags](https://github.com/MeowIce/meowice-flags#zgc-version-for-large-servers-with-32gb-allocated-heap), which is recommended for servers with 32GB or more of allocated memory and many CPU cores. To use it instead, also set `USE_MEOWICE_ZGC_FLAGS` to `true`. When `MAX_MEMORY` (or `MEMORY`) is larger than 2GB, the soft max heap size is set to 2GB below it, as in MeowIce's flags.
|
||||||
|
|
||||||
|
## Mitigating Java4Shell exploit (CVE-2026-114938)
|
||||||
|
|
||||||
|
By default the image will mitigate the Java4Shell exploit (CVE-2026-114938) by disabling `UseBASE64Intrinsics` with `-XX:-UseBASE64Intrinsics` when using Java 17 or later. This can be disabled by setting the environment variable `FIX_JAVA4SHELL_EXPLOIT` to `false`.
|
||||||
@@ -5,9 +5,7 @@
|
|||||||
: "${USE_MEOWICE_GRAALVM_FLAGS:=false}"
|
: "${USE_MEOWICE_GRAALVM_FLAGS:=false}"
|
||||||
: "${USE_MEOWICE_ZGC_FLAGS:=false}"
|
: "${USE_MEOWICE_ZGC_FLAGS:=false}"
|
||||||
|
|
||||||
if isTrue "${USE_MEOWICE_FLAGS}" || isTrue "${USE_MEOWICE_GRAALVM_FLAGS}"; then
|
java_major_version=$(mc-image-helper java-release)
|
||||||
java_major_version=$(mc-image-helper java-release)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if isTrue "${USE_MEOWICE_FLAGS}"; then
|
if isTrue "${USE_MEOWICE_FLAGS}"; then
|
||||||
if [[ $java_major_version -gt 16 ]]; then
|
if [[ $java_major_version -gt 16 ]]; then
|
||||||
@@ -235,3 +233,12 @@ if isTrue "${USE_SIMD_FLAGS}"; then
|
|||||||
--add-modules=jdk.incubator.vector
|
--add-modules=jdk.incubator.vector
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# if java >= 17, mitigate Java4Shell exploit (CVE-2026-114938) by disabling UseBASE64Intrinsics with
|
||||||
|
# -XX:-UseBASE64Intrinsics
|
||||||
|
if [[ $java_major_version -ge 17 ]] && isTrue "${FIX_JAVA4SHELL_EXPLOIT:-true}"; then
|
||||||
|
JVM_XX_OPTS="${JVM_XX_OPTS}
|
||||||
|
-XX:-UseBASE64Intrinsics
|
||||||
|
"
|
||||||
|
log "Disabling UseBASE64Intrinsics to mitigate Java4Shell exploit (CVE-2026-114938)"
|
||||||
|
fi
|
||||||
Reference in new issue
Block a user