Detecting Ransomware
Ransomware can be detected by monitoring specific behaviors, such as excessive file overwrites and file renaming with distinct extensions. Here are two Splunk searches that identify these patterns:
Detecting Excessive File Overwrite Operations
This query detects ransomware based on a high number of SMB::FILE_OPEN and SMB::FILE_RENAME actions within short intervals, a common ransomware characteristic:
index="ransomware_open_rename_sodinokibi" sourcetype="bro:smb_files:json"
| where action IN ("SMB::FILE_OPEN", "SMB::FILE_RENAME")
| bin _time span=5m
| stats count by _time, source, action
| where count>30
| stats sum(count) as count values(action) dc(action) as uniq_actions by _time, source
| where uniq_actions==2 AND count>100Search Breakdown:
Index and Action Filtering: Filters for entries in
ransomware_open_rename_sodinokibiindex with SMB actions ofFILE_OPENandFILE_RENAME.5-Minute Time Bins: Groups results in 5-minute intervals.
Counting Events: Counts actions by
sourcein each time bin, focusing on intervals with more than 30 actions.Event Aggregation: Aggregates results to check if both actions (
FILE_OPENandFILE_RENAME) are present within the time bin.Flagging Potential Ransomware: Flags results where both actions appear at least 100 times within the 5-minute bin, signaling excessive file activity.
Detecting Excessive File Renaming with New Extensions
This search focuses on ransomware’s habit of renaming files by adding unique extensions, helping identify possible ransomware-encrypted files:
Search Breakdown:
Index, Action, and Time Filtering: Limits results to file renames within 5-minute time bins.
Extracting Extensions: Uses regex to extract extensions from
nameandprev_namefields.Filtering Extension Changes: Keeps only records where the file extension has changed.
Aggregating Results: Counts occurrences by
source,new_file_name_extension, and originating IP.Flagging Potential Ransomware: Filters for cases where over 20 files in a 5-minute bin are renamed with the same new extension, as ransomware often applies a uniform extension during encryption.
Additional Resources for Ransomware Detection:
These resources provide lists of known ransomware extensions and naming patterns:
Last updated