vulnerability management

Java4Shell: detect Java exposure and put mitigation into effect

November 18, 2026
Java4Shell exposure needs more than a version check. Compare Windows and Linux detection scripts, understand mitigation, and verify affected Java services.

Java4Shell (CVE-2026-114938) is a memory-corruption vulnerability in an accelerated Base64 decoding path in OpenJDK HotSpot. On affected runtimes and hardware, attacker-controlled input can lead to code execution inside a Java application. Remediation teams need to identify the runtime each application actually uses, apply a supported update or interim mitigation, and verify the running process afterward. Red Hat security bulletin

Vicarius provides Windows and Linux detection scripts for this CVE, reproduced below, plus a separate Windows mitigation script in vSociety. The detection scripts report exposure; the Windows mitigation script applies a JVM configuration change and handles eligible service restarts. That distinction matters: a successful scan does not change a vulnerable process. Vicarius Windows mitigation post

What is Java4Shell?

The disclosed name is Java4Shell. The affected component is the Java runtime, specifically HotSpot's optimized Base64 decoder, rather than a library that can be removed from an application's dependency list.

Base64 represents binary data as text. Applications use it in credentials, tokens, and messages. HotSpot can accelerate decoding with processor-specific instructions. The reported flaw is in the x86-64 AVX-512 VBMI path: malformed padding can cause a write beyond the intended output buffer. Java rejecting the malformed input afterward does not undo memory corruption that has already occurred. Calif's original research

The practical unit of investigation is therefore an application, its loaded JVM, and its execution environment. Checking the Java executable in an administrator's shell can miss a runtime bundled with a product or loaded by a service wrapper.

How can it be exploited?

An attacker must reach an application path that passes attacker-controlled Base64 data to the affected decoder. The resulting memory corruption can become a route to memory disclosure or remote code execution. Calif reports pre-authentication demonstrations against applications including Keycloak, Jira, Confluence, and Jenkins. It also states that exploitation is application-specific rather than a universal payload. Original research and demonstrations

These demonstrations establish that the bug can have serious application-level consequences. They do not establish that every installation of a named product is exploitable, or that those organizations have experienced attacks. The sources reviewed for this article do not establish confirmed exploitation in the wild. Treat that as an evidence boundary, not reassurance.

For triage, record the application's exact JVM build, CPU capabilities, effective startup options, and reachable decoding paths. Give externally reachable services and authentication infrastructure early attention. A runtime finding should lead to an assigned remediation action, not stop at a severity label.

Which systems need investigation?

Red Hat identifies affected OpenJDK deployments on x86-64 hardware supporting AVX-512 VBMI, and distinguishes Java 8 and 11 as unaffected by this code path. Its bulletin also highlights bundled runtimes and container images. Consult the runtime or application vendor for the fixed package appropriate to that deployment. Red Hat affected products and mitigation guidance

The supplied Vicarius scripts use version thresholds, runtime discovery, and mitigation-option checks. Their encoded fixed-build floors are 17.0.21.1, 21.0.13.1, 25.0.5.1, and 27.0.1.1. Those are the scripts' comparison rules, not a universal package-selection table for every Java distributor. Both scripts warn that a vendor backport without a corresponding version increase can be reported as vulnerable.

Both also deliberately report affected, unmitigated Java without using the current CPU as a verdict gate. Their rationale is that a workload or virtual machine can move to different hardware. Read VULNERABLE|TRUE as the detector's conservative exposure finding, not proof of a working remote exploit against that application.

How Vicarius helps move from detection to mitigation

The vSociety Windows mitigation script applies the interim setting:


-XX:-UseBASE64Intrinsics

This disables the accelerated Base64 implementation. Red Hat documents it as the preferred interim flag, with -XX:UseAVX=2 as a broader alternative limited to x86-64 deployments. A supported runtime update remains the permanent remediation path. Red Hat mitigation guidance

The published Windows script preserves existing option values, adds mitigation settings to the machine and relevant service environments, and attempts eligible service restarts. It then evaluates exposure again. Non-service JVMs and excluded services can require manual restart handling. If a restarted service fails, the script contains rollback handling; that can restore availability without establishing mitigation. Read the final result and failure details together.

Its published defaults deserve review before deployment: $DryRun is $false, $RestartJavaServices is $true, and the excluded-service expression is vicarius|topia. Service restarts can interrupt active requests. Start with a reviewed test copy and an approved maintenance scope. The script's embedded recommendation is to test in a lab before production.

Vicarius's ScriptAI supports detection and remediation script generation. Requested scripts enter a private draft library for review and approval before execution. For this response, use the CVE-specific research and reviewed script behavior to define the action. Do not treat generic script-generation capability as proof that a particular application has been remediated.

Detect vulnerable assets and mitigate from the vRx 2.0 finding screen

The detection scripts tell remediation teams whether assessed assets are vulnerable to Java4Shell, based on the Java runtimes and mitigation settings they can inspect. For vRx 2.0 users, mitigation is available directly from the finding screen. After applying the mitigation, review the execution result and verify the affected JVMs.

Windows versus Linux: what differs in the attached scripts?

Both attachments are version 1.0 detection scripts attributed to the Vicarius Research Team. Neither installs Java updates, changes persistent mitigation settings, or restarts services. With verification enabled, they can launch Java processes to inspect flags, so “read-only” does not mean “no processes are started.”

Check Windows PowerShell attachment Linux Bash attachment
Runtime discovery Program Files search, vendor registry keys, machine JAVA_HOME and PATH Configured directories, PATH and /etc/alternatives/java
Running JVM discovery Java launchers and processes loading jvm.dll Processes mapping libjvm.so through /proc
Persistent mitigation checks Machine environment in the registry /etc/environment; with systemd, live manager settings and persistent DefaultEnvironment
Process inspection Command line plus an inline C# helper that reads process environment memory /proc environment and command-line entries, including argument-file handling
Containers No equivalent explicit container-skip mechanism identified in this review Detects differing process roots and skips those JVMs as containerized
Default search depth Four folder levels Six folder levels
Permissions and dependencies Administrator or SYSTEM recommended; PowerShell, CIM and .NET Root recommended; Bash and utilities including timeout, find, readlink, awk, sed and stat
Result format VULNERABLE|TRUE or VULNERABLE|FALSE, plus exit status Same result contract

The shared intent does not make these interchangeable implementations. The Linux checks cover systemd persistence, while Windows uses registry and process APIs. Embedded JVMs need particular attention because launcher environment variables do not necessarily govern a wrapper that loads the JVM directly.

How to interpret the results without closing work too early

The detectors can finish with:


RESULT=CVE-2026-114938|VULNERABLE|TRUE
RESULT=CVE-2026-114938|VULNERABLE|FALSE

Always collect the exit code and preceding logs. Both scripts can emit VULNERABLE|FALSE alongside exit code 1 on an error. That combination is a failed assessment, not a clean security result. Exit code 0 means the check completed according to its result contract; it does not mean the host is safe if the result is TRUE.

An assessment also has a coverage boundary. The Linux script explicitly skips containerized JVMs. Both rely on accessible runtime paths and process information. Unknown versions, unreadable processes, truncated searches, and vendor-specific backports need review. A new test JVM honoring a setting is useful evidence, but it does not prove that every existing service inherited the same setting.

Use the following closure record as a recommended operational check:

EvidenceWhat the reviewer should establish
Runtime identityThe application uses the runtime recorded in the assessment
Remediation actionA vendor-supported fixed build is running, or a reviewed interim flag is effective
Restart outcomeThe replacement service process is healthy and uses the intended configuration
Detector resultExit status, final result, warnings and skipped scope were reviewed together
Remaining workContainers, excluded services and manual restarts have named owners
Permanent fixA temporary mitigation has an update plan and a later removal review

For a suspected compromise, preserve the incident investigation separately. Applying the mitigation does not establish that prior access, stolen credentials, or persistence have been resolved.

Full Windows and Linux detection scripts

The following two scripts are reproduced from the supplied files without edits. They are detection scripts, not the separate Windows remediation script linked above. This article's review was static; these files were not run against Windows or Linux hosts. Test them in the intended environment before deployment, as their embedded disclaimer recommends.

‍

Windows detection script

<#
.SYNOPSIS
Detects exposure to CVE-2026-114938 ("Java4Shell", HotSpot C2 AVX-512 Base64 decode intrinsic heap overflow) for every Java runtime on a Windows host.

