New docs portal launching December 21st! All Exabeam, LogRhythm, and API documentation is moving to docs.exabeam.com. Existing links will redirect automatically, but we recommend updating your bookmarks.
5.0.7 5.0.6 5.0.5 5.0.4 5.0.3 5.0.2 5.0.1 5.0.0
5.0.7 5.0.6 5.0.5 5.0.4 5.0.3 5.0.2 5.0.1 5.0.0

Detect Reverse PowerShell

This example detects the Nishang reverse PowerShell tunneling through ICMP. For details, see https://logrhythm.com/blog/identifying-powershell-tunneling-through-icmp.

function Packet_DetectReversePowerShell (dpiMsg, packet) require 'LOG' if GetLatestApplication(dpiMsg) == "icmp" then -- Get ICMP type (byte 20 for IPv4 packets) local icmpType = GetPayloadData(packet, 20, 20) if icmpType == 8 then -- Look at the bytes from the payload, does it match "Windows PowerShell" local payload = GetPayloadString(packet) -- Get the entire payload if string.match(payload, "Windows PowerShell") ~= nil then SetCustomField(dpiMsg, "ICMP_Tunnel_Signature", "Windows PowerShell") local user = string.match(payload, "user ([%a%d@_-]+) ") if user ~= nil then SetCustomField(dpiMsg, "ICMP_Tunnel_User", "User:" .. user) end EZWARNING("Session: ", GetUuid(dpiMsg), ", ICMP PowerShell Tunnel. user: ", user) end end endend