diff --git a/CHANGELOG.md b/CHANGELOG.md index 31292a1..0a29847 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ workflow refuses a tag whose version has no entry here. ## [Unreleased] +### Security + +- **Java4Shell (CVE-2026-114938) mitigated** (urbforge/urbex-cli#130): Keycloak's JVM, and the images of `runtime: java`, start with `-XX:-UseBASE64Intrinsics`, which turns off the OpenJDK Base64 intrinsic that corrupts memory on x86-64 CPUs with AVX-512 VBMI. Keycloak decodes Base64 before login, and its realms are public with Cloudflare. Run `urbex bootstrap` to apply it to an existing platform, and the `runtime: java` services get it with their next build (a push to `main` for staging, then a release for production). A Keycloak image with a fixed OpenJDK will follow when one is published. + ## [0.1.0] - 2026-11-17 The first preview release: urbex as binaries for Linux and macOS (amd64, diff --git a/e2e/run.sh b/e2e/run.sh index 5fd61ac..d29da3f 100755 --- a/e2e/run.sh +++ b/e2e/run.sh @@ -212,6 +212,9 @@ step "bootstrap: base services and platform setup" ' [ "$(komodo_stack_state urbex-telemetry-$host)" = running ] || fail "telemetry stack of $host: $(komodo_stack_state urbex-telemetry-$host)" [ "$(komodo_tags Stack urbex-telemetry-$host)" = agent ] || fail "telemetry stack of $host tags: $(komodo_tags Stack urbex-telemetry-$host)" done + # Java4Shell (urbforge/urbex-cli#130): Keycloak'"'"'s JVM runs without + # the Base64 intrinsic (its processes, as the host sees them). + ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -q root@$NET.203 "docker ps -q --filter label=urbex.service=keycloak | xargs -n1 docker top" | grep -q -- "-XX:-UseBASE64Intrinsics" || fail "keycloak runs its JVM with the Base64 intrinsic" for svc in keycloak observability; do grep -q "^sops_" /work/gitops/platform/$svc/secrets.sops.env || fail "platform/$svc/secrets.sops.env is not sops-encrypted" done diff --git a/internal/bootstrap/public_test.go b/internal/bootstrap/public_test.go index 7861eb8..2be1110 100644 --- a/internal/bootstrap/public_test.go +++ b/internal/bootstrap/public_test.go @@ -463,3 +463,20 @@ func TestBaseServicesAreInTheCatalog(t *testing.T) { } } } + +// Java4Shell (urbforge/urbex-cli#130): Keycloak's JVM starts without +// the Base64 intrinsic, from the Stack's config.env. +func TestRun_KeycloakWithoutBase64Intrinsics(t *testing.T) { + dir := t.TempDir() + o, _, _ := newRunOrchestrator(t, &fakeProxmox{}) + if err := o.Run(context.Background(), Options{GitOpsRepoPath: dir}); err != nil { + t.Fatalf("Run: %v", err) + } + env, err := os.ReadFile(filepath.Join(dir, "platform/keycloak/config.env")) + if err != nil { + t.Fatal(err) + } + if !strings.Contains(string(env), "\nJAVA_OPTS_APPEND=-XX:-UseBASE64Intrinsics\n") { + t.Errorf("keycloak config.env has no JAVA_OPTS_APPEND:\n%s", env) + } +} diff --git a/internal/bootstrap/stacks.go b/internal/bootstrap/stacks.go index c206f57..56fb80f 100644 --- a/internal/bootstrap/stacks.go +++ b/internal/bootstrap/stacks.go @@ -63,6 +63,11 @@ func (o *Orchestrator) platformStacks(tunnelToken string) []PlatformStack { "POSTGRES_DB": keycloakDBName, "POSTGRES_USER": keycloakDBUser, "KC_BOOTSTRAP_ADMIN_USERNAME": "admin", + // Java4Shell (CVE-2026-114938, urbforge/urbex-cli#130): OpenJDK's + // Base64 intrinsic on CPUs with AVX-512 VBMI corrupts memory, and + // Keycloak decodes Base64 before login. Off until a fixed image; + // kc.sh appends it to the JVM's options. + "JAVA_OPTS_APPEND": JavaMitigationFlags, // Production mode wants HTTPS; TLS ends before Keycloak - at // Cloudflare, or nowhere on the LAN. "KC_HTTP_ENABLED": "true", @@ -99,6 +104,12 @@ func (o *Orchestrator) platformStacks(tunnelToken string) []PlatformStack { return stacks } +// JavaMitigationFlags are the JVM flags every JVM Urbex runs gets: +// Keycloak, and the images of `runtime: java` (platform/dockerfiles). +// -XX:-UseBASE64Intrinsics mitigates Java4Shell (CVE-2026-114938, +// urbforge/urbex-cli#130) until the images carry a fixed OpenJDK. +const JavaMitigationFlags = "-XX:-UseBASE64Intrinsics" + // Keycloak's database and its owner, in the Keycloak Stack's PostgreSQL. const ( keycloakDBName = "keycloak" diff --git a/platform/dockerfiles/java.Dockerfile b/platform/dockerfiles/java.Dockerfile index 1d30b95..88ee394 100644 --- a/platform/dockerfiles/java.Dockerfile +++ b/platform/dockerfiles/java.Dockerfile @@ -16,6 +16,11 @@ FROM docker.io/library/eclipse-temurin:21-jre RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y --no-install-recommends wget \ && rm -rf /var/lib/apt/lists/* COPY --from=build /app.jar /app/app.jar +# Java4Shell (CVE-2026-114938, urbforge/urbex-cli#130): OpenJDK's Base64 +# intrinsic corrupts memory on CPUs with AVX-512 VBMI; off until a fixed +# JRE. The JVM reads JAVA_TOOL_OPTIONS; an app that sets its own replaces +# it, and should keep this flag. +ENV JAVA_TOOL_OPTIONS="-XX:-UseBASE64Intrinsics" RUN useradd --no-create-home app USER app ENTRYPOINT ["java", "-jar", "/app/app.jar"]