.DESCRIPTION
  CVE-2026-114938 (OpenJDK advisory 2026/11/17, hotspot/compiler, CVSS 3.1 8.1): the x86-64 C2
  Base64 decode intrinsic writes up to 62 bytes past the output array on malformed padded input;
  reachable before authentication (HTTP Basic auth, JWT parsing). Affected HotSpot builds (OpenJ9 is
  not): 17.0.6 - 17.0.21.0.x, 21 < 21.0.13.1, 25 < 25.0.5.1, 27 < 27.0.1.1 and every end-of-life
  release 18-20, 22-24, 26. Java 8 and 11 are not affected.
  The script inventories Java runtimes: bin\java.exe below $SearchRoots, the vendor registry keys
  (JavaSoft, Eclipse Adoptium / Foundation, AdoptOpenJDK, Azul, Microsoft\JDK, Amazon Corretto,
  BellSoft, IBM Semeru; 64-bit and 32-bit views), the machine JAVA_HOME and PATH, and every running
  process that has jvm.dll loaded (java.exe, javaw.exe and embedded JVMs such as Apache procrun /
  Tomcat service wrappers). Version and VM come from <home>\release (file version as fallback).
  The interim mitigation published by the researchers (Calif, https://calif.io/java4shell/) is
  -XX:-UseBASE64Intrinsics (or -XX:UseAVX=2 or lower) in effect:
    - Running JVM of an affected runtime: exposed unless the option is in effect in that process
      (JAVA_TOOL_OPTIONS, JDK_JAVA_OPTIONS for java.exe/javaw.exe, command line, _JAVA_OPTIONS, read
      from the process environment block and command line; the last value wins).
    - Affected runtime: exposed unless the machine environment variable JDK_JAVA_OPTIONS (or
      JAVA_TOOL_OPTIONS) disables the intrinsic and the runtime honours it (checked with
      -XX:+PrintFlagsFinal when $VerifyWithJvm is $true).
  The CPU (AVX-512 VBMI, needed for exploitation) is logged only: affected Java is reported
  regardless, because a VM can move to a newer host. Read-only: nothing is changed.
  Output: log lines, then exactly one last line
    RESULT=CVE-2026-114938|VULNERABLE|TRUE    an affected runtime or running JVM is not mitigated (exit code 0)
    RESULT=CVE-2026-114938|VULNERABLE|FALSE   no affected Java, or all mitigated (exit code 0); or a real
                                              error (exit code 1 after an ERROR line)
  Sources: https://openjdk.org/groups/vulnerability/advisories/2026-11-17, https://calif.io/java4shell/
  REQUIREMENTS:
    - PowerShell: 5.1 (tested); no PowerShell 5-only syntax (no classes or ::new())
    - OS: Windows 8.1 / Server 2012 R2 or later, 64-bit; tested on Windows 11 23H2
    - Modules: none (CIM, .NET, an inline C# helper to read process environments)
  WARNINGS:
    - Read-only ($VerifyWithJvm starts each affected java.exe once with -version). Run as SYSTEM
      (vRx agent) or Administrator so every process can be read. A vendor build that fixes the bug
      without raising the version is reported as vulnerable.

.NOTES
  VERSION: 1.0
  CHANGELOG:
    - 1.0 (2026-11-17): Initial release.

  DISCLAIMER:
    VICARIUS STRONGLY RECOMMENDS RUNNING THESE SCRIPTS IN A TEST LAB ENVIRONMENT
    BEFORE DEPLOYING THEM TO PRODUCTION. USE AT YOUR OWN DISCRETION ONLY AFTER
    CAREFULLY ANALYZING THE CODE.

.AUTHOR
This script has been made by Vicarius Research Team

.VERSION
1.0
#>

#region ---------------- Configuration (edit only this block) ----------------
# Absolute folders searched for Java runtimes (<folder>\bin\java.exe). Runtimes elsewhere are still found
# through the vendor registry keys, JAVA_HOME, the machine PATH or when they are running.
$SearchRoots = @("$env:SystemDrive\Program Files", "$env:SystemDrive\Program Files (x86)")
# Folder levels searched below each root (1-12).
$SearchMaxDepth = 4
# $true = confirm with "java.exe -XX:+PrintFlagsFinal -version" that each affected runtime honours the machine
# JDK_JAVA_OPTIONS / JAVA_TOOL_OPTIONS. $false = trust the configuration only.
$VerifyWithJvm = $true
# Maximum seconds for any single external command or CIM query (1-600).
$CommandTimeoutSeconds = 60
#endregion -------------------------------------------------------------------

$ErrorActionPreference = 'Stop'
Set-StrictMode -Version 2.0

$CveId = 'CVE-2026-114938'

function Write-Log {
    param([string]$Message)
    Write-Output ('[{0}] {1}' -f (Get-Date -Format 'yyyy-MM-dd HH:mm:ss'), $Message)
}

# Verdict: $true = exposed, $false = not exposed. Exit 0: the check ran as intended.
function Complete-Check {
    param([bool]$Vulnerable)
    Write-Output ('RESULT={0}|VULNERABLE|{1}' -f $CveId, $(if ($Vulnerable) { 'TRUE' } else { 'FALSE' }))
    exit 0
}

# Real error (invalid configuration, unexpected failure): FALSE and exit 1 (cve-scripts.md).
function Stop-WithError {
    param([string]$Message)
    Write-Log "ERROR: $Message"
    Write-Output ('RESULT={0}|VULNERABLE|FALSE' -f $CveId)
    exit 1
}

# ===== Exposure logic: keep identical in the x_detection and x_remediation scripts =====
# Interim mitigation (Calif, https://calif.io/java4shell/): disable the Base64 intrinsics. Delivered in JDK_JAVA_OPTIONS,
# read only by the JDK 9+ launcher (java.exe / javaw.exe): Java 8 refuses to start when the option is in
# JAVA_TOOL_OPTIONS, even with IgnoreUnrecognizedVMOptions. Either variable counts as mitigated.
$MitigationOpts = '-XX:+IgnoreUnrecognizedVMOptions -XX:-UseBASE64Intrinsics'
$MitigationVar = 'JDK_JAVA_OPTIONS'
# Feature releases with a fix and the first fixed build (Oracle ".1" builds, OpenJDK advisory 2026/11/17).
$FixedFloors = @{ 17 = '17.0.21.1'; 21 = '21.0.13.1'; 25 = '25.0.5.1'; 27 = '27.0.1.1' }
$VendorKeys = @('SOFTWARE\JavaSoft', 'SOFTWARE\Eclipse Adoptium', 'SOFTWARE\Eclipse Foundation', 'SOFTWARE\AdoptOpenJDK', 'SOFTWARE\Azul Systems', 'SOFTWARE\Microsoft\JDK', 'SOFTWARE\Amazon Corretto', 'SOFTWARE\BellSoft', 'SOFTWARE\Semeru')
$HomeValueNames = @('JavaHome', 'Path', 'InstallationPath', 'InstallLocation', 'InstallDir')
$EnvKey = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'

if (-not ('Vicarius.ProcEnv114938' -as [type])) {
    Add-Type -TypeDefinition @'
using System;
using System.Runtime.InteropServices;
namespace Vicarius {
public static class ProcEnv114938 {
    [StructLayout(LayoutKind.Sequential)]
    struct PBI { public IntPtr R1; public IntPtr Peb; public IntPtr R2a; public IntPtr R2b; public IntPtr Pid; public IntPtr R3; }
    [DllImport("ntdll.dll")] static extern int NtQueryInformationProcess(IntPtr h, int c, ref PBI i, int l, out int r);
    [DllImport("kernel32.dll", SetLastError = true)] static extern IntPtr OpenProcess(int a, bool i, int pid);
    [DllImport("kernel32.dll")] static extern bool CloseHandle(IntPtr h);
    [DllImport("kernel32.dll")] static extern bool ReadProcessMemory(IntPtr h, IntPtr a, byte[] b, IntPtr s, out IntPtr r);
    [DllImport("kernel32.dll")] static extern bool IsWow64Process(IntPtr h, out bool w);
    static byte[] Read(IntPtr h, IntPtr a, int n) {
        byte[] b = new byte[n]; IntPtr r;
        if (!ReadProcessMemory(h, a, b, new IntPtr(n), out r) || r.ToInt64() != n) return null;
        return b;
    }
    // Environment block of a 64-bit process as "NAME=value" strings; null when it cannot be read.
    public static string[] Get(int pid) {
        if (IntPtr.Size != 8) return null;
        IntPtr h = OpenProcess(0x0410, false, pid);
        if (h == IntPtr.Zero) h = OpenProcess(0x1010, false, pid);
        if (h == IntPtr.Zero) return null;
        try {
            bool wow; if (IsWow64Process(h, out wow) && wow) return null;
            PBI pbi = new PBI(); int rl;
            if (NtQueryInformationProcess(h, 0, ref pbi, Marshal.SizeOf(pbi), out rl) != 0) return null;
            byte[] b = Read(h, new IntPtr(pbi.Peb.ToInt64() + 0x20), 8); if (b == null) return null;
            IntPtr pp = new IntPtr(BitConverter.ToInt64(b, 0));
            b = Read(h, new IntPtr(pp.ToInt64() + 0x80), 8); if (b == null) return null;
            IntPtr env = new IntPtr(BitConverter.ToInt64(b, 0));
            b = Read(h, new IntPtr(pp.ToInt64() + 0x3F0), 8); if (b == null) return null;
            long size = BitConverter.ToInt64(b, 0);
            if (size <= 0 || size > 4 * 1024 * 1024) return null;
            b = Read(h, env, (int)size); if (b == null) return null;
            string s = System.Text.Encoding.Unicode.GetString(b);
            int end = s.IndexOf("\0\0"); if (end >= 0) s = s.Substring(0, end);
            return s.Split(new char[] { '\0' }, StringSplitOptions.RemoveEmptyEntries);
        } finally { CloseHandle(h); }
    }
}
}
'@
}

function Reset-State {
    $script:Runtimes = New-Object System.Collections.ArrayList
    $script:Rt = @{}
    $script:Jvms = New-Object System.Collections.ArrayList
    $script:ExposedJvms = New-Object System.Collections.ArrayList
    $script:NAffected = 0; $script:NRtExposed = 0; $script:NJvmExposed = 0; $script:NUnknown = 0; $script:NJ8Broken = 0
    $script:GlobalOk = $false; $script:MachineJto = ''; $script:MachineJdk = ''
}

# Runs an executable with a timeout and optional extra environment; output in $script:ToolOut, exit code in $script:ToolExit.
function Invoke-Tool([string]$Exe, [string[]]$Arguments, [hashtable]$Env = @{}) {
    $psi = New-Object System.Diagnostics.ProcessStartInfo
    $psi.FileName = $Exe
    $psi.Arguments = (@($Arguments) | ForEach-Object { if ($_ -eq '' -or $_ -match '[\s"]') { '"' + ($_ -replace '"', '\"') + '"' } else { $_ } }) -join ' '
    $psi.UseShellExecute = $false
    $psi.RedirectStandardOutput = $true
    $psi.RedirectStandardError = $true
    $psi.CreateNoWindow = $true
    foreach ($k in @('JAVA_TOOL_OPTIONS', 'JDK_JAVA_OPTIONS', '_JAVA_OPTIONS')) { if ($psi.EnvironmentVariables.ContainsKey($k)) { $psi.EnvironmentVariables.Remove($k) } }
    foreach ($k in $Env.Keys) { if ($Env[$k]) { $psi.EnvironmentVariables[$k] = $Env[$k] } }
    $p = [System.Diagnostics.Process]::Start($psi)
    $o = $p.StandardOutput.ReadToEndAsync(); $e = $p.StandardError.ReadToEndAsync()
    if (-not $p.WaitForExit($CommandTimeoutSeconds * 1000)) { throw "$Exe did not finish within $CommandTimeoutSeconds s." }
    $p.WaitForExit()
    $script:ToolOut = $o.Result + "`n" + $e.Result
    $script:ToolExit = $p.ExitCode
}

# Numeric fields of a Java version, padded to 6: "1.8.0_504" -> 8,0,504,0,0,0; "21.0.13.1+2" -> 21,0,13,1,2,0. $null if unparseable.
function Get-VerFields([string]$V) {
    $s = $V -replace '^1\.(\d+)', '$1' -replace '[_+-]', '.'
    $f = New-Object System.Collections.ArrayList
    foreach ($p in ($s -split '\.')) { if ($p -notmatch '^\d+$' -or $f.Count -ge 6) { break }; [void]$f.Add([long]$p) }
    if ($f.Count -eq 0) { return $null }
    while ($f.Count -lt 6) { [void]$f.Add([long]0) }
    return , $f.ToArray()
}
function Test-VerLt([string]$A, [string]$B) {
    $x = Get-VerFields $A; $y = Get-VerFields $B
    for ($i = 0; $i -lt 6; $i++) { if ($x[$i] -lt $y[$i]) { return $true }; if ($x[$i] -gt $y[$i]) { return $false } }
    return $false
}
# Returns @(status, reason); status affected|fixed|not_affected|unknown.
function Get-VersionStatus([string]$V) {
    $f = Get-VerFields $V
    if ($null -eq $f) { return @('unknown', "version '$V' could not be parsed") }
    $major = [int]$f[0]
    if ($major -lt 17) { return @('not_affected', "Java $major has no AVX-512 Base64 decode intrinsic") }
    if ($major -eq 17 -and (Test-VerLt $V '17.0.6')) { return @('not_affected', '17.0.0-17.0.5 predate the AVX-512 Base64 decoder (JDK-8296735, 17.0.6)') }
    if ($FixedFloors.ContainsKey($major)) {
        $floor = $FixedFloors[$major]
        if (Test-VerLt $V $floor) { return @('affected', "below the fixed build $floor") }
        return @('fixed', "at or above the fixed build $floor")
    }
    if ($major -ge 28) { return @('not_affected', 'early-access release after the fix') }
    return @('affected', "end-of-life feature release $major, no fixed build")
}

# Runtime home of a ...\bin\java.exe (JDK 8: <jdk>\jre\bin\java.exe -> <jdk>).
function Get-JavaHomeOf([string]$Exe) {
    $jh = Split-Path -Parent (Split-Path -Parent $Exe)
    if ((Split-Path -Leaf $jh) -ieq 'jre') {
        $up = Split-Path -Parent $jh
        if (Test-Path -LiteralPath (Join-Path $up 'bin\java.exe') -PathType Leaf) { $jh = $up }
    }
    return $jh.TrimEnd('\')
}
# Runtime home of a loaded jvm.dll (bin\server\jvm.dll, jre\bin\server\jvm.dll, bin\default\jvm.dll ...).
function Get-HomeFromJvmDll([string]$Dll) {
    $d = Split-Path -Parent $Dll
    for ($i = 0; $i -lt 4; $i++) {
        $d = Split-Path -Parent $d
        if (-not $d) { return $null }
        if ((Test-Path -LiteralPath (Join-Path $d 'release') -PathType Leaf) -or (Test-Path -LiteralPath (Join-Path $d 'bin\java.exe') -PathType Leaf)) {
            if ((Split-Path -Leaf $d) -ieq 'jre' -and (Test-Path -LiteralPath (Join-Path (Split-Path -Parent $d) 'bin\java.exe') -PathType Leaf)) { $d = Split-Path -Parent $d }
            return $d.TrimEnd('\')
        }
    }
    return $null
}
function Get-ReleaseField([string]$JavaHome, [string]$Name) {
    foreach ($f in @((Join-Path $JavaHome 'release'), (Join-Path $JavaHome 'jre\release'))) {
        if (-not (Test-Path -LiteralPath $f -PathType Leaf)) { continue }
        foreach ($l in (Get-Content -LiteralPath $f -ErrorAction SilentlyContinue)) {
            if ($l -match ('^' + $Name + '="?([^"]*)"?$')) { return $Matches[1] }
        }
        return ''
    }
    return ''
}

function Add-Runtime([string]$JavaHome, [string]$Via) {
    if (-not $JavaHome) { return }
    $key = $JavaHome.ToLowerInvariant()
    if ($script:Rt.ContainsKey($key)) { return }
    $ver = Get-ReleaseField $JavaHome 'JAVA_VERSION'
    $vm = Get-ReleaseField $JavaHome 'JVM_VARIANT'
    $java = Join-Path $JavaHome 'bin\java.exe'
    if (-not $ver -and (Test-Path -LiteralPath $java -PathType Leaf)) {
        $pv = (Get-Item -LiteralPath $java).VersionInfo.ProductVersion
        if ($pv) { $ver = ($pv -replace ',', '.').Trim() }
    }
    if (-not $vm -and @(Get-ChildItem -LiteralPath (Join-Path $JavaHome 'bin') -Filter 'j9vm*.dll' -Recurse -ErrorAction SilentlyContinue).Count -gt 0) { $vm = 'OpenJ9' }
    if ($vm -match 'j9') { $vm = 'OpenJ9' } else { $vm = 'HotSpot' }
    if (-not $ver) { $ver = 'unknown' }
    if ($vm -eq 'OpenJ9') { $st = @('not_affected', 'Eclipse OpenJ9 VM (only HotSpot has the intrinsic)') } else { $st = Get-VersionStatus $ver }
    $o = @{ Home = $JavaHome; Version = $ver; Vm = $vm; Status = $st[0]; Why = $st[1]; Java = $java }
    $script:Rt[$key] = $o
    [void]$script:Runtimes.Add($o)
    Write-Log ("Runtime: {0} | version {1} | {2} | found via {3} | {4} ({5})" -f $JavaHome, $ver, $vm, $Via, $o.Status, $o.Why)
}
function Add-Launcher([string]$Exe, [string]$Via) {
    if ([string]::IsNullOrWhiteSpace($Exe) -or -not (Test-Path -LiteralPath $Exe -PathType Leaf)) { return }
    Add-Runtime (Get-JavaHomeOf ((Get-Item -LiteralPath $Exe -Force).FullName)) $Via
}

# java.exe below a root, breadth-first, without following junctions/symlinks.
function Find-JavaExe([string]$Root, [int]$MaxDepth) {
    $queue = New-Object System.Collections.Queue
    $queue.Enqueue(@($Root, 0))
    $deadline = (Get-Date).AddSeconds($CommandTimeoutSeconds)
    while ($queue.Count -gt 0) {
        if ((Get-Date) -gt $deadline) { $script:SearchTruncated += $Root; return }
        $item = $queue.Dequeue(); $dir = $item[0]; $lvl = $item[1]
        $j = Join-Path $dir 'bin\java.exe'
        if (Test-Path -LiteralPath $j -PathType Leaf) { $j; continue }
        if ($lvl -ge $MaxDepth) { continue }
        try { $subs = ([System.IO.DirectoryInfo]$dir).GetDirectories() } catch { continue }
        foreach ($s in $subs) {
            if (($s.Attributes -band [System.IO.FileAttributes]::ReparsePoint) -ne 0) { continue }
            $queue.Enqueue(@($s.FullName, ($lvl + 1)))
        }
    }
}

# Runtime folders named in the vendor registry keys: "<folder>|<registry path>" strings.
function Get-RegistryJavaHomes {
    foreach ($view in @([Microsoft.Win32.RegistryView]::Registry64, [Microsoft.Win32.RegistryView]::Registry32)) {
        $base = [Microsoft.Win32.RegistryKey]::OpenBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $view)
        $stack = New-Object System.Collections.Stack
        foreach ($v in $VendorKeys) { $stack.Push(@($v, 0)) }
        while ($stack.Count -gt 0) {
            $it = $stack.Pop(); $path = $it[0]; $lvl = $it[1]
            $k = $null
            try { $k = $base.OpenSubKey($path) } catch { $k = $null }
            if ($null -eq $k) { continue }
            try {
                foreach ($n in $k.GetValueNames()) {
                    if ($HomeValueNames -notcontains $n) { continue }
                    $val = $k.GetValue($n, $null)
                    if ($val -is [string] -and $val -match '^([a-zA-Z]:\\|\\\\)') { '{0}|{1}\{2}' -f $val.TrimEnd('\'), $path, $n }
                }
                if ($lvl -lt 5) { foreach ($s in $k.GetSubKeyNames()) { $stack.Push(@("$path\$s", ($lvl + 1))) } }
            } finally { $k.Close() }
        }
        $base.Close()
    }
}

# Path of jvm.dll loaded in a process, or $null.
function Get-JvmDll([int]$ProcessId) {
    try {
        $p = [System.Diagnostics.Process]::GetProcessById($ProcessId)
        foreach ($m in $p.Modules) { if ($m.ModuleName -ieq 'jvm.dll') { return $m.FileName } }
    } catch { $null = $_ }  # protected or exited process: not a readable JVM
    return $null
}

function Invoke-Inventory {
    $script:SearchTruncated = @()
    foreach ($r in $SearchRoots) {
        if (-not (Test-Path -LiteralPath $r -PathType Container)) { continue }
        foreach ($j in @(Find-JavaExe $r $SearchMaxDepth)) { Add-Launcher $j "search of $r" }
    }
    foreach ($t in $script:SearchTruncated) { Write-Log "WARNING: the folder search of $t stopped after $CommandTimeoutSeconds s; increase CommandTimeoutSeconds or narrow SearchRoots." }
    foreach ($h in @(Get-RegistryJavaHomes)) {
        $dir, $where = $h -split '\|', 2
        Add-Launcher (Join-Path $dir 'bin\java.exe') "registry $where"
    }
    $jhome = [Environment]::GetEnvironmentVariable('JAVA_HOME', 'Machine')
    if ($jhome) { Add-Launcher (Join-Path $jhome 'bin\java.exe') 'JAVA_HOME (machine)' }
    $mp = [Environment]::GetEnvironmentVariable('Path', 'Machine')
    foreach ($d in @(($mp -split ';') | Where-Object { $_ })) {
        $d = [Environment]::ExpandEnvironmentVariables($d.Trim('"'))
        if ($d -notmatch '^([a-zA-Z]:\\|\\\\)') { continue }
        $j = Join-Path $d 'java.exe'
        if ((Test-Path -LiteralPath $j -PathType Leaf) -and (Split-Path -Leaf $d) -ieq 'bin') { Add-Launcher $j 'PATH (machine)' }
    }
    $procs = @(Get-CimInstance -ClassName Win32_Process -OperationTimeoutSec $CommandTimeoutSeconds)
    foreach ($p in $procs) {
        $pid0 = [int]$p.ProcessId
        if ($pid0 -le 4 -or $pid0 -eq $PID) { continue }
        $isLauncher = ($p.Name -ieq 'java.exe' -or $p.Name -ieq 'javaw.exe')
        $dll = Get-JvmDll $pid0
        if (-not $dll -and -not $isLauncher) { continue }
        if ($dll) { $jh = Get-HomeFromJvmDll $dll }
        elseif ($p.ExecutablePath) { $jh = Get-JavaHomeOf $p.ExecutablePath }
        else { $jh = $null }
        if (-not $jh) { Write-Log "WARNING: running JVM PID $pid0 ($($p.Name)): runtime folder not readable, skipped."; continue }
        [void]$script:Jvms.Add(@{ Pid = $pid0; Name = [string]$p.Name; Exe = [string]$p.ExecutablePath; Cmd = [string]$p.CommandLine; Home = $jh; Parent = [int]$p.ParentProcessId })
        Add-Runtime $jh "running process $pid0 ($($p.Name))"
    }
}

# Splits an option string like the JVM does (whitespace; quotes removed).
function Split-Opts([string]$S) { if (-not $S) { return @() }; return @(($S -replace '"', '') -split '\s+' | Where-Object { $_ }) }

# Command-line JVM options of a process, from its command line. java.exe/javaw.exe: until the main class or -jar.
# Other executables (embedded JVMs): every -XX: token (their JVM options usually live in their own configuration).
function Get-CmdOpts([string]$Cmd, [bool]$Launcher) {
    $out = New-Object System.Collections.ArrayList
    $toks = @([regex]::Matches($Cmd, '"[^"]*"|\S+') | ForEach-Object { $_.Value.Trim('"') })
    $skip = $false
    for ($i = 1; $i -lt $toks.Count; $i++) {
        $t = $toks[$i]
        if ($skip) { $skip = $false; continue }
        if ($t -in @('-cp', '-classpath', '--class-path', '-p', '--module-path', '--add-modules', '--add-opens', '--add-exports', '--add-reads', '--patch-module', '--upgrade-module-path', '--limit-modules', '--enable-native-access')) { $skip = $true; continue }
        if ($t -in @('-jar', '-m', '--module')) { break }
        if ($t.StartsWith('@') -and (Test-Path -LiteralPath $t.Substring(1) -PathType Leaf)) {
            foreach ($o in (Split-Opts ((Get-Content -LiteralPath $t.Substring(1) -Raw) -replace "'", ''))) { [void]$out.Add($o) }
            continue
        }
        if ($t.StartsWith('-')) { if ($Launcher -or $t.StartsWith('-XX:')) { [void]$out.Add($t) }; continue }
        if ($Launcher) { break }
    }
    return , $out.ToArray()
}

# Returns the deciding option when the option list (in precedence order) disables the intrinsic, else ''.
function Get-MitigatedBy([string[]]$Opts) {
    $b = ''; $avx = $null
    foreach ($o in $Opts) {
        if ($o -ceq '-XX:-UseBASE64Intrinsics') { $b = 'off' }
        elseif ($o -ceq '-XX:+UseBASE64Intrinsics') { $b = 'on' }
        elseif ($o -match '^-XX:UseAVX=(\d+)$') { $avx = [int]$Matches[1] }
    }
    if ($b -eq 'off') { return '-XX:-UseBASE64Intrinsics' }
    if ($null -ne $avx -and $avx -le 2) { return "-XX:UseAVX=$avx" }
    return ''
}
function Get-PairMitigatedBy([string]$Jto, [string]$Jdk) { return (Get-MitigatedBy (@(Split-Opts $Jto) + @(Split-Opts $Jdk))) }
function Format-Pair([string]$Jto, [string]$Jdk) { return ('JAVA_TOOL_OPTIONS="{0}" JDK_JAVA_OPTIONS="{1}"' -f $Jto, $Jdk) }

function Get-MachineEnv([string]$Name) {
    $v = (Get-ItemProperty -LiteralPath $EnvKey -Name $Name -ErrorAction SilentlyContinue)
    if ($null -eq $v) { return '' }
    return [string]$v.$Name
}

function Test-Global {
    $script:MachineJto = Get-MachineEnv 'JAVA_TOOL_OPTIONS'
    $script:MachineJdk = Get-MachineEnv 'JDK_JAVA_OPTIONS'
    $by = Get-PairMitigatedBy $script:MachineJto $script:MachineJdk
    if ($by) {
        $script:GlobalOk = $true
        Write-Log ("System-wide: the machine environment disables the Base64 intrinsic ({0}; {1})." -f $by, (Format-Pair $script:MachineJto $script:MachineJdk))
    } else {
        $script:GlobalOk = $false
        Write-Log ("System-wide: the machine environment does not disable the Base64 intrinsic ({0})." -f (Format-Pair $script:MachineJto $script:MachineJdk))
    }
}

# $true when runtime $R started with the machine variables reports the intrinsic disabled.
function Test-RuntimeHonours($R) {
    $script:VerifyInfo = ''
    if (-not (Test-Path -LiteralPath $R.Java -PathType Leaf)) { return $false }
    Invoke-Tool $R.Java @('-XX:-UsePerfData', '-Xmx32m', '-XX:+PrintFlagsFinal', '-version') @{ JAVA_TOOL_OPTIONS = $script:MachineJto; JDK_JAVA_OPTIONS = $script:MachineJdk }
    if ($script:ToolExit -ne 0) { return $false }
    $b = ''; $avx = ''
    foreach ($l in ($script:ToolOut -split "`r?`n")) {
        if ($l -match '\sUseBASE64Intrinsics\s+=\s+(\S+)') { $b = $Matches[1] }
        elseif ($l -match '\sUseAVX\s+=\s+(\d+)') { $avx = $Matches[1] }
    }
    $script:VerifyInfo = "UseBASE64Intrinsics=$b UseAVX=$avx"
    return ($b -eq 'false' -or ($avx -match '^\d+$' -and [int]$avx -le 2))
}

# Options in effect in a running JVM, in HotSpot precedence order; $null environment = not readable.
function Get-JvmOptions($J) {
    $envBlock = [Vicarius.ProcEnv114938]::Get($J.Pid)
    $vals = @{ JAVA_TOOL_OPTIONS = ''; JDK_JAVA_OPTIONS = ''; _JAVA_OPTIONS = '' }
    if ($null -ne $envBlock) {
        foreach ($e in $envBlock) {
            $n, $v = $e -split '=', 2
            if ($vals.ContainsKey($n.ToUpperInvariant())) { $vals[$n.ToUpperInvariant()] = $v }
        }
    }
    $J.EnvReadable = ($null -ne $envBlock)
    $J.Jto = $vals.JAVA_TOOL_OPTIONS; $J.Jdk = $vals.JDK_JAVA_OPTIONS
    $major = 0
    $f = Get-VerFields $script:Rt[$J.Home.ToLowerInvariant()].Version
    if ($null -ne $f) { $major = [int]$f[0] }
    $launcher = ($J.Name -ieq 'java.exe' -or $J.Name -ieq 'javaw.exe')
    $opts = @(Split-Opts $vals.JAVA_TOOL_OPTIONS)
    if ($launcher -and $major -ge 9) { $opts += @(Split-Opts $vals.JDK_JAVA_OPTIONS) }
    $opts += @(Get-CmdOpts $J.Cmd $launcher)
    $opts += @(Split-Opts $vals._JAVA_OPTIONS)
    return , $opts
}

function Write-CpuInfo {
    $c = @(Get-CimInstance -ClassName Win32_Processor -OperationTimeoutSec $CommandTimeoutSeconds)[0]
    Write-Log ("CPU: {0}. AVX-512 VBMI (needed for exploitation) is not checked on Windows; affected Java is reported regardless of the CPU (the workload or VM can move to a newer host)." -f ([string]$c.Name).Trim())
}

# Result in $script:ExposureCode: 0 = exposed, 1 = not exposed, 2 = could not evaluate (unknown runtime version, nothing exposed).
function Test-Exposure {
    Reset-State
    Invoke-Inventory
    if ($script:Runtimes.Count -eq 0) {
        Write-Log 'No Java runtime found (search roots, vendor registry keys, JAVA_HOME, PATH, running processes).'
        $script:ExposureCode = 1
        return
    }
    Test-Global
    $j8Risk = (@(Split-Opts $script:MachineJto) -match 'UseBASE64Intrinsics').Count -gt 0
    foreach ($r in $script:Runtimes) {
        if ($j8Risk -and $r.Version -match '^1\.[5-8]' -and $r.Vm -eq 'HotSpot') {
            $script:NJ8Broken++
            Write-Log "WARNING: runtime $($r.Home) ($($r.Version)) does not start while JAVA_TOOL_OPTIONS contains UseBASE64Intrinsics (Java 8 rejects it). Use JDK_JAVA_OPTIONS instead."
        }
        if ($r.Status -eq 'unknown') { $script:NUnknown++; Write-Log "WARNING: runtime $($r.Home): $($r.Why)."; continue }
        if ($r.Status -ne 'affected') { continue }
        $script:NAffected++
        if (-not $script:GlobalOk) {
            $script:NRtExposed++
            Write-Log "Runtime $($r.Home) ($($r.Version)) is affected and new JVMs started from it would not have the mitigation."
        } elseif ($VerifyWithJvm) {
            if (Test-RuntimeHonours $r) { Write-Log "Runtime $($r.Home) ($($r.Version)) is affected; the system-wide option is honoured ($($script:VerifyInfo))." }
            else {
                $script:NRtExposed++
                Write-Log ("Runtime {0} ({1}) is affected and does NOT apply the system-wide option ({2})." -f $r.Home, $r.Version, $(if ($script:VerifyInfo) { $script:VerifyInfo } else { 'java.exe -XX:+PrintFlagsFinal failed' }))
            }
        } else {
            Write-Log "Runtime $($r.Home) ($($r.Version)) is affected; covered by the system-wide option."
        }
    }
    foreach ($j in $script:Jvms) {
        $r = $script:Rt[$j.Home.ToLowerInvariant()]
        if ($r.Status -ne 'affected') { Write-Log "Running JVM PID $($j.Pid) ($($j.Name)): runtime $($j.Home) is $($r.Status)."; continue }
        $by = Get-MitigatedBy (Get-JvmOptions $j)
        if ($by) {
            Write-Log "Running JVM PID $($j.Pid) ($($j.Name), $($r.Version)): mitigated ($by in effect)."
        } else {
            $script:NJvmExposed++; [void]$script:ExposedJvms.Add($j)
            $note = if ($j.EnvReadable) { '' } else { ' (process environment not readable: only the command line was checked)' }
            Write-Log "Running JVM PID $($j.Pid) ($($j.Name), $($r.Version)): EXPOSED, the Base64 intrinsic is enabled in this process$note (restart it after applying the mitigation)."
        }
    }
    Write-Log ("Exposure: runtimes={0} affected={1} unmitigated_runtimes={2} running_jvms={3} exposed_jvms={4} unknown={5} system_wide_mitigation={6} java8_blocked={7}" -f $script:Runtimes.Count, $script:NAffected, $script:NRtExposed, $script:Jvms.Count, $script:NJvmExposed, $script:NUnknown, $script:GlobalOk.ToString().ToLower(), $script:NJ8Broken)
    if ($script:NRtExposed -gt 0 -or $script:NJvmExposed -gt 0) { $script:ExposureCode = 0 }
    elseif ($script:NUnknown -gt 0) { $script:ExposureCode = 2 }
    else { $script:ExposureCode = 1 }
}

function Test-CommonConfig {
    if (-not ($CommandTimeoutSeconds -is [int]) -or $CommandTimeoutSeconds -lt 1 -or $CommandTimeoutSeconds -gt 600) { return 'CommandTimeoutSeconds must be an integer between 1 and 600.' }
    if (-not ($SearchMaxDepth -is [int]) -or $SearchMaxDepth -lt 1 -or $SearchMaxDepth -gt 12) { return "SearchMaxDepth must be a number from 1 to 12: '$SearchMaxDepth'." }
    if (-not ($VerifyWithJvm -is [bool])) { return 'VerifyWithJvm must be $true or $false.' }
    foreach ($r in @($SearchRoots)) {
        if (-not ($r -is [string]) -or $r -notmatch '^([a-zA-Z]:\\|\\\\)' -or $r -match '\.\.') { return "SearchRoots entries must be absolute paths without '..': '$r'." }
    }
    if (-not [Environment]::Is64BitProcess) { return 'Run with 64-bit PowerShell (process environments of 64-bit JVMs cannot be read from a 32-bit process).' }
    return ''
}
# ===== End of shared exposure logic =====

try {
    Write-Log ('Checking {0} on {1} as {2}' -f $CveId, [Environment]::OSVersion.VersionString, [Security.Principal.WindowsIdentity]::GetCurrent().Name)
    $err = Test-CommonConfig
    if ($err) { Stop-WithError $err }
    $principal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
    if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Log 'WARNING: not running as SYSTEM or Administrator; JVMs of other users may not be readable.' }

    Write-CpuInfo
    Test-Exposure
    Write-Log ("Summary: runtimes={0} affected={1} unmitigated_runtimes={2} exposed_jvms={3} unknown={4}" -f $script:Runtimes.Count, $script:NAffected, $script:NRtExposed, $script:NJvmExposed, $script:NUnknown)
    switch ($script:ExposureCode) {
        0 { Write-Log "Host is exposed to ${CveId}: update Java to a fixed build, or apply the interim mitigation (-XX:-UseBASE64Intrinsics) and restart the JVMs."; Complete-Check -Vulnerable $true }
        1 { Write-Log "Host is not exposed to $CveId."; Complete-Check -Vulnerable $false }
        default { Stop-WithError 'The version of some Java runtimes could not be read and no other exposure was found.' }
    }
}
catch {
    Stop-WithError $_.Exception.Message
}

‍

Linux detection script

#!/usr/bin/env bash
# ==============================================================================
# SYNOPSIS
#   Detects exposure to CVE-2026-114938 ("Java4Shell", HotSpot C2 AVX-512
#   Base64 decode intrinsic heap overflow) for every Java runtime on the host.
#
# DESCRIPTION
#   CVE-2026-114938 (OpenJDK advisory 2026/11/17, hotspot/compiler, CVSS 3.1
#   8.1): the x86-64 C2 Base64 decode intrinsic writes up to 62 bytes past the
#   output array on malformed padded input; reachable before authentication
#   (HTTP Basic auth, JWT parsing). Affected HotSpot builds (OpenJ9 is not):
#     17.0.6 - 17.0.21.0.x, 21 < 21.0.13.1, 25 < 25.0.5.1, 27 < 27.0.1.1 and
#     every end-of-life release 18-20, 22-24, 26. Java 8 and 11 are not affected.
#   The script inventories Java runtimes (bin/java below SEARCH_ROOTS, java in
#   PATH, /etc/alternatives/java and every running process that has libjvm.so
#   mapped, including embedded JVMs such as jsvc), reads each runtime's
#   version and VM from <home>/release (java -version as fallback) and checks
#   the interim mitigation published by the researchers (Calif,
#   https://calif.io/java4shell/): -XX:-UseBASE64Intrinsics (or -XX:UseAVX=2
#   or lower) in effect.
#     - Running JVM of an affected runtime: exposed unless the option is in
#       effect in that process (JAVA_TOOL_OPTIONS, JDK_JAVA_OPTIONS, command
#       line and @argfiles, _JAVA_OPTIONS from /proc/<pid>, last value wins).
#     - Affected runtime: exposed unless JDK_JAVA_OPTIONS (or JAVA_TOOL_OPTIONS)
#       with the option is set system-wide (/etc/environment and, with
#       systemd, the manager environment both live and persistent) and the
#       runtime honours it (-XX:+PrintFlagsFinal when VERIFY_WITH_JVM=true).
#   A system-wide JAVA_TOOL_OPTIONS with the option is reported as a warning
#   when Java 8 is installed (Java 8 refuses to start with it).
#   The CPU (AVX-512 VBMI, needed for exploitation) is logged only: affected
#   Java is reported regardless, because a VM can move to a newer host.
#   JVMs inside containers are listed and skipped (scan the images instead).
#   Read-only: nothing is changed.
#   Output: log lines, then exactly one last line
#     RESULT=CVE-2026-114938|VULNERABLE|TRUE    an affected runtime or running JVM is
#                                               not mitigated (exit 0)
#     RESULT=CVE-2026-114938|VULNERABLE|FALSE   no affected Java, or all mitigated (exit 0);
#                                               exit 1 after an ERROR line on a real error
#   VARIABLES TO DEFINE:
#     #   SEARCH_ROOTS=(...)   # optional — absolute folders searched for */bin/java
#     #   SEARCH_MAX_DEPTH=6   # optional — find depth below each search root (1-12)
#     #   VERIFY_WITH_JVM=true   # optional — confirm the system-wide option with -XX:+PrintFlagsFinal
#     #   COMMAND_TIMEOUT=60   # optional — maximum seconds for any external command
#   WARNINGS:
#     # Run as root (vRx default) so every running process can be read.
#     # Read-only (VERIFY_WITH_JVM starts each affected java once with -version).
#     # A vendor build that fixes the bug without raising the version is
#     # reported as vulnerable.
#
# DISCLAIMER
#   VICARIUS STRONGLY RECOMMENDS RUNNING THESE SCRIPTS IN A TEST LAB ENVIRONMENT
#   BEFORE DEPLOYING THEM TO PRODUCTION. USE AT YOUR OWN DISCRETION ONLY AFTER
#   CAREFULLY ANALYZING THE CODE.
#
# AUTHOR
#   This script has been made by Vicarius Research Team
#
# VERSION
#   1.0
# ==============================================================================

# ---------------- Configuration (edit only this block) ----------------
# Absolute folders searched for Java runtimes (*/bin/java). Runtimes elsewhere are still found
# when they are in PATH, in /etc/alternatives or running.
SEARCH_ROOTS=("/usr/lib/jvm" "/usr/lib64/jvm" "/usr/java" "/usr/local" "/opt" "/srv")
# Folder depth searched below each root (1-12).
SEARCH_MAX_DEPTH=6
# true = confirm with "java -XX:+PrintFlagsFinal -version" that each affected runtime honours the
# system-wide JDK_JAVA_OPTIONS. false = trust the configuration only.
VERIFY_WITH_JVM=true
# Maximum seconds for any single external command.
COMMAND_TIMEOUT=60
# ----------------------------------------------------------------------

set -u
set -o pipefail

CVE_ID="CVE-2026-114938"

# ===== Exposure logic: keep identical in the x_detection and x_remediation scripts =====
# Interim mitigation (Calif, https://calif.io/java4shell/): disable the Base64 intrinsics.
# Delivered in JDK_JAVA_OPTIONS, read only by the JDK 9+ java launcher: Java 8 ignores the variable (in
# JAVA_TOOL_OPTIONS Java 8 refuses to start: "Unrecognized VM option 'UseBASE64Intrinsics'", even with
# IgnoreUnrecognizedVMOptions). IgnoreUnrecognizedVMOptions covers JDK 9/10 builds without the flag.
# Either variable counts as mitigated when it disables the intrinsic.
# shellcheck disable=SC2034  # used by the x_remediation script (same block)
MITIGATION_OPTS="-XX:+IgnoreUnrecognizedVMOptions -XX:-UseBASE64Intrinsics"
# shellcheck disable=SC2034
MITIGATION_VAR=JDK_JAVA_OPTIONS
ENV_FILE=/etc/environment
# Feature releases with a fix and the first fixed build (Oracle ".1" builds, OpenJDK advisory 2026/11/17).
FIXED_FLOORS=("17|17.0.21.1" "21|21.0.13.1" "25|25.0.5.1" "27|27.0.1.1")

RUNTIMES=() JVMS=() EXPOSED_JVMS=()
declare -A RT_SEEN=() RT_VER=() RT_STATUS=() RT_WHY=()
N_AFFECTED=0 N_RT_EXPOSED=0 N_JVM_EXPOSED=0 N_UNKNOWN=0 N_CONTAINER=0
GLOBAL_OK=false ENV_FILE_JTO="" ENV_FILE_JDK="" SYSTEMD=false N_J8_BROKEN=0 J8_RISK_JTO=""

log() { printf '[%s] %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$*"; }

run_bounded() { timeout "$COMMAND_TIMEOUT" "$@"; }

reset_state() {
    RUNTIMES=(); JVMS=(); EXPOSED_JVMS=()
    RT_SEEN=(); RT_VER=(); RT_STATUS=(); RT_WHY=()
    N_AFFECTED=0; N_RT_EXPOSED=0; N_JVM_EXPOSED=0; N_UNKNOWN=0; N_CONTAINER=0
    GLOBAL_OK=false; ENV_FILE_JTO=""; ENV_FILE_JDK=""; SYSTEMD=false; N_J8_BROKEN=0; J8_RISK_JTO=""
}

ver_fields() {
    # Numeric fields of a Java version, padded to 6: "1.8.0_504" -> "8 0 504 0 0 0", "21.0.13.1+2" -> "21 0 13 1 2 0".
    printf '%s\n' "$1" | sed -E 's/^1\.([0-9]+)/\1/; s/[_+-]/./g' | awk -F. '{
        n = 0; out = ""
        for (i = 1; i <= NF && n < 6; i++) { if ($i !~ /^[0-9]+$/) break; out = out (n ? " " : "") ($i + 0); n++ }
        if (n == 0) exit 1
        for (; n < 6; n++) out = out " 0"
        print out }'
}

ver_lt() {
    # 0 when version $1 < version $2.
    local a b
    a=$(ver_fields "$1") && b=$(ver_fields "$2") || return 2
    awk -v a="$a" -v b="$b" 'BEGIN { split(a, x, " "); split(b, y, " ")
        for (i = 1; i <= 6; i++) { if (x[i] + 0 < y[i] + 0) exit 0; if (x[i] + 0 > y[i] + 0) exit 1 } exit 1 }'
}

classify_version() {
    # Sets VSTATUS (affected|fixed|not_affected|unknown) and VWHY for Java version $1.
    local v="$1" f major e floor
    VSTATUS=unknown; VWHY="version '$v' could not be parsed"
    f=$(ver_fields "$v") || return 0
    major=${f%% *}
    if [ "$major" -lt 17 ]; then
        VSTATUS=not_affected; VWHY="Java $major has no AVX-512 Base64 decode intrinsic"; return 0
    fi
    if [ "$major" -eq 17 ] && ver_lt "$v" 17.0.6; then
        VSTATUS=not_affected; VWHY="17.0.0-17.0.5 predate the AVX-512 Base64 decoder (JDK-8296735, 17.0.6)"; return 0
    fi
    for e in "${FIXED_FLOORS[@]}"; do
        [ "${e%%|*}" = "$major" ] || continue
        floor=${e#*|}
        if ver_lt "$v" "$floor"; then VSTATUS=affected; VWHY="below the fixed build $floor"
        else VSTATUS=fixed; VWHY="at or above the fixed build $floor"; fi
        return 0
    done
    if [ "$major" -ge 28 ]; then
        VSTATUS=not_affected; VWHY="early-access release after the fix"
    else
        VSTATUS=affected; VWHY="end-of-life feature release $major, no fixed build"
    fi
}

java_home_of() {
    # Runtime home of a resolved .../bin/java (JDK 8: <jdk>/jre/bin/java -> <jdk>).
    local h
    h=$(dirname -- "$(dirname -- "$1")")
    case "$h" in */jre) [ -x "${h%/jre}/bin/java" ] && h=${h%/jre} ;; esac
    printf '%s\n' "$h"
}

home_from_libjvm() {
    # Runtime home of a mapped .../libjvm.so (lib/server, lib/amd64/server, jre/lib/amd64/server).
    local d
    d=$(dirname -- "$1")
    for _ in 1 2 3 4; do
        d=$(dirname -- "$d")
        if [ -f "$d/release" ] || [ -x "$d/bin/java" ]; then
            case "$d" in */jre) [ -x "${d%/jre}/bin/java" ] && d=${d%/jre} ;; esac
            printf '%s\n' "$d"; return 0
        fi
    done
    return 1
}

release_field() {
    local f
    for f in "$1/release" "$1/jre/release"; do
        [ -f "$f" ] || continue
        sed -nE "s/^$2=\"?([^\"]*)\"?\$/\\1/p" "$f" | head -n 1
        return 0
    done
}

add_runtime() {
    # $1 runtime home, $2 how it was found.
    local home="$1" ver vm out java
    [ -n "${RT_SEEN[$home]+x}" ] && return 0
    RT_SEEN[$home]=1
    java="$home/bin/java"
    ver=$(release_field "$home" JAVA_VERSION)
    vm=$(release_field "$home" JVM_VARIANT)
    if [ -z "$ver" ] && [ -x "$java" ]; then
        out=$(run_bounded "$java" -version 2>&1 </dev/null)
        ver=$(printf '%s\n' "$out" | sed -nE 's/.*version "([^"]+)".*/\1/p' | head -n 1)
        printf '%s' "$out" | grep -qi openj9 && vm=OpenJ9
    fi
    if [ -z "$vm" ] && compgen -G "$home/lib/*/libj9vm29.so" >/dev/null; then vm=OpenJ9; fi
    case "${vm,,}" in *openj9*|*j9*) vm=OpenJ9 ;; *) vm=HotSpot ;; esac
    RUNTIMES+=("$home"); RT_VER[$home]=${ver:-unknown}
    if [ "$vm" = OpenJ9 ]; then
        RT_STATUS[$home]=not_affected; RT_WHY[$home]="Eclipse OpenJ9 VM (only HotSpot has the intrinsic)"
    else
        classify_version "${ver:-unknown}"
        RT_STATUS[$home]=$VSTATUS; RT_WHY[$home]=$VWHY
    fi
    log "Runtime: $home | version ${ver:-unknown} | $vm | found via $2 | ${RT_STATUS[$home]} (${RT_WHY[$home]})"
}

