// Odin by Brandefense - Monograph 70 (Seeyon OA Spraying: JNDI Listeners and SSRF Polling) // Hunts JVM/OA worker shell spawns, JNDI/OA/harvester CLI markers, public JNDI egress, and failed SSRF port sweeps. let Lookback = 7d; let ApprovedAdminAndBuildHosts = dynamic(["app-ci-01.corp.example", "sec-bastion-01.corp.example"]); let JavaOrWebShellAndHarvesterCli = DeviceProcessEvents | where Timestamp >= ago(Lookback) | where not(DeviceName in~ (ApprovedAdminAndBuildHosts)) | where ( (InitiatingProcessFileName in~ ("java", "java.exe", "tomcat9.exe", "w3wp.exe", "nginx", "httpd") and FileName in~ ("sh", "bash", "dash", "cmd.exe", "powershell.exe", "pwsh.exe", "curl", "curl.exe", "wget")) or FileName =~ "linux_x64_admin" or ProcessCommandLine has_any ("ldap_responder.py", "spray_oa3.py", "puredes.py", "fetch_rar.py", "ssrf_test.sh", "hello-test-13890") ) | project Timestamp, DeviceName, AccountName, SignalType = "HostJvmShellOrWorkbenchCli", Detail = strcat(InitiatingProcessFileName, " -> ", FileName, ": ", ProcessCommandLine); let UnexpectedJndiOrFailedSweepEgress = DeviceNetworkEvents | where Timestamp >= ago(Lookback) | where not(DeviceName in~ (ApprovedAdminAndBuildHosts)) | where ( (RemoteIPType == "Public" and InitiatingProcessFileName in~ ("java", "java.exe", "tomcat9.exe", "w3wp.exe") and RemotePort in (389, 636, 1099, 1389, 8888, 10990, 13890, 13891, 18888)) or (ActionType == "ConnectionFailed" and InitiatingProcessFileName in~ ("java", "java.exe", "tomcat9.exe", "w3wp.exe", "nginx", "httpd") and RemotePort in (1433, 3306, 4444, 5000)) ) | project Timestamp, DeviceName, AccountName = InitiatingProcessAccountName, SignalType = "UnexpectedJndiEgressOrFailedSweep", Detail = strcat(InitiatingProcessFileName, " [", ActionType, "] -> ", RemoteIP, ":", tostring(RemotePort), " (", RemoteUrl, ")"); union JavaOrWebShellAndHarvesterCli, UnexpectedJndiOrFailedSweepEgress | summarize FirstSeen = min(Timestamp), LastSeen = max(Timestamp), EventCount = count(), Signals = make_set(SignalType, 6), SampleDetails = make_set(Detail, 5) by DeviceName, AccountName | order by LastSeen desc