--- title: "Investigating Ransomware in Splunk: Queries for Each Stage" url: https://playciso.com/blog/ransomware-investigation-splunk-queries updated: 2026-12-06 section: Blog publisher: PlayCISO --- # Investigating Ransomware in Splunk: Queries for Each Stage > Splunk searches for each stage of a ransomware intrusion: web shell, recon, new accounts, LSASS access, WMI spread and ransom notes, with Sysmon event IDs. Source: https://playciso.com/blog/ransomware-investigation-splunk-queries · Published: 2026-12-06 · Publisher: PlayCISO (https://playciso.com) --- Ransomware is the last step of an intrusion, not the first. By the time files are encrypted, the attacker has usually got in, looked around, made sure they can come back, stolen credentials and spread. A good investigation works backwards from the encryption to the way in, and every one of those steps leaves an event you can search. This guide gives the event to look for and a Splunk query to start from at each stage. If you would rather check an export without a SIEM, the [Ransomware Precursor Log Analyzer](/tools/ransomware-precursor-log-analyzer) runs the same checks in your browser. ## Before you search - Widen the time range. Splunk defaults to a short window. Start well before the encryption day: in the Conti case Sophos describes, ransomware came five days after the first access. - Know your sources. The queries assume Sysmon and Windows Security events with the usual field names (EventCode, Image, ParentImage, CommandLine, TargetImage, TargetFilename). Replace index=* with your real indexes once you know where the events live; searching every index on a large estate is slow. - Preserve first. Export what you find before anyone reimages a host. ## The Sysmon events that matter | Event | What Microsoft says it records | Why it matters here | | --- | --- | --- | | Sysmon 1 | Process creation, with extended information | Commands, parents, binaries in odd paths | | Sysmon 3 / 22 | Network connections (off by default) / DNS queries | Callbacks, tunnels, exfiltration | | Sysmon 8 | A process creates a thread in another process | Injection | | Sysmon 10 | A process opens another process; detects tools that read LSASS memory | Credential theft | | Sysmon 11 | A file is created or overwritten | Web shells, dropped tools, ransom notes | | Security 4720 / 4732 | A user account was created / a member was added to a security-enabled local group | Persistence through accounts | Descriptions from [Microsoft's Sysmon page](https://learn.microsoft.com/en-us/sysinternals/downloads/sysmon) and its [4720](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4720) and [4732](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4732) references. ## 1. Impact: ransom notes and recovery inhibition Start where the damage is. One process creating the same note name in many folders points you at the encryptor, and its path tells you a lot: an executable named like a Windows tool but running from a user folder is a red flag. `index=* EventCode=11 (TargetFilename="*readme*" OR TargetFilename="*decrypt*" OR TargetFilename="*restore*") | stats dc(TargetFilename) AS notes values(host) AS hosts BY Image | where notes > 20 | sort - notes` `index=* EventCode=1 (CommandLine="*vssadmin*delete*shadows*" OR CommandLine="*shadowcopy*delete*" OR CommandLine="*bcdedit*recoveryenabled*" OR CommandLine="*wbadmin*delete*") | table _time host User ParentImage CommandLine` Take the encryptor's hash from the `Hashes` field and look it up in your threat intelligence or a reputation service. Look the hash up; do not upload a file from a victim's network to a public service. ## 2. Masquerading binaries `index=* EventCode=1 (Image="*\\cmd.exe" OR Image="*\\svchost.exe" OR Image="*\\rundll32.exe" OR Image="*\\lsass.exe" OR Image="*\\powershell.exe") NOT (Image="C:\\Windows\\System32\\*" OR Image="C:\\Windows\\SysWOW64\\*" OR Image="C:\\Windows\\WinSxS\\*") | stats count earliest(_time) AS first BY host Image | convert ctime(first)` ## 3. Credential theft: LSASS access Microsoft says Sysmon Event 10 detects tools that read LSASS memory. Some legitimate processes open lsass.exe (antivirus, some system services), so list the sources and look at anything new. `index=* (EventCode=10 OR EventCode=8) TargetImage="*\\lsass.exe" | stats count values(GrantedAccess) AS access BY host SourceImage | sort - count` `index=* EventCode=1 (CommandLine="*comsvcs*MiniDump*" OR CommandLine="*procdump*lsass*" OR CommandLine="*reg*save*HKLM\\SAM*") | table _time host User CommandLine` The fix after an LSASS read is wide: reset the passwords of every account that signed in to that host, and of service accounts used there. Two Microsoft controls make the next attempt harder: [LSA protection](https://learn.microsoft.com/en-us/windows-server/security/credentials-protection-and-management/configuring-additional-lsa-protection), which Microsoft says blocks untrusted LSA code injection and process memory dumping, and the [Protected Users group](https://learn.microsoft.com/en-us/windows-server/security/credentials-protection-and-management/protected-users-security-group), which stops credentials of its members being cached at sign-in. ## 4. Spread: WMI, services and PsExec Microsoft documents [unsecapp.exe](https://learn.microsoft.com/en-us/windows/win32/wmisdk/setting-security-on-an-asynchronous-call) as the separate process WMI uses to receive asynchronous callbacks. It is legitimate. A command shell or an unknown executable whose parent is unsecapp.exe or wmiprvse.exe, on many hosts in a short window, is a strong sign of remote execution through WMI. `index=* EventCode=1 (ParentImage="*\\wmiprvse.exe" OR ParentImage="*\\unsecapp.exe") | stats dc(host) AS hosts values(host) AS host_list BY Image CommandLine | sort - hosts` `index=* EventCode=1 (CommandLine="*wmic*/node:*process*call*create*" OR CommandLine="*Win32_Process*Create*" OR Image="*\\PSEXESVC.exe" OR CommandLine="*sc*\\\\*create*") | table _time host User ParentImage CommandLine` ## 5. Persistence: new accounts and local groups Adding a user to Remote Desktop Users or Administrators on one machine gives the attacker a way back in even if other credentials are reset. `net1.exe` does the same job as `net.exe`, so search for both. `index=* (EventCode=4720 OR EventCode=4732) OR (EventCode=1 (Image="*\\net.exe" OR Image="*\\net1.exe") CommandLine="*/add*") | table _time host EventCode User CommandLine` ## 6. Discovery bursts One built-in command is noise; several in a few minutes from one host or account is someone finding their way around. `index=* EventCode=1 (Image="*\\whoami.exe" OR Image="*\\net.exe" OR Image="*\\net1.exe" OR Image="*\\nltest.exe" OR Image="*\\ipconfig.exe" OR Image="*\\systeminfo.exe" OR Image="*\\quser.exe") | bin _time span=10m | stats dc(Image) AS tools values(CommandLine) AS commands BY host User _time | where tools >= 3` ## 7. The way in: web shells on Exchange and IIS Exchange servers have long been a favourite way in. CISA's [August 2021 alert](https://www.cisa.gov/news-events/alerts/2021/08/21/urgent-protect-against-active-exploitation-proxyshell-vulnerabilities) names the three ProxyShell flaws (CVE-2021-34473, CVE-2021-34523 and CVE-2021-31207) and says Microsoft's May 2021 security update fixes all three. [Sophos](https://www.sophos.com/en-us/blog/conti-affiliates-use-proxyshell-exchange-exploit-in-ransomware-attacks/) describes Conti affiliates exploiting ProxyShell, creating a mailbox for "administrator" and assigning it new roles, setting up a web shell in under a minute and a backup one three minutes later; it says about 1 TB was taken within 48 hours and the ransomware was deployed after five days. `index=* EventCode=11 (TargetFilename="*.aspx" OR TargetFilename="*.ashx" OR TargetFilename="*.asmx") (TargetFilename="*\\inetpub\\*" OR TargetFilename="*\\FrontEnd\\HttpProxy\\*" OR TargetFilename="*\\aspnet_client\\*") | table _time host Image TargetFilename` `index=* EventCode=1 ParentImage="*\\w3wp.exe" (Image="*\\cmd.exe" OR Image="*\\powershell.exe") | table _time host User CommandLine` On Exchange, also review the admin audit log for mailbox, role-assignment and mailbox-export cmdlets you did not run (PlayCISO guidance). Then patch, remove the web shells, and assume every credential the server could reach is exposed. ## Put it on one timeline Write each finding as a row: time, host, account, what happened, the event and the query that found it. Read it top to bottom from the first web shell to the ransom notes, and the gaps tell you which logs you were missing. Practise exactly this on a fictional case in the [Intrusion Investigation Lab](/tools/intrusion-investigation-lab), or download synthetic Sysmon and Windows logs from the [Sample Library](/samples) to try these queries in your own Splunk. ## Frequently asked questions ### How do you investigate ransomware in Splunk? Widen the time range well beyond the encryption day, then work backwards by stage: find the encrypting process and its ransom notes, the credential theft (process access to lsass.exe), the spread (WMI, PsExec, services), the persistence (new users, local group changes) and the way in (web shells, exposed services). Each stage has a Sysmon or Windows event you can search for. ### Which Sysmon events matter most for ransomware? Event ID 1 (process creation) for commands and parents, 11 (file create) for web shells and ransom notes, 10 (process access) for reads of lsass.exe memory, 8 (CreateRemoteThread) for injection, and 3 and 22 for network connections and DNS queries. Add Windows Security 4720 (user created) and 4732 (member added to a local group). ### What does Sysmon Event ID 10 on lsass.exe mean? A process opened lsass.exe. Microsoft says this event detects tools that read LSASS memory, which is how attackers steal credentials. Antivirus and some system processes open it legitimately, so baseline the normal source processes and look at the rest. ### Why is unsecapp.exe in a ransomware investigation? Microsoft documents unsecapp.exe as the separate process WMI uses to receive asynchronous callbacks. It is legitimate, but when it or wmiprvse.exe is the parent of a command shell or an unknown executable on many hosts at once, that is a strong sign of remote execution through WMI. ### Did Conti use ProxyShell? Yes, per Sophos: Conti affiliates exploited ProxyShell on Exchange, set up a web shell in under a minute, added a backup web shell three minutes later, exfiltrated about 1 TB within 48 hours and deployed Conti after five days. CISA lists the three ProxyShell CVEs and says the May 2021 Exchange update fixes all three. ### Can I check my own logs without Splunk? Yes. Export Sysmon or Security events and paste or drop them into the Ransomware Precursor Log Analyzer, which runs in your browser and flags each stage with the matching hunt query for Splunk and Microsoft Sentinel. ## Sources - [Microsoft Learn: Sysmon](https://learn.microsoft.com/en-us/sysinternals/downloads/sysmon) (event descriptions) - [Microsoft Learn: Event 4720](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4720) and [Event 4732](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4732) - [CISA: Urgent: Protect Against Active Exploitation of ProxyShell Vulnerabilities](https://www.cisa.gov/news-events/alerts/2021/08/21/urgent-protect-against-active-exploitation-proxyshell-vulnerabilities) (21 Aug 2021) - [Sophos: Conti affiliates use ProxyShell Exchange exploit in ransomware attacks](https://www.sophos.com/en-us/blog/conti-affiliates-use-proxyshell-exchange-exploit-in-ransomware-attacks/) (Sept 2021) - [Microsoft Learn: Setting Security on an Asynchronous Call](https://learn.microsoft.com/en-us/windows/win32/wmisdk/setting-security-on-an-asynchronous-call) (unsecapp.exe) - [Microsoft Learn: Configure added LSA protection](https://learn.microsoft.com/en-us/windows-server/security/credentials-protection-and-management/configuring-additional-lsa-protection) and [Protected Users security group](https://learn.microsoft.com/en-us/windows-server/security/credentials-protection-and-management/protected-users-security-group)