add_launcher() {
    local exe
    exe=$(readlink -f -- "$1" 2>/dev/null) || return 0
    [ -n "$exe" ] && [ -f "$exe" ] && [ -x "$exe" ] || return 0
    add_runtime "$(java_home_of "$exe")" "$2"
}

env_of() {
    # Value of variable $2 in the environment of PID $1 (empty when unset or unreadable).
    tr '\0' '\n' < "/proc/$1/environ" 2>/dev/null | sed -n "s/^$2=//p" | tail -n 1
}

proc_options() {
    # JVM option tokens of PID $1 in HotSpot precedence order, one per line.
    # $2 = launcher name (java reads JDK_JAVA_OPTIONS), $3 = runtime major version.
    local pid="$1" a prev="" f v
    local -a args=()
    v=$(env_of "$pid" JAVA_TOOL_OPTIONS)
    # shellcheck disable=SC2086  # option strings are split on whitespace, like the JVM does
    printf '%s\n' $v
    if [ "$2" = java ] && [ "${3:-0}" -ge 9 ]; then
        v=$(env_of "$pid" JDK_JAVA_OPTIONS)
        # shellcheck disable=SC2086
        printf '%s\n' $v
    fi
    mapfile -d '' -t args < "/proc/$pid/cmdline" 2>/dev/null
    for a in "${args[@]:1}"; do
        case "$prev" in
            -cp|-classpath|--class-path|-p|--module-path|--add-modules|--add-opens|--add-exports|--add-reads|--patch-module|--upgrade-module-path|--limit-modules|--enable-native-access)
                prev=""; continue ;;
        esac
        case "$a" in
            @*) f=${a#@}; case "$f" in /*) ;; *) f="/proc/$pid/cwd/$f" ;; esac
                [ -r "$f" ] && tr -d "\"'" < "$f" | tr -s '[:space:]' '\n' ;;
            -jar|-m|--module) break ;;
            -*) printf '%s\n' "$a" ;;
            *) break ;;
        esac
        prev=$a
    done
    v=$(env_of "$pid" _JAVA_OPTIONS)
    # shellcheck disable=SC2086
    printf '%s\n' $v
}

opts_mitigated() {
    # Reads option tokens on stdin; 0 when the last values disable the intrinsic (prints the deciding option).
    tr -d "\"'" | awk '
        $0 == "-XX:-UseBASE64Intrinsics" { b = "off" }
        $0 == "-XX:+UseBASE64Intrinsics" { b = "on" }
        /^-XX:UseAVX=[0-9]+$/ { split($0, p, "="); avx = p[2] + 0; hasavx = 1 }
        END {
            if (b == "off") { print "-XX:-UseBASE64Intrinsics"; exit 0 }
            if (hasavx && avx <= 2) { print "-XX:UseAVX=" avx; exit 0 }
            exit 1 }'
}

strip_quotes() { printf '%s' "$1" | sed -E "s/^\\\$'//; s/^['\"]//; s/['\"]\$//"; }

env_file_value() {
    # Value of variable $1 in /etc/environment.
    [ -f "$ENV_FILE" ] || return 0
    strip_quotes "$(sed -nE "s/^[[:space:]]*(export[[:space:]]+)?$1=(.*)\$/\\2/p" "$ENV_FILE" | tail -n 1)"
}

manager_value() {
    # Value of variable $1 in the live systemd manager environment.
    strip_quotes "$(run_bounded systemctl show-environment 2>/dev/null | sed -n "s/^$1=//p" | tail -n 1)"
}

persistent_manager_value() {
    # Variable $1 of DefaultEnvironment= in system.conf and its drop-ins (last one wins).
    local cfg
    cfg=$(run_bounded systemd-analyze cat-config systemd/system.conf 2>/dev/null) \
        || cfg=$(cat /etc/systemd/system.conf /etc/systemd/system.conf.d/*.conf 2>/dev/null)
    printf '%s\n' "$cfg" | grep -E '^[[:space:]]*DefaultEnvironment=' \
        | grep -oE "\"$1=[^\"]*\"|$1=[^[:space:]\"]*" | tail -n 1 \
        | sed -E "s/^\"//; s/\"\$//; s/^$1=//"
}

pair_mitigated() {
    # JAVA_TOOL_OPTIONS $1 then JDK_JAVA_OPTIONS $2 (launcher order); 0 when they disable the intrinsic.
    # shellcheck disable=SC2086
    printf '%s\n' $1 $2 | opts_mitigated
}

show_pair() { printf 'JAVA_TOOL_OPTIONS="%s" JDK_JAVA_OPTIONS="%s"' "$1" "$2"; }

check_global() {
    # Sets GLOBAL_OK when JDK_JAVA_OPTIONS (or JAVA_TOOL_OPTIONS) with the mitigation is set system-wide:
    # /etc/environment and, with systemd, the live and the persistent manager environment.
    local a b by ok=true
    ENV_FILE_JTO=$(env_file_value JAVA_TOOL_OPTIONS); ENV_FILE_JDK=$(env_file_value JDK_JAVA_OPTIONS)
    if by=$(pair_mitigated "$ENV_FILE_JTO" "$ENV_FILE_JDK"); then
        log "System-wide: $ENV_FILE disables the Base64 intrinsic ($by; $(show_pair "$ENV_FILE_JTO" "$ENV_FILE_JDK"))."
    else
        ok=false; log "System-wide: $ENV_FILE does not disable the Base64 intrinsic ($(show_pair "$ENV_FILE_JTO" "$ENV_FILE_JDK"))."
    fi
    if [ -d /run/systemd/system ] && command -v systemctl >/dev/null 2>&1; then
        # shellcheck disable=SC2034  # read by the x_remediation script (same block)
        SYSTEMD=true
        a=$(manager_value JAVA_TOOL_OPTIONS); b=$(manager_value JDK_JAVA_OPTIONS)
        if by=$(pair_mitigated "$a" "$b"); then
            log "System-wide: systemd manager environment disables the Base64 intrinsic for services started from now on ($by)."
        else
            ok=false; log "System-wide: systemd manager environment does not disable the Base64 intrinsic ($(show_pair "$a" "$b"))."
        fi
        [[ "$a" == *UseBASE64Intrinsics* ]] && J8_RISK_JTO="$a"
        a=$(persistent_manager_value JAVA_TOOL_OPTIONS); b=$(persistent_manager_value JDK_JAVA_OPTIONS)
        if by=$(pair_mitigated "$a" "$b"); then
            log "System-wide: systemd DefaultEnvironment (persistent) disables the Base64 intrinsic ($by)."
        else
            ok=false; log "System-wide: no persistent systemd DefaultEnvironment disables the Base64 intrinsic (lost at reboot)."
        fi
    fi
    [[ "$ENV_FILE_JTO" == *UseBASE64Intrinsics* ]] && J8_RISK_JTO="$ENV_FILE_JTO"
    GLOBAL_OK=$ok
}

runtime_honours() {
    # 0 when runtime $1 started with the system-wide options reports the intrinsic disabled.
    local out b avx
    out=$(env -i PATH=/usr/sbin:/usr/bin:/sbin:/bin JAVA_TOOL_OPTIONS="$ENV_FILE_JTO" JDK_JAVA_OPTIONS="$ENV_FILE_JDK" \
          timeout "$COMMAND_TIMEOUT" "$1/bin/java" -XX:-UsePerfData -Xmx32m -XX:+PrintFlagsFinal -version 2>/dev/null </dev/null) || return 1
    b=$(printf '%s\n' "$out" | awk '$2 == "UseBASE64Intrinsics" { print $4; exit }')
    avx=$(printf '%s\n' "$out" | awk '$2 == "UseAVX" { print $4; exit }')
    VERIFY_INFO="UseBASE64Intrinsics=${b:-?} UseAVX=${avx:-?}"
    [ "$b" = false ] && return 0
    [[ "$avx" =~ ^[0-9]+$ ]] && [ "$avx" -le 2 ] && return 0
    return 1
}

proc_in_container() {
    local a b
    a=$(stat -L -c '%d:%i' "/proc/$1/root/" 2>/dev/null) || return 1
    b=$(stat -L -c '%d:%i' / 2>/dev/null) || return 1
    [ "$a" != "$b" ]
}

inventory() {
    local r j p pid lib home exe
    for r in "${SEARCH_ROOTS[@]}"; do
        [ -d "$r" ] || continue
        while IFS= read -r -d '' j; do
            add_launcher "$j" "search of $r"
        done < <(run_bounded find "$r" -maxdepth "$SEARCH_MAX_DEPTH" -path '*/bin/java' \( -type f -o -type l \) -print0 2>/dev/null)
    done
    j=$(command -v java 2>/dev/null) && add_launcher "$j" "PATH"
    [ -e /etc/alternatives/java ] && add_launcher /etc/alternatives/java "/etc/alternatives/java"
    for p in /proc/[0-9]*; do
        pid=${p#/proc/}
        [ "$pid" = "$$" ] && continue
        lib=$(grep -m 1 -oE '/[^ ]*/libjvm\.so' "$p/maps" 2>/dev/null) || continue
        exe=$(readlink "$p/exe" 2>/dev/null); exe=${exe% (deleted)}
        if proc_in_container "$pid"; then
            N_CONTAINER=$((N_CONTAINER + 1))
            log "Running JVM PID $pid ($exe) runs inside a container: skipped (scan the container image)."
            continue
        fi
        home=$(home_from_libjvm "$lib") || { log "WARNING: running JVM PID $pid: runtime home of $lib not found."; continue; }
        JVMS+=("$pid|$home|$exe")
        add_runtime "$home" "running process $pid"
    done
}

cpu_info() {
    local flags have=() f
    flags=$(grep -m 1 '^flags' /proc/cpuinfo 2>/dev/null)
    for f in avx512f avx512bw avx512vbmi; do
        [[ " $flags " == *" $f "* ]] && have+=("$f")
    done
    if [[ " ${have[*]} " == *" avx512vbmi "* ]] && [[ " ${have[*]} " == *" avx512bw "* ]]; then
        log "CPU: $(uname -m), AVX-512 VBMI and BW present: the vulnerable code path is reachable on this host."
    else
        log "CPU: $(uname -m), AVX-512 VBMI/BW not present (${have[*]:-none}). Not exploitable on this CPU today, but affected Java is reported regardless (the workload or VM can move to a newer CPU)."
    fi
}

test_exposure() {
    # 0 = exposed, 1 = not exposed, 2 = could not evaluate (unknown runtime version and nothing exposed).
    local home j pid exe by major
    reset_state
    inventory
    if [ "${#RUNTIMES[@]}" -eq 0 ]; then
        log "No Java runtime found (search roots, PATH, alternatives, running processes)."
        return 1
    fi
    check_global
    for home in "${RUNTIMES[@]}"; do
        if [ -n "$J8_RISK_JTO" ] && [[ "${RT_VER[$home]}" == 1.[5-8]* ]] && [[ "${RT_WHY[$home]}" != *OpenJ9* ]]; then
            N_J8_BROKEN=$((N_J8_BROKEN + 1))
            log "WARNING: runtime $home (${RT_VER[$home]}) does not start while JAVA_TOOL_OPTIONS contains UseBASE64Intrinsics (Java 8 rejects it). Use JDK_JAVA_OPTIONS instead."
        fi
        case "${RT_STATUS[$home]}" in
            affected) N_AFFECTED=$((N_AFFECTED + 1)) ;;
            unknown) N_UNKNOWN=$((N_UNKNOWN + 1)); log "WARNING: runtime $home: ${RT_WHY[$home]}."; continue ;;
            *) continue ;;
        esac
        if [ "$GLOBAL_OK" != true ]; then
            N_RT_EXPOSED=$((N_RT_EXPOSED + 1))
            log "Runtime $home (${RT_VER[$home]}) is affected and new JVMs started from it would not have the mitigation."
        elif [ "$VERIFY_WITH_JVM" = true ] && [ -x "$home/bin/java" ]; then
            VERIFY_INFO=""
            if runtime_honours "$home"; then
                log "Runtime $home (${RT_VER[$home]}) is affected; the system-wide option is honoured ($VERIFY_INFO)."
            else
                N_RT_EXPOSED=$((N_RT_EXPOSED + 1))
                log "Runtime $home (${RT_VER[$home]}) is affected and does NOT apply the system-wide option (${VERIFY_INFO:-java -XX:+PrintFlagsFinal failed})."
            fi
        else
            log "Runtime $home (${RT_VER[$home]}) is affected; covered by the system-wide option."
        fi
    done
    for j in "${JVMS[@]}"; do
        IFS='|' read -r pid home exe <<<"$j"
        [ "${RT_STATUS[$home]:-}" = affected ] || { log "Running JVM PID $pid ($exe): runtime $home is ${RT_STATUS[$home]:-unknown}."; continue; }
        major=$(ver_fields "${RT_VER[$home]}" 2>/dev/null) || major=0
        major=${major%% *}
        if by=$(proc_options "$pid" "$(basename -- "$exe")" "$major" | opts_mitigated); then
            log "Running JVM PID $pid ($exe, ${RT_VER[$home]}): mitigated ($by in effect)."
        else
            N_JVM_EXPOSED=$((N_JVM_EXPOSED + 1)); EXPOSED_JVMS+=("$j")
            log "Running JVM PID $pid ($exe, ${RT_VER[$home]}): EXPOSED, the Base64 intrinsic is enabled in this process (restart it after applying the mitigation)."
        fi
    done
    log "Exposure: runtimes=${#RUNTIMES[@]} affected=$N_AFFECTED unmitigated_runtimes=$N_RT_EXPOSED running_jvms=${#JVMS[@]} exposed_jvms=$N_JVM_EXPOSED unknown=$N_UNKNOWN container_jvms=$N_CONTAINER system_wide_mitigation=$GLOBAL_OK java8_blocked=$N_J8_BROKEN"
    if [ "$N_RT_EXPOSED" -gt 0 ] || [ "$N_JVM_EXPOSED" -gt 0 ]; then return 0; fi
    [ "$N_UNKNOWN" -gt 0 ] && return 2
    return 1
}
# ===== End of shared exposure logic =====

# Verdict: TRUE = exposed, FALSE = not exposed. Exit 0: the check ran as intended.
finish() {
    printf 'RESULT=%s|VULNERABLE|%s\n' "$CVE_ID" "$1"
    exit 0
}

# Real error (invalid configuration, missing tool, unexpected failure): FALSE and exit 1 (cve-scripts.md).
fail_error() {
    log "ERROR: $*"
    printf 'RESULT=%s|VULNERABLE|FALSE\n' "$CVE_ID"
    exit 1
}

log "Checking $CVE_ID on $(uname -srm) as $(id -un) (uid $(id -u))"

# --- Validate configuration ---
[[ "$COMMAND_TIMEOUT" =~ ^[1-9][0-9]*$ ]] || fail_error "Invalid COMMAND_TIMEOUT '$COMMAND_TIMEOUT'."
[[ "$SEARCH_MAX_DEPTH" =~ ^[0-9]+$ ]] && [ "$SEARCH_MAX_DEPTH" -ge 1 ] && [ "$SEARCH_MAX_DEPTH" -le 12 ] \
    || fail_error "SEARCH_MAX_DEPTH must be a number from 1 to 12: '$SEARCH_MAX_DEPTH'."
case "$VERIFY_WITH_JVM" in true|false) ;; *) fail_error "VERIFY_WITH_JVM must be true or false: '$VERIFY_WITH_JVM'." ;; esac
for root in "${SEARCH_ROOTS[@]}"; do
    case "$root" in
        /*) case "$root" in *..*) fail_error "SEARCH_ROOTS entries must not contain '..': '$root'." ;; esac ;;
        *) fail_error "SEARCH_ROOTS entries must be absolute paths: '$root'." ;;
    esac
done
for tool in timeout find readlink awk sed stat; do
    command -v "$tool" >/dev/null 2>&1 || fail_error "Required tool '$tool' not found."
done
[ "$(id -u)" -eq 0 ] || log "WARNING: not running as root; JVMs of other users may not be readable."

cpu_info
test_exposure; rc=$?
log "Summary: runtimes=${#RUNTIMES[@]} affected=$N_AFFECTED unmitigated_runtimes=$N_RT_EXPOSED exposed_jvms=$N_JVM_EXPOSED unknown=$N_UNKNOWN container_jvms=$N_CONTAINER"
case "$rc" in
    0) log "Host is exposed to $CVE_ID: update Java to a fixed build, or apply the interim mitigation (-XX:-UseBASE64Intrinsics) and restart the JVMs."
       finish TRUE ;;
    1) log "Host is not exposed to $CVE_ID."; finish FALSE ;;
    *) fail_error "The version of some Java runtimes could not be read and no other exposure was found." ;;
esac

Frequently asked questions

Do the attached scripts fix Java4Shell?

No. Both inspect runtimes and mitigation configuration, then report exposure. The separate vSociety Windows mitigation script changes settings and can restart services. Detection and remediation results must be tracked separately.

Is Java4Shell already being exploited by attackers?

Calif has published exploitation demonstrations. The evidence reviewed here does not establish confirmed malicious exploitation in the wild. Use precise language when reporting that distinction to stakeholders. Calif research

Does changing an environment variable protect an already running JVM?

Do not assume it does. Verify the running process after the approved restart or redeployment. The supplied detection scripts assess existing JVMs separately from machine-level settings for this reason.

Does a clean Linux host scan cover Java in containers?

No. The supplied Linux script logs and skips JVMs it identifies as containerized. Assess the relevant images and deployed workloads separately; do not count skipped instances as clean.

Is disabling the intrinsic a permanent fix?

It is an interim configuration mitigation. Track the supported Java update separately and review removal of the workaround after validating the fixed runtime. Red Hat guidance

Put the remediation workflow into practice

Bring detection, reviewed execution, restart exceptions, and validation into one operational workflow. Request a Vicarius demo to discuss managing that remediation process across your environment.

Sagy Kratu

Sr. Product Marketing Manager

Subscribe for more

Get more infosec news and insights.

Related articles

1000+ members

Turn security converstains into remediation actions